CLASS C1 DEFINITION.
PUBLIC SECTION.
METHODS : FETCH_DATA IMPORTING IM_MATNR TYPE MAKT-MATNR
CHANGING CH_ITAB TYPE MAKT_ITAB,
DISPLAY IMPORTING IM_ITAB TYPE MAKT_ITAB.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS C1 IMPLEMENTATION.
METHOD FETCH_DATA.
SELECT * FROM MAKT INTO TABLE CH_ITAB WHERE MATNR = IM_MATNR.
ENDMETHOD.
METHOD DISPLAY.
DATA : WA_MAKT TYPE MAKT.
LOOP AT IM_ITAB INTO WA_MAKT.
WRITE : / WA_MAKT-MATNR , WA_MAKT-SPRAS , WA_MAKT-MAKTX.
ENDLOOP.
ENDMETHOD.
ENDCLASS.
DATA : OBJ TYPE REF TO C1.
DATA : IT_MAKT TYPE TABLE OF MAKT.
PARAMETERS : P_MATNR TYPE MAKT-MATNR.
START-OF-SELECTION.
CREATE OBJECT OBJ.
CALL METHOD OBJ->FETCH_DATA
EXPORTING
IM_MATNR = P_MATNR
CHANGING
CH_ITAB = IT_MAKT.
CALL METHOD OBJ->DISPLAY
EXPORTING
IM_ITAB = IT_MAKT.
Serkan AKKAVAK
Computer Engineer BSc
SAP Department Deputy Manager
Contact : serkurumsal@yandex.com
0 Comments