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: 

How to get length of a data field

Former Member
0 Kudos

Hi Experts,

How to get length of a data field. For example data field /BIC/0COSTCENTER length is 9. and the entry in the table is /BIC/0COSTCENTER = 1000 only. How to get the lenth of value in the table.

Any help greatly appreciated. Thanks.

Best Regards,

Suresh.

7 REPLIES 7

Former Member
0 Kudos

Check in DD03L table or DD01L table.

Field Name LENG.

Former Member
0 Kudos

Hi Suresh,

do like this

data: var type i.

var = strlen(/BIC/0COSTCENTER).

Reward if it helps,

Satish

Former Member
0 Kudos

hi,

by using <b>strlen</b>, you can get the length, As per my knowledge

regards,

pavan

Former Member
0 Kudos

Hi

use the ABAP function/command to get the length of a string

<b>STRLEN</b>

Regards

anji

0 Kudos

Anji,

Please can give me example of code. thanks

Regards,

Suresh.

0 Kudos

Below is example code

Data: var1(10) type c value '2500',

var2 type i.

var2 = Strlen( var1 ).

write var2.

<b>Reward Points for helpful answers</b>

Satish

0 Kudos

data: lv_matnr type matnr, " this could be 18 or 40 characters
lv_len type i.


START-OF-SELECTION.

lv_matnr = '1234'.

DESCRIBE FIELD lv_matnr length lv_len In CHARACTER MODE

write:/ 'length', lv len. " this will be 18 or 40

lv_len = strlen( lv_matnr ).

write:/ 'strlen' , lv_len. " this will give 4