Global Class : Passing parameters ( Parameter and Internal table ) to methods
Steps
- Go to transaction code SE24.
- Enter the method name.
- Select the level.
- Select the visibility and description.
- Click on Method name and click on Parameters Button.
- Initial screen looks like,
- Enter the import parameter name ,
- Click on Type.
- Click on F4 help and Select the Type.
- Click on Associated Type.
- Enter the associated type and press Enter.
- Enter the parameter name.
- Select the type using F4 help.
- Enter the Associated type as Table Type and press Enter.
- Click on Save and back button.
- Double click on method (FETCH_DATA).
- Screen looks like,
- Write the logic.
- Save it.
- Click on back button.
- Enter the method name.
- Select the Level and Visibility .
- Enter the description.
- Select the method and click on Parameters button.
- Screen looks like,
- Enter the parameter name.
- Enter the Type.
- Enter the Associated Type and press Enter.
Usage of Class
- Go to transaction code SE38.
Source code
DATA : OBJ TYPE REF TO ZCL_PARAM_ITAB.
DATA : IT 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
.
CALL METHOD OBJ->DISPLAY
CHANGING
IM_ITAB = IT
.
Comments
Post a Comment