Often it is unclear, how the item numbers are determined in the invoice, when into one single delivery several sales orders are combined together, and batch items are present as well.
Two customizing settings are decisive to control the numbering.
One is the increment defined in the invoice type (transaction VOFA):
If nothing is entered in this field “Item no. increment” (TVFK-INCPO) then the smallest possible increment is used (1,2,3 and so on).
The second influence on the numbering is originating from the copy control definition (transaction VTFL):
Here on header level, the field “Copy item number” (TVCPFLK-POSVO) can be ticked, which then will have the effect that the item numbering of the source reference document will be tried to copied into the target, which is the invoice.
Now how does it work in such a case where in one delivery items from different sales orders are present, with also batch sub-items?
Lets assume the delivery is based on two sales orders, with 3 items from one, and 4 from the other. This leads to 7 items, which have each a batch-item so 14 items should be invoiced.
The order of processing the invoice items depends on how the items are present in the delivery, one item after another is handled, from 1 until 14:
The first item in the invoice gets item number 10, since the reference sales order item number is 10 as well, see red column with field LIPS-VGPOS above:
After the reference item number is known, the next step is the check of the copy control setting TVCPF-POSVO:
Here the copying of the item number is defined, so the number is taken over as the first item number in the invoice:
After that the first batch item is taken over into the invoice. Now here the reference item number LIPS-VGPOS is exactly the same, also 10. But of course in the invoice it is not possible to have two items with the same number, so 10 can not be used as a result of the copy control setting. Instead now the other setting is ruling the determination, the increment from VOFA. As nothing is defined, the smallest increment is added, which is 1, the second item in the invoice gets item number 11.
Third is item 20, receives item number 20 in the invoice. Fourth item 900002, gets 21. And so on, see the table above.
Now when the seventh item is created, from the second sales order, the copied item number should be 10, as the sales order number, but 10 is not possible, exists already, and the item gets incremented to 32.
When we get to the 13.th item, then the item number to be copied will be 40, as from the sales order, which is possible, as it is ascending after item 37. The last item is incremented from VOFA with 1, item 41.
The expectation that the numbering is taken from the delivery number LIPS-POSNR is not correct, the reference document item number is decisive, field LIPS-VGPOS.
This has to be taken into consideration before the customizing settings are defined with the mentioned parameters.