The requirement is to call the transaction and skip the initial screen by setting fixed values into the initial screen of the transaction
This is possible with a function attached to a pushbutton.
But in simple cases there is an alternate method, by using a SAP GUI built-in feature which allows specifying field values as part of the OK code
Examples:
1. Executes in same session
pushbutton([TOOLBAR],'Create Work Order (IW31)','/*IW31 AUFPAR-PM_AUFART=PM02; CAUFVD-IWERK=1000');
2. Executes in a new session
pushbutton([TOOLBAR],'Create Work Order (IW31)','/O*IW31 AUFPAR-PM_AUFART=PM02; CAUFVD-IWERK=1000');