Application Development 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: 

change sy-subrc value

Former Member
0 Kudos

Hello there,

in the program that I am working on, I would like to read things from an itab and do something if such record exisits and do something else if it does not. However, after each time it gets processed, I am hoping that sy-subrc will be resetted to 0 so that I can continue to work on some further data processing without getting an error. May I know that would sy-subrc gets resetted to 0 once I am out of the Read Table statement? If not, how can I reset it?

Thanks a lot!

Regards,

Anyi

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate

SY-SUBRC will be set to 0 if there is a hit for your READ statement, it will be set to 4 if it does not find a hit with the READ statement.

You can set SY-SUBRC = 0 at any point in your program.

Regards,

Rich Heilman

2 REPLIES 2

RichHeilman
Developer Advocate
Developer Advocate

SY-SUBRC will be set to 0 if there is a hit for your READ statement, it will be set to 4 if it does not find a hit with the READ statement.

You can set SY-SUBRC = 0 at any point in your program.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi

After Every successful execution of a statement in ABAP, sy-subrc will have a value based on the execution. (i.e 0 for Succes, 4 -Failure etc)

If read statement is successful, sy-subrc will be ZERO, else it will be 4.

In debugging, you can change sy-subrc value.

Regards,

Raj