Skip to Content
0
May 10, 2010 at 07:02 AM

How to Catch an Exception occuring in exec a Procedure in an Interface Prog

460 Views

Hi members ,

I am trying to catch an exception while executing a procedure . Below given Is the code ....

TRY.

EXEC SQL.

EXECUTE PROCEDURE OBJECT.PROCEDURENAME .

ENDEXEC.

IF SY-SUBRC not 0.

RAISE EXCEPTION TYPE CX_SY_NATIVE_SQL_ERROR.

ENDIF.

CATCH CX_SY_NATIVE_SQL_ERROR INTO IERR.

MESSAGE IERR TYPE 'I' .

ENDTRY.

Is it the better option for catching any of the exceptions occuring while proc's execution . Friends , If Possible can i have some examples in code . -


The Business scenario is that after creating an entry in the Order mgmt System (SAPOMS) in SAP the order has to flow to the Legacy system . This job of flowing the data to legacy system is done by procedure which is being called in the native SQL stmt in my code above .----


The problem is , that while executing this procedure due to some reason the procedure is failing to execute and due to which the orders aren't flowing completely . Now ,here to know the reason<exceptions> behind it for which the orders are failing i have to catch the exception because of which the orders are failing to flow in the legacy system.

The Second problem is after the procedure fails it is putting a lock on the resource and on the next schedule<Background Job> arranged for the orders to flow to legacy the program is failing due to previous status of program is still in fail and theres a lock on it .----


Friends , need some help for both the problems . For the second one i guess Databse developers need to work as on why its locking the resource . But still wanted to know if it's really the database or if its SAP putting a lock on the resource Tried to track it through ST22 for current runtime errors but still unable to find any solution for it .

-


Thanks in Advance to all of the members . -


Thanks & Regards ,

Edited by: Rob Burbank on May 10, 2010 4:52 PM