cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete delivery without hitting USEREXIT_SAVE_DOCUMENT

ChadRichardson
Participant
0 Kudos

Good day, Gurus

We have coding in the user exit USEREXIT_SAVE_DOCUMENT within include MV50AFZ1 to process delivery changes through a proxy to an external system. Some how deliveries are being deleted without hitting this UE. All traces of the delivery including change logs are removed without hitting the UE. Normally we could use VL22 to determine who deleted the delivery and when but all this transaction gives us is "No log of changes".

Any ideas how all traces of a delivery are removed without hitting this UE???

Thanks,

Chad

Accepted Solutions (1)

Accepted Solutions (1)

Jelena
Active Contributor
0 Kudos

This is normal behavior. If you need to do something before the delivery is deleted, there is a different user exit for that - USEREXIT_DELETE_DOCUMENT.

After the delivery has been deleted, there is also an entry in CDHDR / CDPOS table. Usually this is the only way to find if delivery has ever existed.

Answers (2)

Answers (2)

Jelena
Active Contributor
0 Kudos

OK. So, from what I see now, the delivery just was, in fact, never created due to the update termination. I would guess that your updates were done because they were not programmed correctly, specifically the LUW concept was not followed. I'd recommend your ABAPers to take a look at the SAP Press book "Enhancing the quality of ABAP development", wher on page 138 it is very clearly explains how to program the updates in the user exits and what will happen if the proper technique is not used.

Cheers.

ChadRichardson
Participant
0 Kudos

We are chalking this up to to the delivery not being saved completely. We have code in USEREXIT_SAVE_DOCUMENT that fired and completed so we thought the delivery did in fact exist, BUT we believe that the final "commit" did not happen and the changes were rolled back which in affect erased the delivery from existence.

Jelena
Active Contributor
0 Kudos

If, as you're saying, "commit" did not happen, you should see an entry in SM13 and the changes in the delivery simply would not have been saved. I seriously doubt that a delivery could be simply erased that way...

My understanding is that USEREXIT_SAVE_DOCUMENT is called when the user saves the document by clicking the Save or PGI button, for example. If you need to update a Z table in that user exit, I'd definitely recommend doing the updates IN UPDATE TASK, so that your updates would be committed together with any other changes in the delivery. If this is not done, you might experience some inconsistencies.

But when the delivery is deleted, most likely USEREXIT_SAVE_DOCUMENT is not triggered (although I'm not 100% sure). That's why SAP has provided USEREXIT_DELETE_DOCUMENT, so that you could delete the entries in Z table for that delivery. The comments in the program explain it rather well, actually.

My guess is that it was not done in your system and, therefore, the entries were created when the delivery was first saved and then they were not deleted properly when the delivery was deleted.

This is actually more of an ABAP than SD question...

ChadRichardson
Participant
0 Kudos

Thank you Jelena. You've given us another troubleshooting transaction to add to our toolkit. SM13 did reveal the failed updates.

FYI --- This UE is called on all changes that are saved to the delivery including deletes. Our coding executed but the failed update rolled things back to the point to where the delivery did not exist which left us hanging since our coding did in fact complete.

Thanks again,

Chad