Generally, when the SY-SUBRC equals to ‘0’ means that the ABAP statement has been executed successfully. If the value is other than ‘0’ means that the statement has raised an error or warning.
‘SUBRC’ can be found in the structure ‘SYST’.
Please find below some main examples of the of the return value of the statement ‘SY-SUBRC’:
- Statement ‘SELECT’ sets SY-SUBRC to 0 if at least one line was retrievedelse SY-SUBRC sets to 4/8.
- For function module the statement ‘CALL FUNCTION’ sets SY-SUBRC based on the exceptions declared in the FM. Same applies for ‘CALL METHOD’.
- Statement ‘AUTHORITY-CHECK’ sets SY-SUBRC to 0 if the user has the required authorization else SY-SUBRC sets to 4, 8, 12, 16, 24, 28, 32, or 36 depending on the cause of the authorization failure.
- Statement ‘OPEN DATASET’ sets SY-SUBRC to 0 if the file could be opened, else SY-SUBRC sets to 8.
- Statement ‘LOOP’ sets SY-SUBRC to 0 if there has been at least one pass through the loop else SY-SUBRC sets to a value other than 0.
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP S/4 HANA Logistics Consultant
Contact : serkurumsal@yandex.com
Social Plugin