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

read return parameter of function module

martin_svik2
Participant
0 Likes
2,988

hi,

i am calling an function module and get back lc_element:

lc_element is defined this way:


lc_element        TYPE REF TO if_swf_cnt_element,


so far so good. when i set debugger after the call of the FM i get something like this when i click on lc_element:



i have NO idea of how to get the values of e.g. M_NAME or the values in the deep structure M_ELEM_REF. i can't loop over the lc_element as this is not an table.


so how can i access the data coming back into lc_element ?


br Martin



1 ACCEPTED SOLUTION
Read only

martin_svik2
Participant
0 Likes
2,387

thanks to all -> i have resolved it by calling the methods

i thougt i can read that out directly -> as the debugger displays this values directly.

7 REPLIES 7
Read only

hubert_heitzer
Contributor
0 Likes
2,387

Hi Martin,

as lc_element refers to an object, you can use its interface to get the required values.

Regards,

Hubert

Read only

Former Member
0 Likes
2,387

Hello Martin,

In you example, lc_element is a object reference to interface IF_SWF_CNT_ELEMENT which is embedded in class CL_SWF_CNT_ELEMENT where you can actually find implementation of several public methods.

So, to get the 'name' attribute for example, you will have to call the appropriate method, which I guess is GET_NAME:

DATA: lv_name type swfdname.

Call method lc_element->get_name importing NAME = lv_name.

Br,

Manu.

Read only

Patrick_vN
Active Contributor
0 Likes
2,387

If you check the interface IF_SWF_CNT_ELEMENT, you will find a number of 'getter'-methods..

There is a GET_NAME for instance (and when you check the parameters, you can find out what the method returns):

example

CALL METHOD lc_element->get_name

       IMPORTING

         name = l_element.

Read only

VenkatRamesh_V
Active Contributor
0 Likes
2,387

Hi Martin.

Try,

DATA: lv_element TYPE REF TO CL_SWF_CNT_ELEMENT,

       lv_name    TYPE SWFDNAME.

IF  lv_element IS BOUND.

lv_element->GET_NAME( IMPORTING NAME                 = lv_name

                                                          NAME_STRING   = lv_namestring

                                                           EDITELEM         = lv_element ).

ENDIF.


Hope it helpful,


Regards,

Venkat.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,387

Try a


lc_element->get_name(

  IMPORTING

    name       = lv_name

    name_string = lv_name_string

    editelem    = lv_editelem ).

Of course add some check/If/try...

Regards,

Raymond

Read only

martin_svik2
Participant
0 Likes
2,388

thanks to all -> i have resolved it by calling the methods

i thougt i can read that out directly -> as the debugger displays this values directly.

Read only

0 Likes
2,387

Did you notice the red icon, those attributes are "private", so you need a method to read them.

(Also Hubert's answer was the first good one, so you should mark it as correct)

Regards,

Raymond