Liquid UI - WS Reference Library

enter()


Purpose

The enter() command simulates user actions within SAP screens.

The enter() command can be used to trigger function codes (fcodes), SAP transactions, functions, and other such actions. This command is often used in conjunction with the onscreen and onUIEvents commands.


Syntax

enter('action');

 

Parameters

There are number of parameters that can be passed to the enter command:

ParameterDefinition
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 listscreen by using this parameter. The 'value' variable in the following script represents the column coordinates of the listscreen 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.
SAP transaction code

You can also pass a 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 with the enter:

"table":".."

The table option specifies scrolling in a table on the screen.


Option Detail

table

  1. The table option specifies scrolling control in a table on the screen. This option is always used with the scrolltoline parameter.

  2. enter('/ScrollToLine=2',{"table":"T[All items]"});
  3. As per the code, on triggering an event, the control will shift to second row in a table.
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:

  1. 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.
  2. 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();
    }
  3. Press the pushbutton to trigger the process.

On execution of the function, the referenced transaction appears with the specified fields updated, as shown below: