Question: how can I link the vepo.vepos with the lips.posnr of earlier deliveries? Note that vepo.vbeln/vepo.posnr only points to the delivery it currently assigned to, and the positions in that delivery can not be guaranteed to have been the same in previous deliveries upstream of the supply chain.
Consider the following scenario: you have three different locations in your supply chain; the factory, the distribution center, and then an external customer. So you have:
MFG --> DC --> customer
Factory and distribution center are both in the same company (and mandt is same)
Customer raises a demand for some products towards the DC, and the DC has created a sales order to meet that demand. The DC also creates a purchase order since products are not in stock at the DC.
In this case then, the MFG creates a sales order with reference to the purchase order raised by the DC. It then creates an outbound delivery with reference to the sales order raised at the mfg. The products are packed in a handling unit, and at this point in time, there it is possible to link the positions in the handling unit with the item positions in the outbound delivery.
Next step is shipping the handling unit (skipping some events in this description), and a shipment notification is sent to the DC where a inbound delivery is created. Not sure when the HU in vepo switch from outbound delivery to the pointing to the inbound delivery, but at some point it does I presume.
Once GI has been done on the HU at the DC, the DC can then proceed to create an outbound delivery with the HU in it, and send it to the customer. At this point the vepo.vbeln/posnr points to this DC's outbound delivery, and the item positions in this delivery corresponds to the sales order the DC had created.
At this point then, I don't know how to link the items positions in the Hu with the previous deliveries (the MFG outbound delivery and the DC inbound delivery).