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 extract characters from string

Former Member
0 Kudos

Dear experts,

How can we extract characters from a given string

in this case.

The prgram fail to compile in *1 and *2.

How can i debug to get output.

data: pa_num(20) type c.

pa_num = '1245678.44'.

len = strlen( pa_num ).

FIND '.' in pa_num.

if sy-subrc = 0.

      • DECIMAL EXISTS.

i_broken-cnum = pa_num+(len-6)(3). *1

append i_broken.

else

      • NO DECIMAL EXISTS.

i_broken-cnum = pa_num+(len-3)(3). *2

append i_broken.

endif.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

i_broken-cnum = pa_num+(len-6)(3). wont work.

you cannot do any arithmetic operations in operands. you gotta do it manually before.

like following:

len = len - 6.

i_broken-cnum = pa_num+(len)(3).

4 REPLIES 4

Former Member
0 Kudos

try like this

completely mistaken

Former Member
0 Kudos

i_broken-cnum = pa_num+(len-6)(3). wont work.

you cannot do any arithmetic operations in operands. you gotta do it manually before.

like following:

len = len - 6.

i_broken-cnum = pa_num+(len)(3).

0 Kudos

This too not work as well.

0 Kudos

Hi,

write

i_brokencnum = pa_num+len(3).

len cant be in ().

Regards,

Surinder