Liquid UI - WS Reference Library



This example demonstrates the usage of setcursor command in different scenarios.

Scenario 1:Using setcursor() command with Liquid UI fields

To set the cursor into a Liquid UI field, you must use the field name. Currently coordinates are not supported for this command.

User Interface
On execution, the cursor appears on the 'Price' item field, as shown in the following figure:


On the SAP Easy Access screen, execute the following script:

for(a=firstChild; a!=null; a=a.nextSibling){

Scenario 2: Using setcursor() command in list

To place the cursor at a predetermined spot in the list on the Create Sales Order screen, for example next to the Distribution Channel field, you will need to first find the coordinates of the spot and then use setcursor() command to position the cursor.
Note: When using setcursor() command with coordinates, the cursor must be placed in a native SAP field. It cannot be positioned in a spot where no field exists. Also, co-ordinates only works with native SAP fields and do not work with Liquid UI fields.

To demonstrate the usage, we will position the cursor in the Division field on the Create Sales Order screen.

User Interface

The cursor appears on the 'Division' field, as shown in the following figure:

  1. Create the script file SAPMV45A.E0101.sjs (for va01 screen).
  2. Enter the command:
     setcursor([7, 11]);
  3. Execute the script file.

Scenario 3 : Using setcursor with table cells

To position the cursor in a specific table cell.

      1. Create the script file SAPMV45A.E0101.sjs (for va01 screen), as shown in the attachment.
      2. Navigate to Create Sales Order (nva01) screen, as shown in the following figure:

      3. On the toolbar, click setcursor.

User Interface

Sales Order screen appears, with the cursor in the second field of the Order Quantity column, as shown in the following figure:



function z_setcursor(){
  // Create Sales Order: Initial Screen 
  onscreen 'SAPMV45A.0101'
set('F[Order Type]','or'); set('F[Sales Organization]','1000'); set('F[Distribution Channel]','10'); set('F[Division','00'); enter(); // Create Standard Order: Overview onscreen 'SAPMV45A.4001' set('F[Sold-to party]','1175'); set('F[Ship-to party]','1175'); set('F[PO Number]','01111'); set('cell[All items,Material,1]','L-80f'); set('cell[All items,Order Quantity,1]','1'); //setcursor('cell[All items,Order Quantity,2]'); enter(); //Create Standard Order: Overview onscreen 'SAPMSDYP.0010' enter(); //Create Standard Order: Overview onscreen 'SAPMV45A.4001'
setcursor('cell[All items,Order Quantity,2]'); //enter(); }