1. When the perform statement (which contains the CALL TRANSACTION statement) was executed directly by pressing F6,
Sy-Subrc returned was 0.
2. When the perform statement was executed step by step by pressing F5 and after reaching the ‘CALL_TRANSACTION’ statement,
(a) When F5 key was used to execute that statement (CALL TRANSACTION), Sy-Subrc returned was 1001.
(b) When F6 key was used to execute that statement (CALL TRANSACTION), Sy-Subrc returned was 0.
Read more on SAP ABAP Tutorials
3. The main reason for the changing Sy-Subrc is…based on the Key
(F5 or F6), the OK_CODE will be set (which can be viewed in
System Debugging mode). The Sy-Subrc value depends on the OK_CODE value. So it is getting changed.
Suggestions given for the solution:
Suggestion 1: We can change the Mode from ‘N’ to ‘P’ in the program.
(Here ‘N’ indicates No display and ‘P’ indicates No display; but debugging possible).But the problem is, the mode is defined as a Constant in an include program. We can’t do the changes in Include program, as the include program is being used by several other programs also. So this option will not be useful.
Suggestion 2: As the Sy-Subrc value ‘1001’ doesn’t stand for any Error execution…i.e., It is same as that of ‘0’, we can modify the code in the program like…
IF CALL_TRAN_RETURNCODE = 0 or
CALL_TRAN_RETURNCODE = ‘1001’.
MESSAGE I000 WITH 'Number Range Object ZS11_SEQ Reset to 0'.
MESSAGE I000 WITH 'Cannot Reset Number Range Object
'Please Notify On-Call Support'.
MESSAGE E000 WITH BDC_MESSAGE.