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 command is not working

Former Member
0 Likes
1,564

Hi,

I am using below code, but it is not replacing correctly.

data DWORK_VAL(510) type C.

DWORK_VAL = 'DWORK_VAL ~~~efghijklmnopqrstuvxyz~~~'.

loop at text_content assigning <fs>.

search <fs> for DWORK_VAL.

if sy-subrc = 0.

replace DWORK_VAL in <fs> with 'ABCDE...ashdalkjhsd----


888*****'.

modify text_content from <fs> index sy-tabix.

endif.

Thanks,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,354

If you are using field symbol , there is no need to use MODIFY.

You code should work properly.

Regards,

Mohaiyuddin

9 REPLIES 9
Read only

Former Member
0 Likes
1,354

which version are u using?

Read only

0 Likes
1,354

I am using 4.7ee.

Read only

Former Member
0 Likes
1,355

If you are using field symbol , there is no need to use MODIFY.

You code should work properly.

Regards,

Mohaiyuddin

Read only

0 Likes
1,354

Is it change automatically without modify command.

Read only

0 Likes
1,354

Yes, you are using field symbol and it will change your table content directly.

Regards,

Mohaiyuddin

Read only

0 Likes
1,354

But is it wrong what i have wrote in code.

Read only

0 Likes
1,354

I think it should work.

Can you post you complete code. (Along with internal table definition and definition of <fs>).

Moreover, it will be helpful if you can give test scenario in which you think data should get replaced.

Regards,

Mohaiyuddin

Read only

Former Member
0 Likes
1,354

example:-

Data : var1(6) type c.

Data : var2(6) type c.

Data : var3(15) type c.

Data : len type i.

var1 = 'GO'.

var2 = 'GONE'.

var3 = 'ABCDGOEFGH'.

len = strlen( var1 ).

REPLACE var1 LENGTH len WITH var2 INTO var3.

condense var3 no-gaps.

write:var3.

no need modify

Read only

Former Member
0 Likes
1,354

Hi:

Instead of Field symbol, please use an internal table.

Regards

Shashi