Skip to Content
0
Former Member
Mar 13, 2007 at 07:38 AM

ABAP Object sample prog

13 Views

Hi All,

I am beginner of ABAP objects.

REPORT example.

----


  • CLASS counter DEFINITION

----


*

----


CLASS counter DEFINITION.

PUBLIC SECTION.

METHODS : set IMPORTING value(set_value) TYPE i,

increment,

get EXPORTING value(get_value) TYPE i.

PRIVATE SECTION.

DATA : count TYPE i.

ENDCLASS. "counter DEFINITION.

----


  • CLASS counter IMPLEMENTATION

----


*

----


CLASS counter IMPLEMENTATION.

METHOD set.

count = set_value.

ENDMETHOD. "set

METHOD increment.

count = count + 1.

ENDMETHOD. "increment

METHOD get.

get_value = count.

ENDMETHOD. "get

ENDCLASS. "counter IMPLEMENTATION

DATA cnt TYPE REF TO counter.

CREATE OBJECT cnt.

DATA : number TYPE i VALUE 5.

CALL METHOD cnt->set

EXPORTING

set_value = number.

DO 3 TIMES.

CALL METHOD cnt->increment.

ENDDO.

call method cnt->get

importing get_value = number.

It is giving error like Stament is not accessbile

please help