04-23-2014 1:05 PM
Hello,
I have the following code snippet after performing a function:
IF sy-subrc NE 0.
WRITE: / 'bla bla'.
EXIT.
ENDIF.
The problem is that, in debug mode, I am watching the value of sy-subrc and its value IS 0 after my function is performed. However, the IF condition is behaving strangely, because it is entering the condition and executing the EXIT. What is even stranger is that the WRITE is not being executed. The debugger pointer goes directly to the EXIT.
I have tried the solutions proposed in a Helpuful Answer given by thread: 2108929
1) I have also checked for any non-active objects. But they are all active.
2) I tried to use an auxiliary variable to hold the value of sy-subrc, and then check in the IF clause for this value.
None of those worked.
Do you know what can be the cause for this issue?
Many thanks,
Luis
04-23-2014 1:12 PM
Hello Luis,
Have you started the debugger in a new session? I'm assuming that you added the EXIT command afterwards and still debugging in the earlier version. So just come out of the debugger and start from scratch. Can you check once. No offence.
Regards,
Anubhab
04-23-2014 1:21 PM
This code has been there for a long time. I started now investigating a problem in it and I came up with this. I have done no modifications on it yet. Obviously, I was quite surprised by the error and tried closing everything and re-opening afterwards to make sure I was not debugging old code. Also, I asked for a reset on the development server to make sure no other users were modifying it as well (which could bring some inconsistencies). Any other suggestions?
04-23-2014 1:42 PM
Hello Luis,
Can you provide a detailed code snippet of what is happening before this sy-subrc check. Might be the function you are telling about, before that some check is there and on successful completion sy-subrc is set to 0 and then that action is getting bypassed due to some condition or something. So, if you can provide some detailed code snippet, I can check it out further.
Regards,
Anubhab
04-23-2014 1:56 PM
Hi Luis,
is there a screen or an ALV that could be hiding the write output? Does the code process in transaction or update mode, or even other task? Is it in a enhancement or in any similar place that could be called and executed conditionally?
You mention a the sy-subrc value after function is performed, can you debug and see the write and exit instructions being processed or not?
regards,
Edgar
04-23-2014 2:20 PM
Hi Luis,
I tried your code and found that basically it goes to the last statment of the IF clause and returns back from that statement without executing it. for ex. if you write
IF sy-subrc NE 0.
EXIT.
WRITE: / 'bla bla'.
ENDIF.
It will show the cursor in Write statment and not in Exit but it wont even execute the Write statment as well. It just returns back from it.
I think you are doing this Sy-subrc check under the statement which is not setting the Sy-subrc otherwise it wont go inside that statment.
and is it the last statment of your report as well? for example if you tried the below code then it wont go inside the 1st IF statment but will go to the next statment and returns back.
IF sy-subrc NE 0.
EXIT.
WRITE: / 'bla bla'.
ENDIF.
IF sy-subrc NE 0.
EXIT.
WRITE: / 'bla bla'.
ENDIF.
04-24-2014 6:33 AM
hi,
I have faced same issue but it was resolved automatically after sometime.
Regards,
Satyen Trivedi
04-24-2014 11:07 AM
Hello,
Indeed, after a couple of restarts this issue disappeared without touching the function or the IF condition. In my opinion, the issue can be due to some background processes changing the value of sy-subrc or conflicts between users (we were in a rush in a go-live). I'm sorry that I could not provide further details on this issue. Anyways, we don't have this anymore.
Thank you all for the answers...
Best regards,
Luis
04-24-2014 12:44 PM
Hi, I suppose you had an old version of the program compiled. Maybe re-activation of the code or maybe only /$sync could help
Br
Bohuslav
04-24-2014 8:21 PM
If this has been resolved then kindly mark the discussion as answered.