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: 

Length report double

sanju_joseph
Participant
0 Kudos

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

6 REPLIES 6

Sm1tje
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

well you can try adding table and check this in your system .i understand behaviour will be same across the system

Sm1tje
Active Contributor
0 Kudos

I did, I even tried several structures from DD, but they all seem to have a different TYPE_KIND (not equal to 'u').

Former Member
0 Kudos

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

Sm1tje
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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