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

table data as parameters

Former Member
0 Likes
627

Hi,

Tell me how can I do the following.

I have a class with some methods that return table data. The table types are different and I don't know it in general.

I have to create the program that can take method's returning table and print it.

What kind of type structure and type converting operation do Ihave to use?

Regards,

Malnor

4 REPLIES 4
Read only

Clemenss
Active Contributor
0 Likes
578

Hi Malnor,

if the methods use RETURNING parameter, generic typing is not allowed. If you use EXPORTING parameters, you can use TYPE ANY TABLE.

You can use data references regardless of parameter or table type.

Please describe your task as specific as it really is, then help will come more specific.

Your question does not give me any imagination about what you are trying to do.

Regards,

Clemens

Read only

Former Member
0 Likes
578

Hi Li,

I use methods with the exporting parameter type Table.

Class zmy_class definition.

...

Methods method_1

Exporting rtrn type Table.

....

Methods method_n

Exporting rtrn type Table.

Endclass.

Class zmy_class implementation.

Method method_1

......

rtrn = it_tbl_1.

Endmethod.

........

Method method_n

......

rtrn = it_tbl_n.

Endmethod.

endclass.

I have to get access to these tables in the FM .

FUNCTION zmy_fm.

...

DATA: o_meth_atr TYPE REF TO zmy_class,

l_tbl_rtrn TYPE REF TO data,

t_tbl_params TYPE abap_parmbind_tab,

l_tbl_param TYPE abap_parmbind.

FIELD-SYMBOLS <any_table> TYPE ANY.

create object o_meth_atr

exporting IM_BP_NUM = bpid.

l_tbl_param-name = 'RTRN'.

l_tbl_param-kind = cl_abap_objectdescr=>exporting.

get reference of l_tbl_rtrn into l_tbl_param-value.

insert l_tbl_param into table t_tbl_params.

loop at it_atr into wa_atr.

.......

call method o_meth_atr->(l_meth) parameter-table t_params.

assign l_tbl_rtrn->* to <any_table>.

Call function 'Z_PREPARE_TABLE'

tables

IT_ANY_TABLE = ???

........

endloop.

Endfunction.

FM Z_PREPARE_TABLE can print table. I tried IT_ANY_TABLE = l_tbl_rtrn and IT_ANY_TABLE = <any_table> there were errors.

What I have to put in IT_ANY_TABLE parameter of FM Z_PREPARE_TABLE?

Read only

alex_cook
Active Participant
0 Likes
578

Hi,

What errors are you experiencing?

Try changing your field symbol declaration to:


FIELD-SYMBOLS <any_table> TYPE ANY TABLE.

Cheers

Alex

Read only

Former Member
0 Likes
578

The problem is solved.

These links help me