Purpose
With onscreen() command, you can specify screen blocks that are used for combining operations from multiple screens or transactions into a single script.
Note: The onscreen() command cannot be nested inside the loop.
This command is especially useful for executing operations that are initiated on a different screen as it is possible to initiate an action in one transaction and have it take place in a different transaction. This command is also used to write a single script that contains actions that take place on all necessary screens of a single transaction.
Syntax
onscreen 'SAP_Dynpro_Name.Number'
Options
The onscreen() command does not take any options.
Example
In the following example, we will use the onscreen() command to initiate an action from the Easy Access screen that will execute in the VA01 transaction. Specifically, we will set certain fields on the SAPMV45A.0101 and SAPMV45A.E4001 screens in a script that is entirely housed in the SAPLSMTR_NAVIGATION.E0100.sjs script file. We will trigger this action with an onUIEvents() command and use the onscreen() command to specify what actions occur in which screens.
-
In the Easy Access screen script file, SAPLSMTR_NAVIGATION.E0100.sjs, and enter the following code:
onUIEvents['Enter']={"fcode":"/nva01","process":z_test};
-
Now create a function that will execute the process, as shown:
function z_test() { onscreen 'SAPMV45A.0101' set("F[Order Type]", "OR"); set("F[Sales Organization]", "1000"); set("F[Sales Distribution]", "10"); set("F[Division]", "00"); enter(); onscreen 'SAPMV45A.4001' set("F[Sold-to party]", "1460"); enter(); }
-
On the Easy Access screen, press Enter key.
The function executes and the Sales Order screen appears, as shown:
Usage Details
-
Trigger ActiveX menus such as Services for Object functionality in sync with onscreen()
-
Transfering values from Liquid UI table to SAP table in combination with onscreen()
-
Copy text from one screen to another screen in sync with onscreen()
-
Display multiple status messages in combination with onscreen()