Application Development and Automation 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: 
Read only

Calling a method of a returned reference

Former Member
0 Likes
426

Hello,

is it possible to instantly do a method call on a returned reference in ABAP Objects? in this case i need it for singleton behaviour of "z_example", but the compiler wont allow me to call like this:

result = z_example=>get_instance( )->do_stuff( input_param another_param ).

i tried several other syntaxes (is this the right plural ), but it wasn't successful. in java its a standard thing:

result = Example.getInstance().doStuff(inputParam, anotherParam);

Thanks in advance,

Stefan

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
401

Hello Stefan

In 6.20 and 6.40 I do not think this is possible. In your example you have to invoke the method on result.

Perhaps with release >= 700 it may be possible.

Regards

Uwe

3 REPLIES 3
Read only

uwe_schieferstein
Active Contributor
0 Likes
402

Hello Stefan

In 6.20 and 6.40 I do not think this is possible. In your example you have to invoke the method on result.

Perhaps with release >= 700 it may be possible.

Regards

Uwe

Read only

0 Likes
401

No, you can't write your method calls like that in 7.00 either. Yes, this is the way, in java, but not in ABAP.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
401

Thanks for the answers.

this means i always have to declare temporary variables for the returned references, a bit annoying, but O.K.