Entering content frameFunction documentation STEP Locate the document in its SAP Library structure

Function

Single step of the script that is in debugging mode in the current context. STEP executes function calls in the line and, therefore, has the same effect as Execute (F6) in the ABAP Debugger.

Returning Parameter

RESULT (Type STRING)

Value of the last statement executed in the script. The result of STEP is, therefore, only achieved when the final statement has been reached.

Example

Example

report DEMO_JAVA_SCRIPT_STEP.

data SOURCE type STRING.
data get_VALUE type STRING.

data JS_PROCESSOR type ref to CL_JAVA_SCRIPT.

JS_PROCESSOR = CL_JAVA_SCRIPT=>CREATE( ).

concatenate
  'var string = "Hello World,";   '
  'function Set_String()          '
  '  { string += " this";         '
  '    string += " is";           '
  '    string += " JavaScript!";} '
  'Set_String();                  '
  'string;                        '
   into SOURCE separated by CL_ABAP_CHAR_UTILITIES=>CR_LF.

JS_PROCESSOR->COMPILE(
              exporting
                SCRIPT_NAME = 'HELLO_WORLD.JS'
                SCRIPT      = SOURCE ).

JS_PROCESSOR->SET_BREAKPOINT(
              exporting
                SCRIPT_NAME = 'HELLO_WORLD.JS'
                LINE_NUMBER = 1 ).

JS_PROCESSOR->EXECUTE(
              exporting SCRIPT_NAME = 'HELLO_WORLD.JS' ).

while JS_PROCESSOR->LAST_CONDITION_CODE =
                   CL_JAVA_SCRIPT=>CC_BREAKPOINT.

  get_value = JS_PROCESSOR->get( NAME = 'string' ).
  write: / JS_PROCESSOR->BREAKPOINT_LINE_NUMBER, get_VALUE.

  JS_PROCESSOR->STEP( ).

endwhile.

A breakpoint in line 1 and execution of the script with EXECUTE switch the HELLO_WORLD.JS script to debugging mode. The script is then executed step by step until it is ended. The execution of the Set_String function is not resolved (compare STEP_INTO). The STEP method sets the LAST_CONDITION_CODE attribute that controls the WHILE loop.

Leaving content frame