Application Development 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: 

cl_alv_table_create=>create_dynamic_table 'Type is unknown' error

Former Member
0 Kudos
224

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

1 ACCEPTED SOLUTION

MarcinPciak
Active Contributor
0 Kudos
110

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

2 REPLIES 2

MarcinPciak
Active Contributor
0 Kudos
111

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

0 Kudos
110

Thanks a lot, Marcin. Rewarded