2007 Oct 03 7:00 AM
hi..in a pgm if i hav sy-subrc.....if it is success ten the value of sy-subrc becomes 0 else it contains values like 2,4,8....wat does each of these value signify??
this is in the case of internal tables.....i want to knw in general
2007 Oct 03 7:02 AM
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.
2007 Oct 03 7:06 AM
i want to knw y it is 4 or 8 ....on wat basis it is 4 and on wat basis it is 8
2007 Oct 03 7:03 AM
The INSERT statement sets the values of the system fields sy-subrc and sy-dbcnt.
sy-subrc Meaning
0 At least one row was inserted.
4 At least one row could not be inserted, because the database table already contains a row with the same primary key or a unique secondary index.
The INSERT statement sets sy-dbcnt to the number of rows inserted.
Note
The inserted rows are finally included in the table in the next database commit. Up until this point, they can still be removed by a database rollback.
The statement INSERT sets a database lock until the next database commit or rollback. If used incorrectly, this can lead to a deadlock.
The number of rows that can be inserted in the tables of a database within a database LUW is limited, since a database system can only manage a limited amount of locks and data in the rollback area.
2007 Oct 03 7:03 AM
Hi Reshma,
For each ABAP Statement, their need not be all values of sy-subrc. Each statements has its own criteria to define sy-subrc values. Value 0 is alwyz success.
Eg.
System Fields
The statement READ TABLE sets system fields sy-subrc and sy-tabix.
<b>sy-subrc Relevance</b>
<b>0</b> Row found. sy-tabix is set to the table index of the entry for index tables, and to the value 0 for hashed-tables.
<b>2</b> Like sy-subrc equals 0. Differentiates cases that use the addition COMPARING in result.
<b>4</b> Row not found. If the entry was determined with a binary search, then sy-tabix is set to the table index of the entry before which it would have to be inserted with INSERT ... INDEX ..., if you want to keep the sorting order. This is the case if the addition table_key or free_key was specified for a beginning part of the table key of sorted tables, or if the addition BINARY SEARCH was specified explicitly. Otherwise, sy-tabix is undefined.
<b>8</b> Like sy-subrc equals 4. If the entry was determined with a binary search, and the end of the table was reached, then sy-tabix is set to the number of rows + 1.
2007 Oct 03 7:04 AM
The MODIFY statement sets the values of the sy-subrc and sy-dbcnt system fields.
sy-subrc Meaning
0 All lines were inserted or changed.
4 At least one line could not be processed as there is already a line with the same unique name secondary index in the database table.
The MODIFY statement sets sy-dbcnt to the number of processed lines.
Note
The changes are finally transferred to the database table with the next database commit. Up to that point, they can be reversed with a database rollback.
The MODIFY statement sets a database lock until the next database commit or database rollback; incorrect usage can result in a deadlock kommen kann.
The number of rows that can be inserted into or changed in the tables of a database within a database LUW is restricted database-specifically by the fact that a database system can only manage a limited amount of locks and data in the rollback area.
2007 Oct 03 7:05 AM
Each and every ABAP statements have some significance in respect to sy-subrc
the below is the sy-subrc explanation for a select query
SY-SUBRC = 0 means The result table contains at least one record.
SY-SUBRC = 4 means The result table is empty.
SY-SUBRC = 8 This applies to SELECT SINGLE which means you have not specified all the primary key fields in the WHERE condition. This results in empty internal table
Regards
Gopi
2007 Oct 03 7:09 AM
this is in the case of internal tables.....i want to knw in general
2007 Oct 03 7:11 AM
you can refer to my first reply....I have given all the statements with related error values...
2007 Oct 03 7:15 AM
if the error value is 8 ...wat does it signify??....on wat basis it is having the error value as 8...i want to knw in general scenario ...not in the case of internal tables
2007 Oct 03 7:32 AM
See the value of subrc and the scenarios on which it gets is different for each ABAP command..
So while chekin subrc jus go to the help F1 of dat cmd and see wat cud b the possible values of subrc
2007 Oct 03 7:07 AM
hi
this one is system field u can find all these in syst structure
if record found it is eq 0
else
eq 4
if the file doesnt exists
field value eq 8
regards
Nagesh.Paruchuri
2007 Oct 03 7:08 AM
hi
good
SY-SUBRC could be anything and mean anything. When you define exceptions in a function module, you then assign numeric values to then when you call the funciton module. For example, the funciton module GUI_DOWNLOAD.
call function 'GUI_DOWNLOAD'
exporting
BIN_FILESIZE =
filename =
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
tables
data_tab =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
You can see that there are 22 exceptions, if any of these exceptions are raised, the corresponpding numeric values is set to SY-SUBRC .
You then check for this value, and do the appropriate messageing, but hopefully you can see how SY-SUBRC could be any numeric value and the meaning could be anything.
Generally, for most ABAP statements, the SY-SUBRC value is usually set to 4 or 8, 0 if successful. 8 for specific errors, like no authroizations.
reward point if helpful.
thanks
mrutyun^
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |