RAISE


Basic form

RAISE except.

Effect

This statement only makes sense if used in conjunction with function modules.

It triggers the exception except .

If the program calling the function module is to handle the exception (see CALL FUNCTION ), control returns immediately to that program and the EXPORT parameters of the function module are not assigned values.
Otherwise, the program terminates with a suitable error message.

Example

The function module STRING_SPLIT would look something like the code specified below (see also the example for CALL FUNCTION ):
FUNCTION-POOL CSTR. FUNCTION STRING_SPLIT. ... IF STRING NA DELIMITER. RAISE NOT_FOUND. ENDIF. ... ENDFUNCTION.

The calling program may then contain the code:
PROGRAM EXAMPLE. ... CALL FUNCTION 'STRING_SPLIT' * ... EXCEPTIONS NOT_FOUND = 7. IF SY-SUBRC = 7. WRITE / 'There is a problem.'. ELSE. ... ENDIF.

If the RAISE statement in the function module STRING_SPLIT triggers the exception NOT_FOUND , processing of the function module terminates and returns to the calling program. In this case, the return code, which you read directly after the CALL FUNCTION statement, contains the value 7.
Related MESSAGE ... RAISING

Index
© SAP AG 1996