The best way to get started with scripting is to use the "record" feature to record yourself performing the actions you want the script button to automate, and then look at the recorded script and see how it does things. That helps a lot with writing script steps manually.
So, record yourself running transaction IW21 and see what the script looks like...
Steve.