Creating Interface in ABAP Objects with example

Go down

Creating Interface in ABAP Objects with example Empty Creating Interface in ABAP Objects with example

Post  Admin on Sun Apr 08, 2012 9:41 pm

*&---------------------------------------------------------------------*
*& Report Z_06
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZKRISH_OOPS_06.
*----------------------------------------------------------------------*
* INTERFACE i_data
*----------------------------------------------------------------------*
INTERFACE I_DATA.
METHODS: CREATE,CHANGE,DISPLAY.
ENDINTERFACE. "i_data

PARAMETERS: PO RADIOBUTTON GROUP R1 USER-COMMAND ABCD.
PARAMETERS: SO RADIOBUTTON GROUP R1.
SELECTION-SCREEN: ULINE.
PARAMETERS: CR RADIOBUTTON GROUP R2 USER-COMMAND ABCDE.
PARAMETERS: CH RADIOBUTTON GROUP R2.
PARAMETERS: DI RADIOBUTTON GROUP R2.


*----------------------------------------------------------------------*
* CLASS c1 DEFINITION
*----------------------------------------------------------------------*
CLASS C1 DEFINITION.
PUBLIC SECTION.
INTERFACES: I_DATA.
ENDCLASS. "c1 DEFINITION
*----------------------------------------------------------------------*
* CLASS c1 IMPLEMENTATION
*----------------------------------------------------------------------*
CLASS C1 IMPLEMENTATION.
METHOD: I_DATA~CREATE.
CALL TRANSACTION 'ME21N'.
ENDMETHOD. "i_data~create
METHOD: I_DATA~CHANGE.
CALL TRANSACTION 'ME22N'.
ENDMETHOD. "i_data~cHANGE
METHOD: I_DATA~DISPLAY.
CALL TRANSACTION 'ME23N'.
ENDMETHOD. "i_data~DISPLAY
ENDCLASS. "c1 IMPLEMENTATION

*----------------------------------------------------------------------*
* CLASS C2 DEFINITION
*----------------------------------------------------------------------*
CLASS C2 DEFINITION.
PUBLIC SECTION.
INTERFACES: I_DATA.
ENDCLASS. "C2 DEFINITION


*----------------------------------------------------------------------*
* CLASS C2 IMPLEMENTATION
*----------------------------------------------------------------------*
CLASS C2 IMPLEMENTATION.
METHOD: I_DATA~CREATE.
CALL TRANSACTION 'VA01'.
ENDMETHOD. "i_data~create
METHOD: I_DATA~CHANGE.
CALL TRANSACTION 'VA02'.
ENDMETHOD. "i_data~cHANGE
METHOD: I_DATA~DISPLAY.
CALL TRANSACTION 'VA03'.
ENDMETHOD. "i_data~DISPLAY
ENDCLASS. "C2 IMPLEMENTATION

START-OF-SELECTION.
DATA: O1 TYPE REF TO C1.
CREATE OBJECT O1.
DATA: O2 TYPE REF TO C2.
CREATE OBJECT O2.

DATA: IREF TYPE REF TO I_DATA.
IF PO = 'X'.
IREF = O1.
ELSE.
IREF = O2.
ENDIF.
IF CR = 'X'.
CALL METHOD IREF->CREATE.
ELSEIF CH = 'X'.
CALL METHOD IREF->CHANGE.
ELSE.
CALL METHOD IREF->DISPLAY.
ENDIF.

Admin
Admin

Posts : 92
Join date : 2012-01-26

http://mysaplab.forumotion.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum