08-11-2016 11:26 AM
Hi Experts,
My requirement is to automate the delivery items when a new item added to Sales order through VA02.
For EX : I have created the Sales order 12345 with 1 item and created the delivery 56789
Now I added a new item to the sales order through VA02 then If I go and check in Delivery, it should also get automatically update with new line item.
Is there any user-exits/BADIs available to achieve this ?
08-11-2016 2:40 PM
Hi,
Userexit( After VA02 SAVE):
SAPMV45A -> USEREXIT_SAVE_DOCUMENT
First do Credit Check. FM BAPI_CREDITCHECK
Then Material Availability. FM BAPI_MATERIAL_AVAILABILITY
For Item Insert in Delivery FM WS_DELIVERY_UPDATE / BAPI_OUTB_DELIVERY_CHANGE
Regards,
Abhishek Kadam.
08-11-2016 12:27 PM
Hello Geeta,
Nice question. But what about credit check and batch determination?
Regards,
Abhishek Kadam.
08-11-2016 12:51 PM
Can you tell me whether your client will create deliveries and save it. Post Goods issue will happen later? Even if that is the case, it is not recommended to add the sale order new item to an existing delivery. Moreover, what is the business requirement to add a new item in an existing delivery?
G. Lakshmipathi
08-11-2016 1:13 PM
Normally in cash sales/Rush sales- delivery will be done on immediate base..but adding second line item here once after delivery created at sales order level may not reach your requirement..
what If second line item having a different delivery date & ship to party?
Phanikumar
08-11-2016 1:41 PM
Hi Everyone...Thank you all for immediate response.Actually we are doing some improvement plans for particular region. As part of the improvement ideas, this is one of the improvement plan which should automate the process.
Ideally, if delivery is already created and item is added to sales order, we would like to reprint the delivery and have line 2 automatically pull from sales order.
EX : SO# 12345, Delivery 56789 —added line 2 to sales order and manually added line 2 to delivery. It is missing information (value) in order to complete the order and invoice for line 2. This manual addition is not working properly, but is a solution.
Iam looking for the technical approach to achieve this
08-11-2016 2:28 PM
Geetha,
There were some valid points on why this might not be a good idea from earlier posts but to achieve this technically what you can do is the following:
1. In the userexit_save*prepare, you can check if new lines were added to the SO by comparing XVBAP and YVBAP. If your logic determines that a new line was added, you should check if there is an existing delivery, its PGI status, ship to data etc before making the decision to add the new line to the delivery. Once you determine that the line can be added to the delivery:
2. You can either call a FM which updates delivery as an update task by passing the necessary details to the FM or you can use the userexit_savedoc within MV45AFZZ. This exit is called after the commit was issued in SAPMV45A.
3. You can also think about calling an FM in background task if you would like to decouple the process of updating the delivery from the SO update.
Thanks,
Vikram.M
08-11-2016 2:40 PM
Hi,
Userexit( After VA02 SAVE):
SAPMV45A -> USEREXIT_SAVE_DOCUMENT
First do Credit Check. FM BAPI_CREDITCHECK
Then Material Availability. FM BAPI_MATERIAL_AVAILABILITY
For Item Insert in Delivery FM WS_DELIVERY_UPDATE / BAPI_OUTB_DELIVERY_CHANGE
Regards,
Abhishek Kadam.