IF f IS [NOT] SUPPLIED.
This variant checks to see whether or not the parameter f
was passed at runtime (
IMPORTING) or is to be passed (EXPORTING) in
function modules and methods. The
condition is true, if f contains a value, although the system checks only the actual value of the formal parameter, not the default value.
If the parameter is not optional, the system returns a runtime error. If f is a structure, you can only query the parameter itself, not the structure components.
A method meth contains the field op as an optional parameter. In the
following example, the case condition (using the CASE statement) is true only if op has been passed a value by the calling program.
CLASS test DEFINITION.
PUBLIC SECTION.
METHODS meth IMPORTING op
TYPE i OPTIONAL
EXCEPTIONS excp.
ENDCLASS.
CLASS test IMPLEMENTATION.
METHOD meth.
DATA:
feld TYPE i.
IF op IS SUPPLIED.
CASE
op.
WHEN 1.
feld
= 100.
WHEN 2.
feld
= 200.
WHEN OTHERS.
RAISE
excp.
ENDCASE.
ENDIF.
ENDMETHOD.
ENDCLASS.
IS REQUESTED, IS INITIAL, IS ASSIGNED