Pages

Sunday 15 September 2013

Problem in sales order creation using BAPI_SALESORDER_CREATEFROMDAT2 for BOM (Bill of Material) with 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.

Problem:
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.

Solution:
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.

Example:
Lets say there is two materials used to create a sales order,
MAT1
MAT2

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.

In this scenario, 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 1 (BOM1)
12 – sub item 2 (BOM2)
13 – sub item 3 (BOM3)
.
.

21 – sub item 11 (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.


Example with screen shot:
Here in this scenario we are creating the sales order with the material 10005999 which have 16 sub item.
So the 16 sub item will occupy the item number from 11-26 which would overwrite the 20th item material if we do not pass the  INT_NUMBER_ASSIGNMENT = ‘X’.
This parameter generates the internal item number inside the standard BAPI and avoid the over writing scenario. In this way the next line item will be assign as 30 (instead of 20) and creates the order successfully.
























Important tables for Bill of Material :
•    MAST (Material to BOM Link)
•    STPO (BOM item)

OSS Note:
You can refer the OSS note 522356 for further details.

No comments:

Post a Comment