Skip to Content
Former Member
Aug 13, 2010 at 05:51 AM

Dynamic Internal Table


Dear Experts,

Am trying to create a Dynamic Internal Table where the length of each field is getting DOUBLED in the output.

I mean to say, for example CLIENT output length is 6 instead of 3. All fields are exactly getting doubled the length

which is causing me a trouble for the below code:

If i divide the length by 2, it works. I know its not a right way to do. please suggest whats the problem here.

DATA : xdetails TYPE abap_compdescr.

DATA : idetails TYPE abap_compdescr_tab.

DATA : idetails_tmp TYPE abap_compdescr_tab.

DATA : ref_table_des TYPE REF TO cl_abap_structdescr.

DATA : ref_table_des_tmp TYPE REF TO cl_abap_structdescr.

ref_table_des ?= cl_abap_typedescr=>describe_by_name( 'ztab' ).

refresh idetails[].

refresh ifc.

idetails[] = ref_table_des->components[].

LOOP AT idetails INTO xdetails.

CLEAR xfc.

xfc-fieldname = xdetails-name .

xfc-datatype = xdetails-type_kind.

xfc-inttype = xdetails-type_kind.

xfc-intlen = xdetails-length.----


xfc-decimals = xdetails-decimals.

APPEND xfc TO ifc.


CALL METHOD cl_alv_table_create=>create_dynamic_table


it_fieldcatalog = ifc


ep_table = dy_table.

ASSIGN dy_table->* TO <dyn_table>.