2007 Dec 31 1:48 PM
CAN ANY ONE PLEASE TELL WHAT ARE THE SY-SUBRC VALUES IN DIFFERENT SCENARIOS
2007 Dec 31 1:58 PM
Hi,
just go through the below document.
SY-SUBRC
Return value set by the following ABAP statements. In general, a content of 0 means that the statement was executed without problems.
ASSIGN sets 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.
DELETE sets SY-SUBRC to 0 if the 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.
FETCH sets 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.
IMPORT sets SY-SUBRC to 0 if import of data objects was successful, otherwise 4.
IMPORT sets SY-SUBRC to 0 if import of data objects was successful, otherwise 4.
LOAD REPORT sets SY-SUBRC to 0 if the operation was successful, otherwise 4 or 8 depending on cause.
LOOP sets SY-SUBRC to 0 if loop over extract was passed at least once, otherwise 4.
LOOP AT sets SY-SUBRC to 0 if loop over internal table was passed at least once, otherwise 4.
MODIFY sets SY-SUBRC to 0 if operation was successful, otherwise 4.
MODIFY LINE sets SY-SUBRC to 0 if list row was changed, otherwise <> 0.
MODIFY sets 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.
OVERLAY sets 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.
REPLACE sets SY-SUBRC to 0 if search string could be replaced, otherwise <> 0.
ROLLBACK WORK always sets SY-SUBRC to 0.
SCROLL sets SY-SUBRC to 0 if scrolling in list successful, otherwise 4 or 8 depending on cause.
SEARCH sets SY-SUBRC to 0 if search string was found, otherwise 4.
SELECT sets 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 BIT sets 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.
SPLIT sets SY-SUBRC to 0 if size of target fields is sufficient, otherwise 4.
UPDATE sets SY-SUBRC to 0 if operation successful, otherwise 4.
WRITE TO sets SY-SUBRC to 0 if assignment successful, otherwise 4.
If you still have doubts go through this link.
this link has all document for the system fields.
http://help.sap.com/saphelp_47x200/helpdata/EN/7b/fb96c8882811d295a90000e8353423/frameset.htm
Hi,
just go through the below document.
SY-SUBRC
Return value set by the following ABAP statements. In general, a content of 0 means that the statement was executed without problems.
ASSIGN sets 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.
DELETE sets SY-SUBRC to 0 if the 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.
FETCH sets 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.
IMPORT sets SY-SUBRC to 0 if import of data objects was successful, otherwise 4.
IMPORT sets SY-SUBRC to 0 if import of data objects was successful, otherwise 4.
LOAD REPORT sets SY-SUBRC to 0 if the operation was successful, otherwise 4 or 8 depending on cause.
LOOP sets SY-SUBRC to 0 if loop over extract was passed at least once, otherwise 4.
LOOP AT sets SY-SUBRC to 0 if loop over internal table was passed at least once, otherwise 4.
MODIFY sets SY-SUBRC to 0 if operation was successful, otherwise 4.
MODIFY LINE sets SY-SUBRC to 0 if list row was changed, otherwise <> 0.
MODIFY sets 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.
OVERLAY sets 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.
REPLACE sets SY-SUBRC to 0 if search string could be replaced, otherwise <> 0.
ROLLBACK WORK always sets SY-SUBRC to 0.
SCROLL sets SY-SUBRC to 0 if scrolling in list successful, otherwise 4 or 8 depending on cause.
SEARCH sets SY-SUBRC to 0 if search string was found, otherwise 4.
SELECT sets 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 BIT sets 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.
SPLIT sets SY-SUBRC to 0 if size of target fields is sufficient, otherwise 4.
UPDATE sets SY-SUBRC to 0 if operation successful, otherwise 4.
WRITE TO sets SY-SUBRC to 0 if assignment successful, otherwise 4.
If you still have doubts go through this link.
this link has all document for the system fields.
http://help.sap.com/saphelp_47x200/helpdata/EN/7b/fb96c8882811d295a90000e8353423/frameset.htm
2007 Dec 31 1:58 PM
Hi,
just go through the below document.
SY-SUBRC
Return value set by the following ABAP statements. In general, a content of 0 means that the statement was executed without problems.
ASSIGN sets 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.
DELETE sets SY-SUBRC to 0 if the 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.
FETCH sets 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.
IMPORT sets SY-SUBRC to 0 if import of data objects was successful, otherwise 4.
IMPORT sets SY-SUBRC to 0 if import of data objects was successful, otherwise 4.
LOAD REPORT sets SY-SUBRC to 0 if the operation was successful, otherwise 4 or 8 depending on cause.
LOOP sets SY-SUBRC to 0 if loop over extract was passed at least once, otherwise 4.
LOOP AT sets SY-SUBRC to 0 if loop over internal table was passed at least once, otherwise 4.
MODIFY sets SY-SUBRC to 0 if operation was successful, otherwise 4.
MODIFY LINE sets SY-SUBRC to 0 if list row was changed, otherwise <> 0.
MODIFY sets 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.
OVERLAY sets 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.
REPLACE sets SY-SUBRC to 0 if search string could be replaced, otherwise <> 0.
ROLLBACK WORK always sets SY-SUBRC to 0.
SCROLL sets SY-SUBRC to 0 if scrolling in list successful, otherwise 4 or 8 depending on cause.
SEARCH sets SY-SUBRC to 0 if search string was found, otherwise 4.
SELECT sets 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 BIT sets 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.
SPLIT sets SY-SUBRC to 0 if size of target fields is sufficient, otherwise 4.
UPDATE sets SY-SUBRC to 0 if operation successful, otherwise 4.
WRITE TO sets SY-SUBRC to 0 if assignment successful, otherwise 4.
If you still have doubts go through this link.
this link has all document for the system fields.
http://help.sap.com/saphelp_47x200/helpdata/EN/7b/fb96c8882811d295a90000e8353423/frameset.htm
2007 Dec 31 2:22 PM
hi
good
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.
thanks
mrutyun^
2008 Jan 01 11:11 AM
SY-SUBRC TO CHECK STATEMENT IS CORRECT OR NOT
SY-SUBRC = 0 CORRECT STATEMENT
SY-SUBRC = 4 NOT CORRECT
SY-SUBRC = 8 ERROR
2008 Jan 01 1:59 PM
Hi niranjan,
is this an academic or an test question?
Many commands, function modules and class methods will set a value different from 0 to SY-SUBRC if anything out of the ordinary happened.
Put your cursor at any ABAP command and press F1. If this command can set SY-SUBRC, the possible values are explained in detail.
Generally SY-SUBRC = 0 means everything fine, 4 something went wrong and 8 all wrong.
For functions modules and class methods, the caller will assign SY-SUBRC calues to exceptions raised.
Regards,
Clemens
2008 Jan 02 4:22 AM
Hi,
Most of ABAP commands and class methods will set a value
Sy-subrc to 0 if successful.
Sy-subrc to 4 if Failure.
In case of datasets :-
Sy-subrc to 0 if successful.
Sy-subrc to 8 if Failure.
In case of Functionmodules :-
The sy-subrc can vary from 0 to 20.
Ie
Sy-subrc to 0 if successful.
And gets different sy-subrc values (from 1 to 20) for exceptions.
By depends on exception values u can do different messaging in program.
And at function module code u need to raise the exceptions by raise <nameofexception>
2008 Jan 02 4:30 AM
Hi Niranjan
One important thing is that when SY-SUBRC = 0, then the previous statement is successful, when it is not 0, then the previous statement was not successful.
For examples:
sy-subrc = 0
-
Success
sy-subrc = 4
-
Failure(known reason)
sy-subrc = 8
-
Internal error(Unknown reason).
sy-subrc = 1001
-
Failure error in BDC
Hope this resolves your query.
Please Reward pts if help.
Regards
Deepanker
2008 Jan 04 2:43 PM
Hi niranjan,
is this an academic or an test question?
Many commands, function modules and class methods will set a value different from 0 to SY-SUBRC if anything out of the ordinary happened.
Put your cursor at any ABAP command and press F1. If this command can set SY-SUBRC, the possible values are explained in detail.
Generally SY-SUBRC = 0 means everything fine, 4 something went wrong and 8 all wrong.
For functions modules and class methods, the caller will assign SY-SUBRC calues to exceptions raised.
Regards,
Clemens
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |