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

ABAP COMMAND REPLACE (Points will be awarded)

adnanmaqbool
Contributor
0 Likes
829

Dear Guys

I have a string e.g Ad$$$$$$$$$$$$$.

Now when I use REPLACE '$' WITH ' ' INTO L_NAME, replace command only replaces the first $ with ' ' from string.

While I want to replace all $ signs. Note I am using SAP 4.6C and I think the command replace all occurance not working 4.6C.

Also not no of occurances of $ is not fix in field.

6 REPLIES 6
Read only

varma_narayana
Active Contributor
0 Likes
800

Hi..

This is the Statement.

REPLACE ALL OCCURRENCES OF '$' WITH ' ' INTO L_NAME.

<b>Reward if Helpful</b>

Read only

Former Member
0 Likes
800

Hi Adnan

use replace all occurances of '$' WITH ' ' INTO L_NAME.

reward points to all helpful answers

kiran.M

Read only

Former Member
0 Likes
800

Hi,

The Replace Command will replace only the first String.

You can use Translate Command for this.

For Eg.,

Data : String(20) Type C Value 'Ad$$$$$$$$$$$$$'.

TRANSLATE STRING USING '$ '.

WRITE : STRING.

Regards,

Padmam.

Read only

Former Member
0 Likes
800

Hi

otherwise find the length

len = strlen ( l_name).

do len times.

REPLACE '$' WITH ' ' INTO L_NAME.

l_name = l_name.

enddo.

reward points to all helpful answers

kiran.M

Read only

Former Member
0 Likes
800

hi

good

try this process

USE STRLEN to get the length of the string,

declare a in index as i,

count from index one as first character and than you use the REPLACE statement.

thanks

mrutyun^

Read only

kostas_tsioubris
Contributor
0 Likes
800

Hi,

alternatively you use this

[code]

sy-subrc = 0.

while sy-subrc = 0.

REPLACE '$' WITH ' ' INTO L_NAME.

endwhile.[/code]

Kostas