create simple ABAP class into abap program



User Rating:  / 5
PoorBest 
Details
Category: ABAP
Created on Monday, 17 December 2012 10:08
Last Updated on Monday, 17 December 2012 10:09
Published on Monday, 17 December 2012 10:08
Written by Administrator
Hits: 15493

The simple ABAP program writes to screen from simple ABAP class method:

View source
program ztest_class.
 
*--------------------------------------------------------------------
*  www.developerpages.gr
*--------------------------------------------------------------------
 
class myfirstclass DEFINITION FINAL.
  PUBLIC SECTION.
    methods hello_world.
ENDCLASS.
 
CLASS myfirstclass implementation.
  METHOD hello_world.
    write :/ 'Hello world from simple ABAP class !'.
  ENDMETHOD.
 
ENDCLASS.
 
data : my_hello TYPE REF TO myfirstclass.
 
START-OF-SELECTION.
 
* create object
CREATE OBJECT my_hello.
 
* Call method hello_world 
CALL METHOD my_hello->hello_world.