Monday, 12 September 2016

Global Class : Aliases

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.
  • Click on Alias Tab.


  • Enter the Alias name  and visibility.


  • Save -> Check -> Activate.

  • Copy the Class name.

Main Program

  • Go to transaction code SE38.

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


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


Input

  • Enter the input.

Output

  • Execute ( F8 ).


No comments:

Post a Comment