cancel
Showing results for 
Search instead for 
Did you mean: 

"Create Object " statement gives error: statement is not accessible

Former Member
0 Kudos

Hi All

U must b doing good.

I am new in ABAP Objects.

I have writeen a simple Class definition n Implimentasion code.

but whenever i write statement "Create object", it gives error.

'm working on SAP Dev 4.7.

the code was like this:-

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.

CLASS counter IMPLEMENTATION.

METHOD set.

count = set_value.

ENDMETHOD.

METHOD increment.

count = count + 1.

ENDMETHOD.

METHOD get.

get_value = count.

ENDMETHOD.

ENDCLASS.

DATA: cnt_1 TYPE REF TO counter.

DATA number TYPE I VALUE 5.

CREATE OBJECT cnt_1 .

CALL METHOD cnt_1->set

EXPORTING set_value = number.

DO 3 TIMES.

CALL METHOD cnt_1->increment.

ENDDO.

CALL METHOD cnt_1->get

IMPORTING get_value = number.

write: number.

its giving error like:-"Statement is not accessible."

plz tell me the way to resolve this error.

thanx n regards

Prashant tiwari

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

hi prashant..........

you should post it in abap forumn....

any way the solution is that,

before the data declaration part, give start-of-selection.

---regards,

alex b justin

Former Member
0 Kudos

thanx alex.

now thts working well.

thanx a lot.

actually i dont from where to crete a thread,first tym it waz created by clicking on here-n-there.

if u can tell me the way to create a thread properly.

i'll b much thnkfull to you.i also wanna reward for my questions which is answered .

thnx agn.

Former Member
0 Kudos

hi prashant....

this is the link to post your therads for abap objects:

[;.

if you want to reward, on the left of every reply ther would be some radio buttons like answere, helpful answer,... so on. click the radio button which suits you. answered closes the thread and other points are displayed there itself.

---regards,

alex b justin