Purpose
The enter() command simulates user actions within SAP screens.
The enter() command can be used to trigger functions by using function codes (fcodes), SAP transactions, functions, and other such actions. You can also specify the name of the pushbutton in the command instead of using its internal function code. Moreover, using an enter command without specifying any action in it, performs a normal enter operation in SAP. This command is often used in conjunction with the onscreen and onUIEvents commands.
Syntax
enter('action');
Parameters
The following parameters can be passed to the enter command to perform various actions on the screen.
Parameter | Definition |
---|---|
Function key code |
Each function key is mapped to a specific code. This code can be passed as a parameter to the enter command. In the following example, we will pass the code for the F3 function key: enter('/3');
Learn how to use Function key code.
|
Function names |
You can pass function names associated with menu items or pushbuttons. In the following example, we will pass the name of a function entitled 'HEAD': enter('=HEAD');
Learn how to use Function names.
|
hscrollto |
You can scroll horizontally on the list screen by using this parameter. The 'value' variable in the following script represents the column coordinates of the list screen on which you will be scrolling. enter('/hscrollto=value');
Learn how to use hscrollto.
|
Menu items |
You can use enter to navigate to a specific menu item as well. In the following example, we will pass the code for the Log off menu item: enter('/Menu=5,13');
Learn how to use Menu items.
|
No parameters |
To perform a simple enter command without passing any parameters, use the following syntax: enter(); Learn how to use with No parameters.
|
Pushbutton |
To perform a click on the pushbutton or to execute the process related to the pushbutton, use the following syntax: enter('P[pushbutton name]');
|
SAP transaction code |
You can also pass an SAP transaction code to the enter command. In the following example, we will pass the code for the VA01 transaction: enter('/nva01');
Learn how to use SAP transaction code.
|
SAP system status window |
To launch the system status window, you can use the following code: enter('?STAT');
Learn how to use SAP system status window.
|
ScrollToLine |
You can scroll to a specific line in a table by using this parameter. The 'absrow' variable in the following example is the absolute row number of the row to which you will be scrolling, and the 'tablename' variable is the name of the table. enter('/ScrollToLine=&V[absrow]', {"table":"T[tableName]"}); Note: The scrolltoline parameter is always used with the table option and will not work on an empty table.
Learn how to use ScrollToLine.
|
Tab code |
SAP tabs are also associated with unique codes that can be passed to an enter command as shown below: enter('=SP19');
You can also use the alternate syntax shown below to pass a tab code: enter('=T\\03');
Learn how to use Tab code.
|
Available Option
You can use the following options in the enter():
The table option specifies scrolling in a table on the screen. |
Option Detail
Note: The scrolltoline option will not work on an empty table.
Example
Calling a function
To call a function with the enter command, please do the following:
-
In the SAPMV45A.E0102.sjs script file for the VA01 transaction, enter the following code:
onUIIevents['Enter']={"fcode":"/nva02", "process":testUIEvent};
Note: See the onUIEvents section for details on using the onUIEvents command.
-
Write a function that will execute when the pushbutton is pressed. An example function is as follows:
function test_UIEvent() { onscreen 'SAPMV45A.0102' set("F[Order]","14200"); enter(); onscreen 'SAPMV45A.4001' enter(); }
-
Press the pushbutton to trigger the process. On execution of the function, the referenced transaction appears with the specified fields updated, as shown below: