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

how replace works?

Former Member
0 Likes
498

hi experts

my code is as follows

if I_KNA1-NAME1 CA ','.

replace ',' with ' ' into I_OUTPUT-NAME1.

else.

I_OUTPUT-NAME1 = I_KNA1-NAME1.

endif.

here i_output is internal table.

I_OUTPUT-NAME1 is not filled up. could you please tell me here the replace declaration is correct?

regards

priya

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
470

Hi,

replace ',' with ' ' in I_kna1-NAME1.

I_OUTPUT-NAME1 = I_kna1-NAME1.

regards,

keerthi.

3 REPLIES 3
Read only

Former Member
0 Likes
471

Hi,

replace ',' with ' ' in I_kna1-NAME1.

I_OUTPUT-NAME1 = I_kna1-NAME1.

regards,

keerthi.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
470

You can also use translate.

i_output-name1 = i_kna1-name1.
translate i_output-name1 using ', '.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
470

HI,

<b>REPLACE <str1> WITH <str2> INTO <c> [LENGTH <l>].</b>

DATA: STR1(1) VALUE ','.

if I_KNA1-NAME1 CA STR1.

replace STR1 with SPACE into I_OUTPUT-NAME1.

else.

I_OUTPUT-NAME1 = I_KNA1-NAME1.

endif.

YOu can use the Translate command insted of this REPALCE command, just write like TRANSLATE I_OUTPUT-NAME1 USING ','.

Hope this helps

Thanks

Sudheer