Global : Interface
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.
- Save -> Check -> Activate.
- Copy the Class name.
Main Program
- Go to Transaction code SE38.
- Enter the program name which 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 and click on SAVE.
- Source code
DATA : IT_VBRP TYPE TABLE OF VBRP.
DATA : OBJ TYPE REF TO ZCL_INTERFACE_USAGE.
PARAMETERS : P_VBELN TYPE VBRP-VBELN.
START-OF-SELECTION.
CREATE OBJECT OBJ.
CALL METHOD OBJ->ZIF_INTERFACE_TEST~FETCH_DATA
EXPORTING
IM_VBELN = P_VBELN
CHANGING
CH_ITAB = IT_VBRP
.
CALL METHOD OBJ->ZIF_INTERFACE_TEST~DISPLAY_VBRP
EXPORTING
IM_ITAB = IT_VBRP
.
Comments
Post a Comment