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,310

Why We need to use SY-SUBRC check after SELECT Statement?If we do'nt use whether it will give dump?

Thanks

Umesh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,197
Why We need to use SY-SUBRC check after SELECT Statement?

Below is what i got from F1 help.

The SELECT statement sets the values of the system fields sy-subrc and sy-dbcnt.

sy-subrc Relevance

0 The SELECT statement sets sy-subrc to 0 for every pass by value to an ABAP data object. The ENDSELECT statement sets sy-subrc to 0 if at least one row was transferred in the SELECT loop.

4 The SELECT statement sets sy-subrc to 4 if the result set is empty, that is, if no data was found in the database.

8 The SELECT statement sets sy-subrc to 8 if the FOR UPDATE addition is used in result, without the primary key being specified fully after WHERE.

After every value that is transferred to an ABAP data object, the SELECT statement sets sy-dbcnt to the number of rows that were transferred. If the result set is empty, sy-dbcnt is set to 0.

If we do'nt use whether it will give dump?

No.But good practice if your use.

Amit.

Why We need to use SY-SUBRC check after SELECT Statement?

Below is what i got from F1 help.

The SELECT statement sets the values of the system fields sy-subrc and sy-dbcnt.

sy-subrc Relevance

0 The SELECT statement sets sy-subrc to 0 for every pass by value to an ABAP data object. The ENDSELECT statement sets sy-subrc to 0 if at least one row was transferred in the SELECT loop.

4 The SELECT statement sets sy-subrc to 4 if the result set is empty, that is, if no data was found in the database.

8 The SELECT statement sets sy-subrc to 8 if the FOR UPDATE addition is used in result, without the primary key being specified fully after WHERE.

After every value that is transferred to an ABAP data object, the SELECT statement sets sy-dbcnt to the number of rows that were transferred. If the result set is empty, sy-dbcnt is set to 0.

If we do'nt use whether it will give dump?

No.But good practice if your use.

Amit.

4 REPLIES 4
Read only

bpawanchand
Active Contributor
0 Likes
1,197

Hi

Well SY-SUBRC is a system field when ever any operation successfully completes then its value is 0 and if fails then its value will be not equal to zero.So to know wheteher the SELECt operation is succesful or not we are validating teh SY-SUBRC eq 0 or not that'sa ll.

Regards

pavan

Read only

0 Likes
1,197

hi,

its not goin to give any dump.

but if u want to execute other statements after u r select statement u can give sy-subrc condition

regards

prasad

Read only

Former Member
0 Likes
1,198
Why We need to use SY-SUBRC check after SELECT Statement?

Below is what i got from F1 help.

The SELECT statement sets the values of the system fields sy-subrc and sy-dbcnt.

sy-subrc Relevance

0 The SELECT statement sets sy-subrc to 0 for every pass by value to an ABAP data object. The ENDSELECT statement sets sy-subrc to 0 if at least one row was transferred in the SELECT loop.

4 The SELECT statement sets sy-subrc to 4 if the result set is empty, that is, if no data was found in the database.

8 The SELECT statement sets sy-subrc to 8 if the FOR UPDATE addition is used in result, without the primary key being specified fully after WHERE.

After every value that is transferred to an ABAP data object, the SELECT statement sets sy-dbcnt to the number of rows that were transferred. If the result set is empty, sy-dbcnt is set to 0.

If we do'nt use whether it will give dump?

No.But good practice if your use.

Amit.

Read only

Former Member
0 Likes
1,197

Good question

instead of asking this question just execute and see the result wether it give dump or not.

Either u are very new to ABAP and do not bother to study or u are asking such qustion just for the sake of points