Skip to Content
0
Former Member
Sep 20, 2011 at 01:49 PM

String Operation not working Correctly

70 Views

I have one code where I have to Seprate a string in lines based on Pattern '#'.

EG: first line##second line##third line.

output should be :

first line

second line

third line

do.

SEARCH content for '#'.

  • find hash in content.

if sy-subrc = 4.

gfs_content-content = content.

APPEND gfs_content TO git_content.

clear gfs_content.

exit.

else.

gfs_content-content = content+0(sy-fdpos).

APPEND gfs_content TO git_content.

clear gfs_content.

loc_count = sy-fdpos + 2.

SHIFT content BY loc_count PLACES.

endif.

enddo.

when I am changing the content value in Debugger, this code is working fine. but when I am executing it directly without any change in value in debugger, Sy-subrc = 4 after SEARCH operation. Its not finding the "#" position.

What could be the possible reason.