โ2007 Jan 13 8:11 PM
Hi ,
if sy-subrc eq 0 means it contains values in database,
eq 4 Means It contains NO values ,
What About For 8,12 ...
Regs ,
Murthy
โ2007 Jan 13 8:18 PM
HI Murthy,
Its all depends on the statements.
Refer to this link
http://help.sap.com/saphelp_nw2004s/helpdata/en/7b/fb96c8882811d295a90000e8353423/frameset.htm
SY-SUBRC
Return value set by the following ABAP statements. In general, a content of 0 means that the statement was executed without problems.
ยท ASSIGNsets SY-SUBRC to 0 if assignment to field symbol is possible, otherwise 4.
ยท ASSIGN dref->* sets SY-SUBRC to 0 if dereferencing is possible, otherwise 4.
ยท AUTHORITY-CHECK sets SY-SUBRC to 0 if the user has the necessary authorization, otherwise 4, 8, 12, 16, 24, 28, 32, or 36 depending on the cause.
ยท CALL DIALOG with USING sets SY-SUBRC to 0, if processing was successful, otherwise <>0.
ยท CALL FUNCTION sets SY-SUBRC according to the exception handling.
ยท CALL METHOD sets SY-SUBRC according to the exception handling.
ยท CALL SELECTION-SCREEN sets SY-SUBRC to 0 if the user chose Enter or Execute and 4 if the user chose Cancel.
ยท CALL TRANSACTION with USING sets SY-SUBRC to 0 if processing was successful, otherwise <>0.
ยท CATCH SYSTEM-EXCEPTIONS sets SY-SUBRC if there are runtime errors after the ENDCATCH statement. The value is specified in the program.
ยท COMMIT WORK sets SY-SUBRC to 0.
ยท COMMIT WORK AND WAIT sets SY-SUBRC to 0 if update was successful, otherwise <>0.
ยท COMMUNICATION INIT DESTINATION RETURNCODE sets SY-SUBRC as specified.
ยท CONCATENATE sets SY-SUBRC to 0 if the result fits into target variable, otherwise 4.
ยท CREATE OBJECT sets SY-SUBRC if the exceptions of the instance constructor are handled.
ยท CREATE OBJECT in OLE2 sets SY-SUBRC to 0 if an external object was created, otherwise 1,2, 3 with different causes.
ยท DELETEsets SY-SUBRC to 0 if operation was successful, otherwise 4 or <> 0 depending on cause.
ยท DEMAND MESSAGES INTO sets SY-SUBRC to 0 if a message table is empty, otherwise <> 0.
ยท DESCRIBE LIST sets SY-SUBRC to 0 if row or list exists, otherwise 4 or 8.
ยท EXEC SQL - ENDEXEC sets SY-SUBRC to 0 in almost all cases. Only if no set was read with FETCH is SY-SUBRC 4.
ยท FETCHsets SY-SUBRC to 0 if at least one row was read, otherwise 4.
ยท GENERATE SUBROUTINE POOL sets SY-SUBRC to 0 if generation was successful, otherwise 8.
ยท GET CURSOR sets SY-SUBRC to 0 if the cursor is correctly positioned, otherwise 4.
ยท GET PARAMETER sets SY-SUBRC to 0 if value found in SAP Memory, otherwise 4.
ยท IMPORTsets SY-SUBRC to 0 if import of data objects was successful, otherwise 4.
ยท INSERTsets SY-SUBRC to 0 if operation was successful, otherwise 4.
ยท LOAD REPORT sets SY-SUBRC to 0 if operation was successful, otherwise 4 or 8 depending on cause.
ยท LOOPsets SY-SUBRC to 0 if loop over extract was passed at least once, otherwise 4.
ยท LOOP ATsets SY-SUBRC to 0 if loop over internal table was passed at least once, otherwise 4.
ยท MODIFYsets SY-SUBRC to 0 if operation was successful, otherwise 4.
ยท MODIFY LINE sets SY-SUBRC to 0 if list row was changed, otherwise <> 0.
ยท MODIFYsets SY-SUBRC to 0 if operation was successful, otherwise 4.
ยท OLE2 automation, bundled commands set SY-SUBRC to 0 if all were successfully executed, otherwise 1, 2, 3, 4 depending on cause.
ยท OPEN DATASET sets SY-SUBRC to 0 if the file was opened, otherwise 8.
ยท Open SQL commands set SY-SUBRC to 0 if operation was successful, otherwise <>0.
ยท OVERLAYsets SY-SUBRC to 0 if at least one character is overlayed, otherwise 4.
ยท READ DATASET sets SY-SUBRC to 0 if the read operation was successful, otherwise 4 or 8 depending on cause.
ยท READ LINE sets SY-SUBRC to 0 if list row exists, otherwise <> 0.
ยท READ TABLE sets SY-SUBRC to 0 if the table row was found, otherwise 2, 4, 8 depending on cause.
ยท REPLACEsets SY-SUBRC to 0 if search string could be replaced, otherwise <> 0.
ยท ROLLBACK WORK always sets SY-SUBRC to 0.
ยท SCROLLsets SY-SUBRC to 0 if scrolling in list successful, otherwise 4 or 8 depending on cause.
ยท SEARCHsets SY-SUBRC to 0 if search string was found, otherwise 4.
ยท SELECTsets SY-SUBRC to 0 if at least one row was read, otherwise 4 or even 8 with SELECT SINGLE FOR UPDATE.
ยท SET COUNTRY sets SY-SUBRC to 0 if country ID was found in table T005X, otherwise 4.
ยท SET BITsets SY-SUBRC to 0 if bit was set, otherwise <> 0.
ยท SET TITLEBAR sets SY-SUBRC to 0 if title exists, otherwise 4.
ยท SHIFT UP TO sets SY-SUBRC to 0 if position was found in character string, otherwise 4.
ยท SPLITsets SY-SUBRC to 0 if size of target fields is sufficient, otherwise 4.
ยท UPDATEsets SY-SUBRC to 0 if operation successful, otherwise 4.
ยท WRITE TO sets SY-SUBRC to 0 if assignment successful, otherwise 4.
Cheers
Manohar
โ2007 Jan 13 8:20 PM
Sy-Subrc has many meanings base on the contex it is used. See the below notes for details.
SY-SUBRC
Return value set by the following ABAP statements. In general, a content of 0 means that the statement was executed without problems.
ยท ASSIGNsets SY-SUBRC to 0 if assignment to field symbol is possible, otherwise 4.
ยท ASSIGN dref->* sets SY-SUBRC to 0 if dereferencing is possible, otherwise 4.
ยท AUTHORITY-CHECK sets SY-SUBRC to 0 if the user has the necessary authorization, otherwise 4, 8, 12, 16, 24, 28, 32, or 36 depending on the cause.
ยท CALL DIALOG with USING sets SY-SUBRC to 0, if processing was successful, otherwise <>0.
ยท CALL FUNCTION sets SY-SUBRC according to the exception handling.
ยท CALL METHOD sets SY-SUBRC according to the exception handling.
ยท CALL SELECTION-SCREEN sets SY-SUBRC to 0 if the user chose Enter or Execute and 4 if the user chose Cancel.
ยท CALL TRANSACTION with USING sets SY-SUBRC to 0 if processing was successful, otherwise <>0.
ยท CATCH SYSTEM-EXCEPTIONS sets SY-SUBRC if there are runtime errors after the ENDCATCH statement. The value is specified in the program.
ยท COMMIT WORK sets SY-SUBRC to 0.
ยท COMMIT WORK AND WAIT sets SY-SUBRC to 0 if update was successful, otherwise <>0.
ยท COMMUNICATION INIT DESTINATION RETURNCODE sets SY-SUBRC as specified.
ยท CONCATENATE sets SY-SUBRC to 0 if the result fits into target variable, otherwise 4.
ยท CREATE OBJECT sets SY-SUBRC if the exceptions of the instance constructor are handled.
ยท CREATE OBJECT in OLE2 sets SY-SUBRC to 0 if an external object was created, otherwise 1,2, 3 with different causes.
ยท DELETEsets SY-SUBRC to 0 if operation was successful, otherwise 4 or <> 0 depending on cause.
ยท DEMAND MESSAGES INTO sets SY-SUBRC to 0 if a message table is empty, otherwise <> 0.
ยท DESCRIBE LIST sets SY-SUBRC to 0 if row or list exists, otherwise 4 or 8.
ยท EXEC SQL - ENDEXEC sets SY-SUBRC to 0 in almost all cases. Only if no set was read with FETCH is SY-SUBRC 4.
ยท FETCHsets SY-SUBRC to 0 if at least one row was read, otherwise 4.
ยท GENERATE SUBROUTINE POOL sets SY-SUBRC to 0 if generation was successful, otherwise 8.
ยท GET CURSOR sets SY-SUBRC to 0 if the cursor is correctly positioned, otherwise 4.
ยท GET PARAMETER sets SY-SUBRC to 0 if value found in SAP Memory, otherwise 4.
ยท IMPORTsets SY-SUBRC to 0 if import of data objects was successful, otherwise 4.
ยท INSERTsets SY-SUBRC to 0 if operation was successful, otherwise 4.
ยท LOAD REPORT sets SY-SUBRC to 0 if operation was successful, otherwise 4 or 8 depending on cause.
ยท LOOPsets SY-SUBRC to 0 if loop over extract was passed at least once, otherwise 4.
ยท LOOP ATsets SY-SUBRC to 0 if loop over internal table was passed at least once, otherwise 4.
ยท MODIFYsets SY-SUBRC to 0 if operation was successful, otherwise 4.
ยท MODIFY LINE sets SY-SUBRC to 0 if list row was changed, otherwise <> 0.
ยท MODIFYsets SY-SUBRC to 0 if operation was successful, otherwise 4.
ยท OLE2 automation, bundled commands set SY-SUBRC to 0 if all were successfully executed, otherwise 1, 2, 3, 4 depending on cause.
ยท OPEN DATASET sets SY-SUBRC to 0 if the file was opened, otherwise 8.
ยท Open SQL commands set SY-SUBRC to 0 if operation was successful, otherwise <>0.
ยท OVERLAYsets SY-SUBRC to 0 if at least one character is overlayed, otherwise 4.
ยท READ DATASET sets SY-SUBRC to 0 if the read operation was successful, otherwise 4 or 8 depending on cause.
ยท READ LINE sets SY-SUBRC to 0 if list row exists, otherwise <> 0.
ยท READ TABLE sets SY-SUBRC to 0 if the table row was found, otherwise 2, 4, 8 depending on cause.
ยท REPLACEsets SY-SUBRC to 0 if search string could be replaced, otherwise <> 0.
ยท ROLLBACK WORK always sets SY-SUBRC to 0.
ยท SCROLLsets SY-SUBRC to 0 if scrolling in list successful, otherwise 4 or 8 depending on cause.
ยท SEARCHsets SY-SUBRC to 0 if search string was found, otherwise 4.
ยท SELECTsets SY-SUBRC to 0 if at least one row was read, otherwise 4 or even 8 with SELECT SINGLE FOR UPDATE.
ยท SET COUNTRY sets SY-SUBRC to 0 if country ID was found in table T005X, otherwise 4.
ยท SET BITsets SY-SUBRC to 0 if bit was set, otherwise <> 0.
ยท SET TITLEBAR sets SY-SUBRC to 0 if title exists, otherwise 4.
ยท SHIFT UP TO sets SY-SUBRC to 0 if position was found in character string, otherwise 4.
ยท SPLITsets SY-SUBRC to 0 if size of target fields is sufficient, otherwise 4.
ยท UPDATEsets SY-SUBRC to 0 if operation successful, otherwise 4.
ยท WRITE TO sets SY-SUBRC to 0 if assignment successful, otherwise 4.
- Guru
Reward points for helpful answers
โ2007 Jan 14 2:56 AM
โ2007 Jan 14 5:42 AM
SY-SUBRC = 8:
No entry was read.
This return code only occurs with a SORTED TABLE or a STANDARD TABLE with the BINARY SEARCH addition. SY-TABIX is set to the number of all entries plus 1.