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

cl_alv_table_create=>create_dynamic_table to use for duplicate fields

Former Member
0 Likes
1,197

hi all,

i used cl_alv_table_create=>create_dynamic_table for creating dynamic internal table. the fieldcatalog contains a field (ATWRT) multiple times. it is showing a dump. may i know how to dynamically declare an internal table with fieldcatalog contains a field with multiple occurence?

Thanks in advance

Regards,

Kothand

hi all,

i used cl_alv_table_create=>create_dynamic_table for creating dynamic internal table. the fieldcatalog contains a field (ATWRT) multiple times. it is showing a dump. may i know how to dynamically declare an internal table with fieldcatalog contains a field with multiple occurence?

Thanks in advance

Regards,

Kothand

5 REPLIES 5
Read only

hymavathi_oruganti
Active Contributor
0 Likes
896

i did not understand ur doubt clearly?

can u pls explain it again? u mean, u r building fieldcat for the same field multiple times?y so?can u post ur code here?

Read only

0 Likes
896

yes. actually i need an internal table with N number of columns which can be determined at run time. it needs 10 to 100 columns of ATWRT field depends on selection logic. when i use cl_alv_table_create=>create_dynamic_table it is showing a dump. the code is,

  • Get the structure of the table AUSP.

ref_table_des ?=

cl_abap_typedescr=>describe_by_name( lv_ausp ).

idetails[] = ref_table_des->components[].

loop at idetails into xdetails.

if xdetails-name eq 'ATWRT'.

gs_alv1_fc-fieldname = xdetails-name .

gs_alv1_fc-datatype = xdetails-type_kind.

gs_alv1_fc-inttype = xdetails-type_kind.

gs_alv1_fc-intlen = xdetails-length.

gs_alv1_fc-decimals = xdetails-decimals.

endif.

endloop.

loop at gt_ausp reference into lt_ausp.

append gs_alv1_fc to gt_alv1_fc.

endloop.

  • Create dynamic internal table and assign to FS

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = gt_alv1_fc

IMPORTING

ep_table = gt_alv1_data.

ASSIGN gt_alv1_data->* TO <gt_alv1_data>.

  • Create dynamic work area and assign to FS

CREATE DATA gt_alv1_line LIKE LINE OF <gt_alv1_data>.

ASSIGN gt_alv1_line->* TO <gt_alv_wa>.

Read only

Former Member
0 Likes
896

Reward points if it is useful....

Read only

Former Member
0 Likes
896

Thanks all.points rewarded

Read only

0 Likes
896

How do you remove the dynamic table/clean up when you dont need the table anymore. F.ex. If I need to make a dymaic table in my program several times ?.