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

subrc= 4 in REPLACE keyword

SagarSontakke
Active Participant
0 Likes
1,277

Hi all,

I am getting subrc= 4 when executing following replace statement.

wa-tdline = '####'.

REPLACE ALL OCCURRENCES OF '#' IN wa-tdline WITH space.

what will be the reason?

Regards,

SVS

Hi all,

I am getting subrc= 4 when executing following replace statement.

wa-tdline = '####'.

REPLACE ALL OCCURRENCES OF '#' IN wa-tdline WITH space.

what will be the reason?

Regards,

SVS

1 REPLY 1
Read only

Former Member
0 Likes
679
sy-subrc Meaning
0 The specified section or subsequence was replaced by the content of new and the result is available in full in dobj. 
2 The specified section or subsequence was replaced in dobj by the contents of new and the result of the replacement was cut off to the right. 
*4 The subsequence in sub_string was not found in dobj in the template-based search.* 
8 The data objects sub_string or new contain double-byte characters that cannot be interpreted.

This explains.

It might be '####'. is a Tab. So you might have to use the CL_ABAP_CHAR_UTILITIES class.

It can be any of these.

CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB

CL_ABAP_CHAR_UTILITIES=>VERTICAL_TAB

CL_ABAP_CHAR_UTILITIES=>NEWLINE

CL_ABAP_CHAR_UTILITIES=>CR_LF

CL_ABAP_CHAR_UTILITIES=>FORM_FEED

CL_ABAP_CHAR_UTILITIES=>BACKSPACE

A