- Syntax :
INTERFACE <INTERFACE NAME> .
**Define methods and events
ENDINTERFACE.
Ex :-
Steps :-
- Enter the program name which start's with Y or Z < program name > and click on Create.
Source Code
INTERFACE IF1 .
METHODS : FETCH_DATA IMPORTING IM_VBELN TYPE VBAP-VBELN
CHANGING CH_ITAB TYPE VBAP_T,
DISPLAY IMPORTING IM_ITAB TYPE VBAP_T.
ENDINTERFACE.
CLASS C1 DEFINITION.
PUBLIC SECTION.
INTERFACES : IF1.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS C1 IMPLEMENTATION.
METHOD IF1~FETCH_DATA.
SELECT * FROM VBAP INTO TABLE CH_ITAB WHERE VBELN = IM_VBELN.
ENDMETHOD.
METHOD IF1~DISPLAY.
DATA : WA_VBAP TYPE VBAP.
LOOP AT IM_ITAB INTO WA_VBAP.
WRITE : / WA_VBAP-VBELN , WA_VBAP-POSNR, WA_VBAP-MATNR ,
WA_VBAP-ARKTX , WA_VBAP-NETWR.
ENDLOOP.
ENDMETHOD.
ENDCLASS.
DATA : OBJ TYPE REF TO C1.
DATA : IT_VBAP TYPE TABLE OF VBAP.
PARAMETERS : P_VBELN TYPE VBAP-VBELN.
START-OF-SELECTION.
CREATE OBJECT OBJ.
CALL METHOD OBJ->IF1~FETCH_DATA
EXPORTING
IM_VBELN = P_VBELN
CHANGING
CH_ITAB = IT_VBAP.
CALL METHOD OBJ->IF1~DISPLAY
EXPORTING
IM_ITAB = IT_VBAP.
No comments:
Post a Comment