Ex :-
Steps :-
- Go to Transaction code SE24.
- Pop-up will appear.
- Enter the Description.
- Un-check the Final.
- Click on SAVE.
- Assign the Package.
- Enter the Method name , Level , Visibility and Description.
- Place the cursor on Method name and click on Parameters to assign parameters.
- Pass the importing , exporting , changing parameters.
- Click on Methods.
- Double click on Method name.
- Enter the logic.
- Save -> Check -> Activate.
- Click on Save Button.
- Save it in either Local Package or Package.
To Re-define the Method
- Select method which to be re-define and click on Redefine.
- Look like,
- Enable Super Class method.
- Pass the parameters and redefine the inherited super class method.
- Logic.
CALL METHOD SUPER->FETCH_DATA_VBAP
EXPORTING
IM_VBELN = IM_VBELN
CHANGING
CH_ITAB = CH_ITAB
.
DATA : IT_VBAK TYPE TABLE OF VBAK,
WA_VBAK TYPE VBAK.
SELECT * FROM VBAK INTO TABLE IT_VBAK FOR ALL ENTRIES IN CH_ITAB
WHERE VBELN = CH_ITAB-VBELN.
LOOP AT IT_VBAK INTO WA_VBAK.
WRITE : / WA_VBAK-VBELN , WA_VBAK-VKORG , WA_VBAK-KUNNR , WA_VBAK-ERDAT.
ENDLOOP.
- Click on Save .
- Click on Back.
- Save -> Check -> Activate.
- Copy the Child class name.
Main Program :-
- Go to Transaction Code SE38.
- Source Code
DATA : OBJ TYPE REF TO ZCL_CHILD_CLASS.
DATA : IT_VBAP TYPE TABLE OF VBAP.
PARAMETERS : P_VBELN TYPE VBAP-VBELN.
START-OF-SELECTION.
CREATE OBJECT OBJ.
CALL METHOD OBJ->FETCH_DATA_VBAP
EXPORTING
IM_VBELN = P_VBELN
CHANGING
CH_ITAB = IT_VBAP
.
ULINE.
CALL METHOD OBJ->DISPLAY_VBAP
EXPORTING
IM_ITAB = IT_VBAP
.
No comments:
Post a Comment