2010 Oct 26 4:40 AM
Dear all,
I tried to create dynamic table using the method 'cl_alv_table_create=>create_dynamic_table'. But when i execute this metod, i encounter an error message 'Type xx is unknown'. Below are my codes:
I have this error message 'Type 'T_D_AR is unknown for T_D_AR-KUNNR'.
Anyone can help?
Your help will be much appreciated.
Thanks
2010 Oct 26 11:10 AM
I think you are mixing things up
1.
CREATE DATA dataref TYPE (my_tab).
This will fail as system doesn't recognize MY_TAB as a global DDIC type (which it expects to receive here)
Sorry this is ok (you can type it locally), but still you don't need to generate data reference in order to create dynamic table, the below procedure is enough.
2.
descr_struct_ref ?= cl_abap_typedescr=>describe_by_data( <fs> ).
If this was correctly executed you should generate table_descr_ref using cl_abap_tabledescr method create . Then all you need is
create data dataref type handle table_descr_ref.
... dataref now points to a table, so no need to use cl_alv_table_create=>create_dynamic_table anymore.
Basically you don't need point 1. You first need is to create data object from your type
data my_d_ar type t_d_ar.
descr_struct_ref ?= cl_abap_typedescr=>describe_by_data( my_d_ar ).
..."then proceed as mentioned in point 2
If you still don't feel comfortable with dynamic data generation I recommend reading [Do you really know everything about typing? - part 2|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/20887] [original link is broken] [original link is broken] [original link is broken];.
Regards
Marcin
Edited by: Marcin Pciak on Oct 26, 2010 12:24 PM
2010 Oct 26 11:10 AM
I think you are mixing things up
1.
CREATE DATA dataref TYPE (my_tab).
This will fail as system doesn't recognize MY_TAB as a global DDIC type (which it expects to receive here)
Sorry this is ok (you can type it locally), but still you don't need to generate data reference in order to create dynamic table, the below procedure is enough.
2.
descr_struct_ref ?= cl_abap_typedescr=>describe_by_data( <fs> ).
If this was correctly executed you should generate table_descr_ref using cl_abap_tabledescr method create . Then all you need is
create data dataref type handle table_descr_ref.
... dataref now points to a table, so no need to use cl_alv_table_create=>create_dynamic_table anymore.
Basically you don't need point 1. You first need is to create data object from your type
data my_d_ar type t_d_ar.
descr_struct_ref ?= cl_abap_typedescr=>describe_by_data( my_d_ar ).
..."then proceed as mentioned in point 2
If you still don't feel comfortable with dynamic data generation I recommend reading [Do you really know everything about typing? - part 2|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/20887] [original link is broken] [original link is broken] [original link is broken];.
Regards
Marcin
Edited by: Marcin Pciak on Oct 26, 2010 12:24 PM
2010 Oct 27 10:01 AM