Contents
Return value after a method call. The instance attribute LAST_CONDITION_CODE can be compared to
constants to call up information on possible errors.If LAST_CONDITION_CODE is different from the CC_OK constants, an error has occurred and the instance attribute
LAST_ERROR_MESSAGE contains an error message.Example
report DEMO_JAVA_SCRIPT_RETURN_CODE.
data SOURCE type STRING.
data JS_PROCESSOR type ref to CL_JAVA_SCRIPT.
JS_PROCESSOR = CL_JAVA_SCRIPT=>CREATE( ).
concatenate
'var string = "Hello World"; '
'strink; '
into SOURCE separated by CL_ABAP_CHAR_UTILITIES=>CR_LF.
JS_PROCESSOR->EVALUATE( exporting JAVA_SCRIPT = SOURCE ).
if JS_PROCESSOR->LAST_CONDITION_CODE <> CL_JAVA_SCRIPT=>CC_OK.
write JS_PROCESSOR->LAST_ERROR_MESSAGE.
endif.
Since an undefined variable strink is accessed in the second line of the SOURCE script, LAST_CONDITION_CODE is different from CC_OK and LAST_ERROR_MESSAGE contains the corresponding message.
See also the example under
GET.