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

REPLACE

Former Member
0 Likes
409

Hi Experts!!

I have next code:

CLEAR l_leng.

l_leng = STRLEN( l_descripcion ).

l_leng = l_leng - 1.

DO l_leng TIMES.

REPLACE ' ' WITH '_' INTO l_descripcion.

IF sy-subrc NE 0.

EXIT.

ENDIF.

ENDDO.

I want change blank space for '_', but I don't Know.

Example: l_descripcion = 'DES CRIP CION'. --> DES_CRIP_CION___________

I tried with REPLACE ALL OCURRENCE , but when I use condition ' ', dump ocurred.

How Can I do it?

Thaks.

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
374

data:lv_char type char20.
data:lv_len type i.
lv_char = 'DE SC RI PT ION'.
lv_len = strlen( lv_char ).
replace all occurrences of ` ` in lv_char(lv_len) with '_' .
write lv_char.

or


data:lv_char type char20.
lv_char = 'DE SC RI PT ION'.
replace all occurrences of ` ` in lv_char with '_' .
write lv_char.

Edited by: Keshav.T on Apr 26, 2010 7:18 PM

1 REPLY 1
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
375

data:lv_char type char20.
data:lv_len type i.
lv_char = 'DE SC RI PT ION'.
lv_len = strlen( lv_char ).
replace all occurrences of ` ` in lv_char(lv_len) with '_' .
write lv_char.

or


data:lv_char type char20.
lv_char = 'DE SC RI PT ION'.
replace all occurrences of ` ` in lv_char with '_' .
write lv_char.

Edited by: Keshav.T on Apr 26, 2010 7:18 PM