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 to delete entire delivery in SAPMV50A/USEREXIT_SAVE_DOC_BEFORE_PREP

oiver_beie
Participant
0 Kudos

Hi all,

I'm implementing a certain logic in SAPMV50A / USEREXIT_SAVE_DOC_BEFORE_PREP during delivery creation (VL01N) to check if delivery items really can be delivered or not. According to note 415716 (example_3) I've implemented the logic to delete delivery items by calling xlips_loeschen(sapfv50p), that works fine.

In special cases the item deletion can cause the situation that a all items are deleted from the delivery. In that case SAP creates a 'empty' delivery document without any item lines.

Question: How can I delete or flag the delivery header for deletion (or non-creation), so that no empty delivery will be created? In dialog mode I guess I could raise a error message but I need also a logic for the delivery creation in batch mode where only some of the deliveries in table XLIKP should not be created. Setting the update flag (XLIKP-UPDKZ) directly in XLIKP or using XLIKP_LOESCHEN/LIKP_LOESCHEN(SAPFV50k) did not help.

Thanks for your thoughts on this in advance!

Oliver

4 REPLIES 4

Former Member
0 Kudos

You can't delete the delivery within the scope of delivery processing logic. What you can do instead is create a small ABAP that will just have coding to delete the delivery just being processed (assuming you have the delivery number already) and submit it as a job from the user exit asynchronously to execute may be 5 mins later to delete a delivery that doesn't have any items left.

If this looks dirty then you may want to schedule a separate job that will scour for deliveries not having any items left and delete them, may be every hour or so.

eduardo_hinojosa
Active Contributor
0 Kudos

Hi

Wellcome to SDN. Please, see SAP Note 415716 - User exits in delivery processing related with this subroutine.

Regards

Eduardo

SilvanoSilva
Explorer
0 Kudos

Hello, I have the same problem. I am creating collective deliveries using VL10* and I need to block the creation of a particular delivery. The table XLIKP can keep many deliveries in the same time for a group, I want to stop just some of the group not all.

If I raise an error message its works but stop the creation for all deliveries in the group.

I tried the note 415716 and worked in some way but the delivery number was reserved. And for sales order the number was set to the document flow...

How did you solve your problem?

0 Kudos

Hi Silvano,

I found no solution for this issue within the VL01N processing. The only way is to do something like Vishnu proposed by establishing a kind of batch job that deletes deliveries with no lines or to trigger a suitable event processing. However, the delivery document number is wasted.

Whenever possible try to implement a delivery creation condition in the copy control between sales oder and delivery. If the condition is not fullfilled no delivery is created and no document number ist wasted.

Kind regards,

Oliver