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
802

Hi All,

I have three select statement at botom of third I am writitng

sy-subrc

will this validat only last select statement or all select statement

regards

shashiknat

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
767

only the last one that was executed

only the last one that was executed

4 REPLIES 4
Read only

Former Member
0 Likes
767

just last

Read only

Former Member
0 Likes
768

only the last one that was executed

Read only

Former Member
0 Likes
767

hi,

only the last select statement will be validated.

if u want to validate all three then check sy-subrc after each select statement.

if you want to execute ur code based on success of all three select queries, you can nest between if and end if

query 1

if sy-subrc = 0

query 2

if sy-subrc = 0

query 3.

if sy-subrc = 0

rest of the code

endif.

endif.

endif.

or

much cleaner way is to set a flag (lets call it l_flag) after each select query if sy-subrc is ne 0.

query 1

if sy-subrc ne 0.

l_flag = 'X'.

endif.

query 2

if sy-subrc ne 0.

l_flag = 'X'.

endif.

query 2

if sy-subrc ne 0.

l_flag = 'X'.

endif.

if l_flag NE 'X'.

proceed further.

endif.

now at the end of all three select statements you can check of the flag. n if it is blank means all three select statements were executed succesffuly.

Read only

Former Member
0 Likes
767

Hi,

Only the last one.

the sy-subrc will be filled according to the execution of jus before the statement.

Regards

Sandeep Reddy.