SAP Tech Pro

SAP Technical Blog
Topprice Price Comparison

Simple example on Class/Methods

Simple example on Class/Methods



CLASS test DEFINITION.
  PUBLIC SECTION.
    METHODS test_method.
ENDCLASS.

CLASS test IMPLEMENTATION.
  METHOD test_method.
    WRITE:/ 'This is my method'.
  ENDMETHOD.
ENDCLASS.

* Main Program **************
START-OF-SELECTION.

  DATA: obj_ref TYPE REF TO test.   " object reference is assigned
  CREATE OBJECT: obj_ref. 	    " object is created
  CALL METHOD obj_ref->test_method. " object method is called using the reference.

END-OF-SELECTION.

Output -> This is my method

Add comment

Before Buying, Compare Prices at Topprice.in

Topprice.in