Using setcursor with lists

You can use the setcursor command to place the cursor into a list. In this example we will place the cursor in a specific location on the VA01 initial screen.

If we wanted 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, we would first find the coordinates of the spot we wished to place the cursor. Once the coordinates have been identified, we can use setcursor to place the cursor in the specified location.

Note: When using setcursor with coordinates, the cursor must be placed in a native SAP field - it cannot be positioned in a spot where no field exists. Coordinates also do not work with GuiXT fields - only with native SAP fields.
  1. Launch SAP and navigate to the VA01 initial screen:
  2. Open the 'SAPMV45A.E0101.sjs' script file, and enter the following code. Create the file if it does not already exist.
    setcursor([7, 11]);
  3. Save the changes and refresh the SAP screen.

    The cursor is now in the Division field as shown below:

  4. Change the code as follows to move the cursor to a different field:
    setcursor("F[Distribution Channel]");

The cursopr will be in the Distribution CHannel field and the VA01 Overview screen will appear as follows: