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.
  • Pop-up will appear.
  • Enter the description and click on SAVE.
  • Save it in either Local Package or Package.
  • Enter the method name and Level.
  • To assign the parameters to the method , click on method name and Click on Parameters.

  • Pass the parameters.
  • Click on Save and click on Back button.
  • Create one more method to display data.

  • To assign the parameters to the method , click on method name and Click on Parameters.
 

  • Enter the parameters.
  • Click on Save and click on Back button.
  • Save -> Check -> Activate.

  • Copy the Interface name.

Usage 

  • 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
    .

  • Save -> Check -> Activate.
  • Execute ( F8 ).

Input

  • Enter the input.

Output

  • Click on Execute.

Comments

Popular posts from this blog

FOR ALL ENTRIES (FAE) -4 TABLES USING ALV_GRID_DISPLAY

RADIO-BUTTONS IN BASIC REPORT

MODULE POOL -TABLE CONTROL_1: