Ex : -
Steps : -
- Go to Transaction Code SE38.
- Enter the program name start's with Y or Z < program name > and click on Create.
- Pop-up will appear.
- Enter the Title.
- Select the Attribute Type as Executable Program.
- Click on SAVE.
- 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.
ALIASES : FETCH FOR IF1~FETCH_DATA,
DISPLAY FOR IF1~DISPLAY.
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->FETCH
EXPORTING
IM_VBELN = P_VBELN
CHANGING
CH_ITAB = IT_VBAP.
CALL METHOD OBJ->DISPLAY
EXPORTING
IM_ITAB = IT_VBAP.
No comments:
Post a Comment