When many orders even with Order Combination flag set are used to create a single delivery, there are times when more than one delivery is created.
In transaction VA03, Sales Order Header > Shipping Tab, we have Order Combination flag
The Order Combination flag is the field KZAZU in table VBKD.
We had created an ALV tree report that displayed Orders where VBKD-KZAZU was set and we were using the report to create one delivery from them. We were using ‘BAPI_OUTB_DELIVERY_CREATE_SLS’ for this purpose. You can check the post regarding the report here
We thought that since VBKD-KZAZU was set, the orders we select would create a single delivery. This worked ideally in the beginning and the report seemed good.
Below is a screenshot from the custom delivery creation report.
Real World Scenario enters the picture
But soon, reality struck. There were times when multiple deliveries were created while using the report.
It was quite perplexing initially. We checked the order and the Order Combination was set and there was nothing much different about the order.
Qt. Was Shipping type (VBKD-VSART) difference the reason?
We checked a few tables to see differences in the orders, and in table VBKD we found a difference in Shipping type (VBKD-VSART).
We made the Shipping types of the orders same for testing, and tried creating delivery again and it worked. One Delivery for all orders.
Hmm.. difference in Shipping types of Sales Order causes creation of different deliveries, or so we thought.
Ans. Yes, but not always..
But in a few days, we came across a similar case. We were trying to combine 7 Orders. Four orders created one delivery and the rest created another. This time, though the Shipping type was same. We checked the tables again and this time we found difference in Payment guarantee procedure (VBKD-ABSSC)
This is Interesting….
SAP was doing some checks and making sure only relevant orders are combining.
Need to debug
As a developer of this report, I felt the urge to debug myself to understand what is going on 🙂
I wanted to find the other situations where multiple deliveries can be created.
Since we were using ‘BAPI_OUTB_DELIVERY_CREATE_SLS’ , I started checking the code inside
- Inside the BAPI, there is a call to FM SHP_DELIVERY_CREATE_FROM_SLS
- Inside this FM, we call FM RV_DELIVERY_CREATE
- Here, before creation of any delivery subroutine COMPARE_HEADER_AND_SET_LGNUM (Program SAPFV50K) is called
- CS_LIKP is of type “LIKPVB”
- We compare entire CS_LIKP (Current Delivery Header) and CS_ZLIKP (Previous Delivery Header)
- In case of any difference, we call FM ‘SD_COMPARE_DELIVERY_HEADER’
- Inside the FM, values of individual fields of structure LIKPVB are checked
- In case of difference in comparable fields in structure LIKPVB (e.g. VSART, ABSSC ,and other fields) a new delivery will be created
For more info, you can go through the code inside FM SD_COMPARE_DELIVERY_HEADER
Explanation of our case:
- For the 4th order in the picture, VBKD-ABSSC had a value and the previous order had VBKD-ABSSC as blank
- Hence, CS_LIKP-ABSSC = 000002 and CS_ZLIKP-ABSSC = blank
- Here, a difference is noted in ABSSC values and so a 2nd Delivery was created
In our custom report world, we were thinking of an ideal scenario where we expected a single delivery for our orders. But in the SAP standard world, setting the Order Combination flag (VBKD-KZAZU) does not guarantee one delivery. It is just an indicator that you are allowed to combine orders as mentioned in the F1 help of the field.
This is SAP standard functionality and thus absolutely fine. SAP checks for all scenarios and only when the Orders seem relevant and the SAP standard criteria is met, they get combined…