10-18-2009 6:08 PM
Hi,
I have the code below and i am not sure why the length of the attribute are reported double
Code:
FIELD-SYMBOLS:
<fs_comp_wa> TYPE abap_compdescr.
DATA: lr_desc_table type ref to CL_ABAP_TYPEDESCR,
lr_desc_struc type ref to cl_abap_structdescr.
lr_desc_table ?= cl_abap_typedescr=>describe_by_data( ZTEST).
if lr_desc_table->type_kind = 'u'. " <- Structure
lr_desc_struc ?= lr_desc_table.
loop at lr_desc_struc->components ASSIGNING <fs_comp_wa>.
"check the length of the field at run time '<fs_comp_wa>-length'
ENDLOOP.
endif.
Regards,
Sanju
10-19-2009 7:08 AM
You used 'ZTEST' as a test object. How is this object defined in the data dictionary? It's hard to reproduce without us knowing what this 'ZTEST' is all about.
10-19-2009 7:13 AM
well you can try adding table and check this in your system .i understand behaviour will be same across the system
10-19-2009 7:56 AM
I did, I even tried several structures from DD, but they all seem to have a different TYPE_KIND (not equal to 'u').
10-19-2009 8:00 AM
Well in my example ZTEST is the standard table , it;s really strange that even after adding a stucture you are not getting u,well what you can do next is to ignore the if condition and execute the remaining statement
10-19-2009 8:18 AM
lr_desc_table ?= cl_abap_typedescr=>describe_by_name( 'BUT000' ).
Descibe by data does not work for me, so I used statement above.
And that works just fine for me. No double entries.
10-19-2009 8:21 AM
it;s really strange,why i am getting the issue,i have seen some blogs earlier on same issue and it looks to do with
unicode,i really didn;t understand what that has to do with length getting doubled ,but let me try your way and try
my luck