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: 

Assign the value to our lenght field

suresh_s9
Participant
0 Kudos

hi,

i have some issue...

i want to declared one field called Salary..for this field length...before this i am finding the lentgh of other filed...

For example: for Kunnr value is 1000 the lenth is 4.

Now i want to declare to SALARY field dynamically with the lenth of 4(this is the length of ABAP)...

Suppose kunnr value is 12345...the lenght of salary should be 5.

Suppose kunnr value is 123456...the lenght of salary should be 6.

like this i need the solution.....

Please help me....

Regards,

Suresh S

2 REPLIES 2

Former Member
0 Kudos

data lv_swap type char20,

lv_len type i.

write kunnr to lv_swap left-justified.

lv_len = strlen( lv_swap ).

there you got your length.

Former Member
0 Kudos

Hi Suresh,

Try this Logic,

ddata : leng type i,

salary(4),

salary1(5),

KUNNR(4) VALUE '1234'.

leng = STRLEN( kunnr ).

if leng eq 4.

*write code for salary.

elseif leng eq 5.

*write code for salary1.

endif.

Thanks,

Reward If Helpful.