Application Development 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: 

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

Former Member
0 Kudos

hi

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

7 REPLIES 7

amit_khare
Active Contributor
0 Kudos

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

abdulazeez12
Active Contributor
0 Kudos

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,

Former Member
0 Kudos

if it is select ,read or any function ,modules

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

Please reward if useful.

Former Member
0 Kudos

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...

Former Member
0 Kudos

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.........

Former Member
0 Kudos

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.

hymavathi_oruganti
Active Contributor
0 Kudos

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.