Problem in sales order creation using BAPI_SALESORDER_CREATEFROMDAT2 for BOM (Bill of Material) and Solution
Generally when we create sales order using BAPI_SALESORDER_CREATEFROMDAT2, there we pass item number externally into the tables parameter – ORDER_ITEMS_IN like 10, 20, 30 format.
When there is BOM (bill of material) for any material that will explode when creating the sales order with those materials. Sometime it can be happen that the material has more than 9 sub items (bill of material). In this case if we pass the item number as 10, 20, 30, 40 format externally into the BAPI, then the item (which have more than 9 sub item) will over write on the next item and there will be problem in sales order creation.
Pass the parameter INT_NUMBER_ASSIGNMENT with value ‘X’ into the BAPI. It will internally generates and assign the next suitable item number and avoid the overwriting of items.
Lets say there is two materials used to create a sales order,
And sub items (bill of material) of the materials are like,
MAT1 – BOM1, BOM2, BOM3, BOM4, BOM5, BOM5, BOM7, BOM8, BOM9, BOM10, BOM11.
MAT2 – BOM1A, BOM2A, BOM3A.
When we will try to create sales order using BAPI (BAPI_SALESORDER_CREATEFROMDAT2) providing the line item numbering externally (from our custom code) as 10, 20 … then we would face the same problem.
If we pass the parameter INT_NUMBER_ASSIGNMENT as ‘X’, then the standard code within BAPI will generate the next item assignment number and create the sales order successfully.
In the created sales order the line items will look like –
10 – MAT1
11 – sub item (BOM1)
12 – sub item (BOM2)
13 – sub item (BOM3)
21 – sub item (BOM11)
30 – MAT2
32 – sub item (BOM1A)
33 – sub item (BOM2A)
34 – sub item (BOM3A).
Here, instead of 20 the next item (MAT2) will start from 30.
This is a very simple technique and might help someone when troubling with such king of BOM issue. 🙂