Steps :-
- Go to Transaction code SE24.
- Enter the Object Type as Class name which start's with YCL_ or ZCL_<Class name> and click on create.
- Pop-up will appear.
- Enter the short description and click on save button.
- Class Interface looks like,
- Enter the method name.
- Select the Level and Visibility.
- Click on method name and click Parameters button.
- Screen looks like,
- Enter the Parameter name and select the type of it.
- Use Associated Type as select-options.
Creating custom select-options
- Go to transaction code SE11.
- Click on Data Type radio button.
- Enter the standard SELECT-OPTIONS structure name i.e RSDSELOPT.
- Click on Copy .
- Pop-up will appear.
- Customize select-options name and click on continue.
- Click on Change button.
- Pop-up will appear.
- Click on "Main,in Orginal Lang" .
- Structure looks like,
- Choose the Component Type for LOW and HIGH as per requirements and press ENTER.
- Copy the structure name.
- Go back to SE24.
- Enter the Associated Type as : customized Select-options name and press ENTER.
- For Internal table as parameter :Enter Parameter name.
- Select the Type.
- Enter the associated Type as : Table Type and press ENTER.
- Save it and click on BACK button.
- To add parameters to method.
- Click on method name and click on Parameters button.
- Enter the parameter name , its Type and Associated Type as Table Type and press ENTER.
Main Program
- Go to transaction code : SE38.
- To call global class method.
- Click on Pattern.
TABLES : MAKT.
DATA : OBJ TYPE REF TO ZCL_SELECT_OPT_ITAB.
DATA : IT_MAKT TYPE TABLE OF MAKT.
SELECT-OPTIONS : S_MATNR FOR MAKT-MATNR.
CREATE OBJECT OBJ.
CALL METHOD OBJ->FETCH_DATA
EXPORTING
IM_MATNR = S_MATNR
CHANGING
CH_ITAB = IT_MAKT
.
CALL METHOD OBJ->DISPLAY
EXPORTING
IM_ITAB = IT_MAKT
.
No comments:
Post a Comment