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

String Processing with Pipe Separators--> '|'

Former Member
0 Likes
550

Hi,

I have a requirement as below. I have a long string to be updated based on the database values. The String:

1|10-1234 |009|||||KE| |HALB|M|051399||IN| ||||PRMS|||||||||||||||||||0001||15||0||||||||0|0|0|||||||||||||||||||||||KE||P ||20060729||||||||||||||00|||||NORM||||||||||||||||||||

String+38(6)=>051399; to be modified with a value of size 8 Char =>95123456. But the total no of pipe separators to be maintained. Can you please suggest me a good solution for this.

Thanks and Regards,

Kannan.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
520

Hi kannan,

1. 1234<b>5</b>67890

5 to be replace with PPPPP

1234<b>PPPP</b>67890

2. Just copy paste to get a taste of it.

3.

report abc.

DATA : MYSTR(15) TYPE C.

MYSTR = '1234567890'.

REPLACE MYSTR+4(1) IN MYSTR WITH 'PPPPP'.

WRITE MYSTR.

regards,

amit m.

4 REPLIES 4
Read only

Former Member
0 Likes
520

v_repl = String+38(6).

replace v_repl with '95123456' in str.

Regards,

Ravi

Read only

Former Member
0 Likes
520

Hi,

Use concatenate.

concatenate lv_str0(38) '95123456' lv_str44

into lv_str.

Read only

Former Member
0 Likes
520

Hello Kannan,

U can use the replace command for this purpose.

ie) Replace String+38(6) with '95123456' into string.

If useful reward.

Vasanth

Read only

Former Member
0 Likes
521

Hi kannan,

1. 1234<b>5</b>67890

5 to be replace with PPPPP

1234<b>PPPP</b>67890

2. Just copy paste to get a taste of it.

3.

report abc.

DATA : MYSTR(15) TYPE C.

MYSTR = '1234567890'.

REPLACE MYSTR+4(1) IN MYSTR WITH 'PPPPP'.

WRITE MYSTR.

regards,

amit m.