Google Search - Blog...........

ABAP - Different Ways Of Calling A Method With One Import Parameter - OOPS Concept.

This program has a class, C1 with a method: meth1. This method has only one import parameter (input1). Look at the method implementation for details. The main purpose of this program is to demonstrate the different ways of calling a method with single import parameter.
------------------------------------------------------------------------------------------
REPORT YSUBDEL.

CLASS C1 DEFINITION.
PUBLIC SECTION.
DATA: NUM TYPE I VALUE 5.
METHODS: METH1 IMPORTING INPUT1 TYPE I .
ENDCLASS.

CLASS C1 IMPLEMENTATION.
METHOD: METH1.
num = NUM * INPUT1 .
WRITE:/5 NUM .
num = 5.
ENDMETHOD.
ENDCLASS.


START-OF-SELECTION.
DATA: OREF1 TYPE REF TO C1.
CREATE OBJECT: OREF1.
* Different ways of calling the method with one import parameter
CALL METHOD OREF1->METH1 EXPORTING INPUT1 = 4.
CALL METHOD OREF1->METH1( INPUT1 = 5 ).
CALL METHOD OREF1->METH1( 6 ).

Output 20
25
30

2 comments:

  1. excellent boss thank you for all these examples
    The events example is so sweet thnq once again
    Regards,
    Amar

    ReplyDelete
  2. very good examples for o abap . thanks alot

    ReplyDelete