Showing results for 
Search instead for 
Did you mean: 

Can we have error handling mechanism while updating a custom table in update task while saving SO?

0 Kudos

Hi All,

I have a requirement where I need to update a custom table while changing the sales order with latest CDHDR change number for the current performing changes in SO.

In order to achieve this , I have created an implicit enhancement at a place where CDHDR got updated with latest change number and i have called a custom function module to update my Custom table with the above latest change number in update task.


If in case , Sales order is changed and saved successfully but Custom table is not updated,

How to handle this scenario and also how to update the custom table with those missed entries ?.

Please let me know if this scenario be handled by any approach.

Active Contributor
0 Kudos

If you do everything in the update task (get the change document number + update your custom table), you don't have to handle errors, all updates are committed or rollbacked in the database, you can't have some updates done and others not done (unless you incorrectly do a database commit - that shouldn't be done).

Accepted Solutions (0)

Answers (2)

Answers (2)

Active Contributor
0 Kudos

Did you check in SM13 for error during udpate, an update module MUST raise an Abort message in case of failure to trigger rollback.

  UPDATE xxxxx FROM TABLE xxxxx.
  IF NOT sy-subrc IS INITIAL.

If you added your code in a V1 (SE37: Start immed) update module, then the error during insertion in your customer table would have rollbacked every change.

But, it seems you put your code in a change document module (CDHDR/CDPOS reference) Check if this one is a V2 (SE37: Start delayed) update module (as change document and statistics update modules are usually defined) In this case an error would not rollback updates from previously executed V1 update modules.

Hint: Look at online help for Error Handling for Bundled Updates

0 Kudos

Since SO update & custom table update are happening in same UPDATE TASK, for any reason if custom table update fails, immediately RAISE same or similar EXCEPTION the FM which is updating the SO raises,so ALL (ztable & so) or NONE will be updated. UPDATE TASK will be aborted.