Google Search - Blog...........

ABAP - OOPS: Use Of Exception Table Keyword In Method Programming.

REPORT YSUBOOPS25 .
CLASS cl_abap_objectdescr DEFINITION LOAD.

CLASS c1 DEFINITION.
PUBLIC SECTION.
METHODS m1 EXCEPTIONS exc.
ENDCLASS.

CLASS c1 IMPLEMENTATION.
METHOD m1.
RAISE exc.
ENDMETHOD.
ENDCLASS.

DATA r TYPE REF TO object.

DATA f(3) TYPE c VALUE 'M1'.

DATA: etab TYPE abap_excpbind_tab,
etab_line LIKE LINE OF etab.

START-OF-SELECTION.

etab_line-name = 'EXC'.
etab_line-value = 4.
INSERT etab_line INTO TABLE etab.
IF sy-subrc ne 0.
EXIT.
ENDIF.

CREATE OBJECT r TYPE c1.

CALL METHOD r->(f) EXCEPTION-TABLE etab.
WRITE sy-subrc.

Output 4

No comments:

Post a Comment