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/Where to Interrogate Database Return Codes

Former Member
0 Likes
610

Hi,

I am using a SQL INSERT statement to add records to a "Z" table in SAP.

Other than SY_SUBRC, what can I look at to determine the status of the INSERT?

For example, if I write a record that fails due to a duplicate key, other than SY_SUBRC, what can I look at to tell me the exact cause of the failure?

Thanks for your help,

Andy

1 ACCEPTED SOLUTION
Read only

Tomas_Buryanek
Product and Topic Expert
Product and Topic Expert
0 Likes
574

If you mean "Native SQL" with EXEC SQL. ... ENDEXEC. ,then you can (should) catch catchable exceptions from CX_SY_NATIVE_SQL_ERROR From there you will get exact error texts of what happened.

-- Tomas --
3 REPLIES 3
Read only

Former Member
0 Likes
574

Hi Andrew,

You can check SY-DBCNT which should give you how many records are updated/inserted.

Regards,

R

Read only

Tomas_Buryanek
Product and Topic Expert
Product and Topic Expert
0 Likes
575

If you mean "Native SQL" with EXEC SQL. ... ENDEXEC. ,then you can (should) catch catchable exceptions from CX_SY_NATIVE_SQL_ERROR From there you will get exact error texts of what happened.

-- Tomas --
Read only

0 Likes
574

Thank you Tomas and Rurda.

This is exactly what I was looking for!

Appreciate it.

Andy