2007 Oct 16 11:44 AM
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
2007 Oct 16 11:50 AM
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?
2007 Oct 16 11:57 AM
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>.
2007 Oct 16 11:57 AM
2008 Jan 12 3:16 PM
2008 Nov 22 3:50 PM
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 ?.