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

Data conversion...

Former Member
0 Likes
444

Hi,

I want to do following conversion for a data:

abcdeghtyju -> abcdegh tyju

126789384 -> 12678 9384

afg37784df -> afg377 84df

Briefly, the last four numbers (alphanumerics) should split from the rest and create a data with

beginning numbers , space and last 4 digits.

Rajesh..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
412

v_len = strlen( v_str ).

v_index = v_len - 4.

last_4 = v_str+v_index(4).

first_part = v_str+0(v_len).

concatenate first_part last_4 into v_str_new separated by space.

Regards,

ravi

3 REPLIES 3
Read only

Former Member
0 Likes
412

hi rajesh,

first reverse the string with STRING_REVERSE FM and then split that string after 4 characters and then concatenate all of them in to a new variable and then again use FM STRING_REVERSE. this fetches the result that you are looking for ...

regards,

santosh

Read only

Former Member
0 Likes
413

v_len = strlen( v_str ).

v_index = v_len - 4.

last_4 = v_str+v_index(4).

first_part = v_str+0(v_len).

concatenate first_part last_4 into v_str_new separated by space.

Regards,

ravi

Read only

rahulkavuri
Active Contributor
0 Likes
412

parameter: char1(30).

data: ONE(10) TYPE C,

TWO(10) TYPE C,

<b>one = char1+0(7).

two = char1+6(4).</b>

concatenate one two into char1 seperated by space.

modify the bolded code accordingly