‎2010 Nov 21 3:17 PM
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
‎2010 Nov 21 5:16 PM
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
‎2010 Nov 21 7:32 PM
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?
‎2010 Nov 21 11:01 PM
Hi,
What errors are you experiencing?
Try changing your field symbol declaration to:
FIELD-SYMBOLS <any_table> TYPE ANY TABLE.
Cheers
Alex
‎2010 Nov 23 4:14 AM