Ex :-
Steps :-
To create Interface.
- Go to Transaction Code SE24.
- Enter the interface name start's with ZIF_< interface name > and click on Create.
- Pass the parameters.
- Click on Save and click on Back button.
- Create one more method to display data.
- Enter the parameters.
- Enter the Class name start's with ZCL_< class name > and click on Create button.
- Pop-up will appear.
- Enter the description and click on SAVE.
- Click on Interface Tab.
- Enter the interface name and Press ENTER.
- Click on Methods Tab.
- To implement the method, double click on method name.
- Pop-up will appear.
- Click on Yes.
- Implement the method.
- Save -> check.
- Click on Back button.
- Double click on Display method to implement it.
- Implement the method.
- Click on Save and click on Back button.
- Click on Alias Tab.
- Enter the program name start's with Y or Z < program name > and click on Create.
- Pop-up will appear.
- Enter the Title,
- Select Attribute Type as Executable Program.
- Click on SAVE.
- Source Code
DATA : OBJ TYPE REF TO ZCL_INTERFACE_USAGE.
DATA : IT_VBRP TYPE TABLE OF VBRP.
PARAMETERS : P_VBELN TYPE VBRP-VBELN.
START-OF-SELECTION.
CREATE OBJECT OBJ.
CALL METHOD OBJ->FETCH
EXPORTING
IM_VBELN = P_VBELN
CHANGING
CH_ITAB = IT_VBRP
.
CALL METHOD OBJ->DISPLAY
EXPORTING
IM_ITAB = IT_VBRP
.
No comments:
Post a Comment