Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Please help to find the error in the following code

Former Member
0 Kudos
170

REPORT ZTESTSAMPLE.

CLASS C1 DEFINITION.

PUBLIC SECTION.

METHODS M1.

ENDCLASS.

CLASS C1 IMPLEMENTATION.

METHOD M1.

WRITE: /'HELLO'.

endmethod.

endclass.

DATA OREF TYPE REF TO C1.

*CREATE OBJECT OREF.

OREF->M1().

1 ACCEPTED SOLUTION

Former Member
0 Kudos
150

CLASS C1 DEFINITION.

PUBLIC SECTION.

METHODS M1.

ENDCLASS.

CLASS C1 IMPLEMENTATION.

METHOD M1.

WRITE: /'HELLO'.

endmethod.

endclass.

start-of-selection.

data: obj type ref to c1.

create object : obj .

call method: obj->m1.

regards,

venkat

7 REPLIES 7

Former Member
0 Kudos
150

You have not created the object OREF. The line is commented out. Therefore calling the method M1 will cause a dump.

0 Kudos
150

even if i uncommnet it then also not getting any out put

dhruv_shah3
Active Contributor
0 Kudos
150

Hi,

Just look the example bcalv_grid_02 in the SLIS package.

and you will get the idea.

HTH

Regards,

Dhruv Shah

Former Member
0 Kudos
151

CLASS C1 DEFINITION.

PUBLIC SECTION.

METHODS M1.

ENDCLASS.

CLASS C1 IMPLEMENTATION.

METHOD M1.

WRITE: /'HELLO'.

endmethod.

endclass.

start-of-selection.

data: obj type ref to c1.

create object : obj .

call method: obj->m1.

regards,

venkat

Former Member
0 Kudos
150

Thanks venkat .....

Former Member
0 Kudos
150

Hi

when we are calling a method we need to use

call method obj->m1.

Former Member
0 Kudos
150

Hi,

here is the solution

-


CLASS C1 DEFINITION

-


*

-


CLASS c1 DEFINITION.

PUBLIC SECTION.

METHODS m1.

ENDCLASS. "C1 DEFINITION

-


CLASS C1 IMPLEMENTATION

-


*

-


CLASS c1 IMPLEMENTATION.

METHOD m1.

WRITE: /'HELLO'.

ENDMETHOD. "M1

ENDCLASS. "C1 IMPLEMENTATION

DATA : oref TYPE REF TO c1.

START-OF-SELECTION.

CREATE OBJECT : oref.

CALL METHOD oref->m1.

reward if helpful