I have a requirement to create a program which extracts sales orders - schedule lines and check in hand inventory for a schedule line which is due to delivery and further create a delivery and do PGI (all the activities through the program automatically).
Challenge is that I have to check availability in batches and the batch should not be split to meet the delivery.
My scenario is as below.
Sales order - 01234.
Item 1 ----> Total Ordered quantity ---> 20
Schedule line 1 -----> Quantity -----> 10 (delivery is due today)
Schedule line 2 -----> Quantity -----> 10 (delivery is due today)
E.g. In hand inventory in batches:
Batch 1 ----> 30
Batch 2 ----> 10
Batch 3 ----> 50
In this case Batch 2 is meeting my requirement, so that I can proceed to deliver Schedule line 1 with Quantity 10.
I have referred some BAPIs and FMs but none has a provision to provide batch as the input (along with sales order and Item and quantities).
Is it possible to propose batch number while creating delivery by using any BAPI / FM. Appreciate your help