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

OO method question

Former Member
0 Likes
719

Hi,

i have Method that i write like below and its working o.k.

i ant to change the way i write it but i have error how can i solve it?

Regards

CALL METHOD leaf_ref->find_leaf    "working o.k. 
       EXPORTING
         node_tab = node_tab
        RECEIVING
          leaf_tab = leaf_tab.

have Error :

leaf_tab = leaf_ref->find_leaf( node_tab ) .

You can only omit the parameter name if the method only has a

non-optional parameter or an optional IMPORTING parameter that is

identified by "PREFERRED PARAMETER". by "PREFERRED PARAMETER".

1 ACCEPTED SOLUTION
Read only

narin_nandivada3
Active Contributor
0 Likes
655

Hi Cosmo Kramer,

Why do you want to go for the second way...

The Best way while working with patterns is the best way to get rid of those errors... The functionality is

for both the ways.. in that case i agree with you...

So why dont you go with the first way... and use PATTERN option in the editor...

And Use the PATTERN if you are using the global classes..

Go with the second method if you are defining local classes..

Hope this would help you.

Good luck

Narin

5 REPLIES 5
Read only

Former Member
0 Likes
655

well you once again need thet "call method" thingie.

best way not to stumble into such things is to use the pattern-button in SE80.

select pattern for ABAP-OO and hit ENTER. Rest should be self explaining.

Read only

b_deterd2
Active Contributor
0 Likes
655

Hi,


leaf_tab = leaf_ref->find_leaf( node_tab = node_tab ) .

Regards,

Bert

Read only

Former Member
0 Likes
655

Hi Bert Deterd ,

Thanks its work ,

maybe u can explain shortly why it work o.k. in parameter like this :

node_tab = child_ref->find_hier( znodefather ).

and in table it work like u write.

leaf_tab = leaf_ref->find_leaf( node_tab = node_tab ) .

Regards

Read only

Former Member
0 Likes
655

it is working fine for me. I am not getting any error.

REPORT  ztest_obj.

CLASS lcl_test DEFINITION.
  PUBLIC SECTION.
    METHODS test_method
       IMPORTING flag TYPE i
       RETURNING value(flag2) TYPE i.
ENDCLASS.                    "lcl_test DEFINITION


CLASS lcl_test IMPLEMENTATION.
  METHOD test_method.
    flag2 = flag  + 10.
  ENDMETHOD.                    "test_method
ENDCLASS.                    "math IMPLEMENTATION

START-OF-SELECTION.

  DATA oref TYPE REF TO lcl_test.
  DATA: flag TYPE i,
        test type i value 4.


  CREATE OBJECT oref.
 flag = oref->test_method( test ).

Read only

narin_nandivada3
Active Contributor
0 Likes
656

Hi Cosmo Kramer,

Why do you want to go for the second way...

The Best way while working with patterns is the best way to get rid of those errors... The functionality is

for both the ways.. in that case i agree with you...

So why dont you go with the first way... and use PATTERN option in the editor...

And Use the PATTERN if you are using the global classes..

Go with the second method if you are defining local classes..

Hope this would help you.

Good luck

Narin