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

how do u find the return code of a statement in abap programs

Former Member
0 Likes
1,647

hi

how do u find the return code of a statement in abap programs

hi

how do u find the return code of a statement in abap programs

7 REPLIES 7
Read only

amit_khare
Active Contributor
0 Likes
1,232

You can always check for SY-SUBRC for that statement.

Read only

abdulazeez12
Active Contributor
0 Likes
1,232

Check SY-SUBRC after executing every statement in ur ABAP code. IF SY-SUBRC is equal to ZERO, then the stmt is successful in execution,

Read only

Former Member
0 Likes
1,232

if it is select ,read or any function ,modules

You can use System variable of SYST structure SY-SUBRC .

Please reward if useful.

Read only

Former Member
0 Likes
1,232

Hi you can use sy-subrc statement for check.

if sy-subrc = 0.

then the statement is successfulll.

if it is other than zero then not success...

Read only

Former Member
0 Likes
1,232

after u r abap statement

write: sy-subrc.............

system field sy-subrc gives the return code of a statement

if sy-subrc = 0...u r statement is success ful

if sy-subrc = 4 ...u r statement is not success ful

reward points if helpful.........

Read only

Former Member
0 Likes
1,232

Hi ,

Use SY-SUBRC.If sy-subrc =0 ,it means stmt returns some value ;else it does not .See code below to understand it better .

Reward if useful.

report ztx0902.

tables ztxt005t.

parameters `land1 like ztxlfa1-land1 obligatory default 'US'.

select single * from ztxt005t

where spras = ? "current logon language

and land1 = `land1.

if sy-subrc = 0.

write: 'Description:', ztxt005t-landx.

else.

write: 'No description exists for', `land1.

endif.

Read only

hymavathi_oruganti
Active Contributor
0 Likes
1,232

sy-subrc = 0 is success and sy-subrc <> 0 is unsuccessfull.

u can place sy-subrc after any executable statement in bap and test whether the statement is executed successfully or not.