Function
Single step of the script that is in debugging mode in the current context. STEP_OUT ends the current function and, therefore, has the same effect as Return (F7) in the ABAP Debugger.
Returning Parameter
RESULT (Type STRING)
Value of the last statement executed in the script. The result of STEP_OUT is, therefore, only achieved when the final statement has been reached.
Example
report DEMO_JAVA_SCRIPT_STEP_OUT.
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.
if JS_PROCESSOR->BREAKPOINT_LINE_NUMBER = 4.
JS_PROCESSOR->STEP_OUT( ).
else.
JS_PROCESSOR->STEP_INTO( ).
endif.
endwhile.
The example works in the same way as with the
STEP_INTO example, except that the Set_String function here is exited when line 4 is reached via STEP_OUT.