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

DESCRIBE FIELD issue when calculation length

Former Member
0 Likes
2,365

Hi Experts

i am facing a issue with DESCRIBE LENGTH

my code is somewhat liek this

DESCRIBE FIELD <fs> LENGTH lv_len IN CHARACTER MODE.

here <fs> is of type P and its coming dynamically and gives dump that At the statment "DESCRIBE"

only character-type data objects are supported at the argument position "<FS>", but no strings are supported (data types STRING and XSTRING).

and just one more thing value coming in <fs> is sometimes decimal also like 78.20 .

Please help .

Sunny.

Moderator message: subject edited, please do not use all upper case in the future.

Edited by: Thomas Zloch on Aug 3, 2010 5:43 PM

Hi Experts

i am facing a issue with DESCRIBE LENGTH

my code is somewhat liek this

DESCRIBE FIELD <fs> LENGTH lv_len IN CHARACTER MODE.

here <fs> is of type P and its coming dynamically and gives dump that At the statment "DESCRIBE"

only character-type data objects are supported at the argument position "<FS>", but no strings are supported (data types STRING and XSTRING).

and just one more thing value coming in <fs> is sometimes decimal also like 78.20 .

Please help .

Sunny.

Moderator message: subject edited, please do not use all upper case in the future.

Edited by: Thomas Zloch on Aug 3, 2010 5:43 PM

7 REPLIES 7
Read only

Former Member
0 Likes
1,761

Hi. You could make a new variable:


data: lv_str(132) type c.
lv_str = <fs>.
DESCRIBE FIELD lv_str LENGTH lv_len IN CHARACTER MODE.

Read only

0 Likes
1,761

HI erik

with this i always get length as 132.

thanks

sunny

Read only

0 Likes
1,761

Hi Sunny,

Sorry about that... I should have run that code I guess...

This works for both type P and 😧


data: lv_str_fs type string.

lv_str_fs = <fs>.
CONDENSE lv_str_fs.
lv_len = STRLEN( lv_str_fs ).

- Erik

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,761

Hi ,

Just one question ..do you need the length of the field or the length of the field content ?

If you need the length of the field then you have to give the name of the field in describe statement.

without knowing how your <fs> is getting populated its hard to give a solution.

Read only

Former Member
0 Likes
1,761

if u want to find field content length then use following logic


DATA: linelength TYPE i VALUE 0.
DATA: text TYPE string.

text = 'L0593V1'.

 linelength = STRLEN( text ).
write linelength.

Read only

Former Member
0 Likes
1,761

Try something like this,


data: lv_type type c.

DESCRIBE FIELD <fs> type lv_type. 

if lv_type CA 'CNDTS'.
DESCRIBE FIELD <fs> LENGTH lv_len IN CHARACTER MODE.
else.
DESCRIBE FIELD <fs> LENGTH lv_len IN BYTE MODE.
endif.

Vikranth

Read only

Former Member
0 Likes
1,761

Thanks