Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SY-SUBRC

Former Member
0 Likes
1,604

Hello Everybody,

I want a small favour from u all. can u please help me to know "what sy-subrc = 8" mean? I would be thankful to u all in advance for ur support and help.

Regards,

Farhee.

Hello Everybody,

I want a small favour from u all. can u please help me to know "what sy-subrc = 8" mean? I would be thankful to u all in advance for ur support and help.

Regards,

Farhee.

11 REPLIES 11
Read only

Former Member
0 Likes
1,424

Soni,

Based on the context (previous statement) SY-SUBRC non-zero value will be set. For every statement that is successful, its set with 0.

Regards,

Sujatha.

Read only

Former Member
0 Likes
1,424

It depends on the ABAP statement that you are using

Just go for F1 help on that field and you can get that

Say for example for SELECT statement , these are the SY-SUBRC values

SY-SUBRC = 0: The result table contains at least one record.

SY-SUBRC = 4: The result table is empty.

SY-SUBRC = 8: Applies only to SELECT SINGLE FOR UPDATE: You

did not specify all of the primary key fields

in the WHERE condition. The result table is

empty.

Message was edited by:

Chandrasekhar Jagarlamudi

Read only

Former Member
0 Likes
1,424

It depends on what statement set it to that?

If you are getting that value, look at the statement that "set it" to a value of 8. Set your mouse cursor on that ABAP command and press F1. That will launch you into the on-line help for that command.

You will likely find a table of error values/reasons there.

Read only

Former Member
0 Likes
1,424

It depends upon where you are checking this value.

If you are checking this after select statement the SY-SUBRC = 8 means The search key was not fully qualified.

I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers

Read only

Former Member
0 Likes
1,424

Hi..

these are few statements..that can set sy-subrc to 8..

go through help...

DESCRIBE LIST sets SY-SUBRC to 0 if row or list exists, otherwise 4 or 8.

LOAD REPORT sets SY-SUBRC to 0 if the operation was successful, otherwise 4 or 8 depending on cause.

GENERATE SUBROUTINE POOL sets SY-SUBRC to 0 if generation was successful, otherwise 8

Read only

Former Member
0 Likes
1,424

hi,

Sy-subrc can hold many values 0,4,8 etc.

For every keyword, its meaning differs.

If it is the case of Read with binary search, we get sy-subrc as 8 when there are no intries in internal table.

ex: read table itab with key vbeln = '123' binary search.

sy-subrc eq 0 <- record found in itab with vbeln 123

sy-subrc eq 4 <- record not found in itab and Itab is having some records

<b> sy-subrc eq 8 <- record not found in itab and Itab is not having any records</b>

Regards,

Sailaja.

Read only

Former Member
0 Likes
1,424

Hi,

Please check this ... it usually means.

sy-subrc = 4 -


Failure(known reason)

sy-subrc = 8 -


Internal error(Unknown reason).

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
1,424

Hi shweta,

SY-SUBRC

Return value set by the following ABAP statements. In general, a content of 0 means that the statement was executed without problems.

Mainly sy-subrc set the value

0-->for success ful statements

4-->for unsuccess ful statements

8-->Depending on the cause

and check does not set sy-subrc.

For exceptions sy-subrc returns the exception number,In this context 8 is the exception number

The following are the different values of sy-subrc for different statements.

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.

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.

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.

Reward if helpful.

Regards,

Sandhya

Read only

Former Member
0 Likes
1,424

hi

good

if your select statement wont return any value you may get the Sy-subrc value as 4 or 8,

Thanks

mrutyun^

Read only

Former Member
0 Likes
1,424

Soni,

I think you can see that we all agree on your next setps.

Please reward points accordingly and close the thread.

Thanks!!

Read only

Former Member
0 Likes
1,424

Hi,

Go the following link, your doubt will clear

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/select.htm

Regards,

Bhaskar