Purpose
This guide is a continuation of document Example model of Changing Sales order quantity by reference characteristic. With the help of this document , you will be able to setup a configuration model to read the bom item quantity and then change it per your dependency procedure. This quantity can then be transferred to sales order item quantity.
Example Model from the document.
To setup the data , please follow the directions advised in the document Introduction to Variant Configuration with an example model
Materials
Configurable Header Material - VC_KMAT_PC
Configurable Component - VC_CPU_PC
Classes
VC_CL_PC (assigned to material VC_KMAT_PC)
VC_CL_CPU (assigned to component VC_CPU_PC)
Characteristic
VC_READ_QTY
VC_STPO_MENGE
Scenario:
You want to change the quantity of the bom item based on the values read from the sales order item quantity. You read the quantity of material VC_KMAT_PC from the sales order item and multiply it with the bom item quantity. The result should then be the final quantity of the bom item VC_CPU_PC in the sales order.
E.g. VC_KMAT_PC has Quantity 3.
BOM item VC_CPU_PC has quantity 1, you add the quantity with the header quantity and set it to the final quantity.
Characteristics
1) Use characteristic VC_READ_QTY (reference to VBAP-KWMENG) from the other Model.
2) To read/change bom item quantity create a reference characteristic to table STPO field MENGE. Save the characteristic
3) Create a procedure (transaction CU01) to calculate the quantity that needs to be changed. Characteristic VC_READ_QTY should have value read from sales order item..
$SELF.VC_STPO_MENGE = MDATA $SELF.VC_STPO_MENGE + $ROOT.VC_READ_QTY
Syntax MDATA is used to read the value from STPO-MENGE (quantity of the bom item that you can see in transaction CS03).
You can use any formula or syntax to calculate the value. Few examples of different syntaxes
$SELF.VC_STPO_MENGE = MDATA $SELF.VC_STPO_MENGE + $root.VC_CHR_NUM
$SELF.VC_STPO_MENGE = MDATA $SELF.VC_STPO_MENGE * 5.
For this example we are using the following. Reading the sales order quantity of the main item (header material) and adding it to the bom item quantity.
Release and save this dependency and assign it to item VC_CPU_PC in the bom for material VC_KMAT_PC (transaction CS02)
Test the Model with reference characteristic to change quantity.
Transaction VA01 , Enter Material VC_KMAT_PC with quantity 3, you should see characteristic VC_READ_QTY (reference to VBAP-KWMENG ) has value 3 If you now got to the result screen, quantity for item VC_CPU_PC should be calculated to 12.
$SELF.VC_STPO_MENGE = MDATA $SELF.VC_STPO_MENGE + $root.VC_READ_QTY
VC_READ_QTY = 3
MDATA $SELF.VC_STPO_MENGE= 1 (coming from what you have in CS03)
Therefore VC_STPO_MENGE should be 4 (3+1).
Now because the sales order quantity for header item is 3 , the final quantity for bom item will be 12 (4 calculated quantity from reference characteristic *3 sales order header quantity ) which is the final value of $SELF.VC_STPO_MENGE. This value is later transferred to sales order item.
Goto the result screen to check the item quantity
Now if you go back to sales order screen you will see quantity for component VC_CPU_PC is 12.