Purpose
This guide is a continuation of document Introduction to Variant Configuration with an example model. With the help of this document , you will be able to setup a configuration model to read the sales order quantity and then change it per your dependency procedure.
Example Model from the document.
To setup the data , please follow the directions advised in the document referred above.
Materials
Configurable Header Material - VC_KMAT_PC
Classes
VC_CL_PC (assigned to material VC_KMAT_PC)
Characteristic
VC_CHR_NUM
VC_READ_QTY
VC_CHANGE_QTY
Scenario:
You want to change the quantity of the material based on the values read from the material. You want to read the quantity of material VC_KMAT_PC from the sales order and add it to the value you select for characteristic VC_CHR_NUM. The result should then be the final quantity for the sales order item for material VC_KMAT_PC.
E.g. VC_KMAT_PC has Quantity 2.
VC_CHR_NUM has value 2.
Then Quantity for material VC_KMAT_PC should be changed to 4 (char VC_CHR_NUM + Quantity you added on item level). Final Quantity of the sales order should be 4. You need two characteristics with reference to quantity, one to read the value and second to change the value.
Characteristics
To create characteristic use transaction CT04
1) Create characteristic VC_CHR_NUM with a numerical format.
2) To read the quantity create a reference characteristic to table VBAP field KWMENG. Save the characteristic and assign this to the class attached to material VC_KMAT_PC. In this model it is class VC_CL_PC.
Test the Model with reference characteristic to read the quantity.
Transaction VA01 , Enter Material VC_KMAT_PC with quantity 2, you should see characteristic VC_READ_QTY has value 2. If you change it 4 , it will be 4.
3) To change the quantity of the sales order item, create reference characteristic VC_CHANGE_QTY to table VCSD_UPDATE field KWMENG.
Assign this Characteristic to class of the material VC_KMAT_PC . In this model assign it to Class VC_CL_PC.
4) Create a procedure (transaction CU01) to calculate the quantity that needs to be changed. Characteristic VC_CHANGE_QTY should have the calculated value.
VC_CHANGE_QTY = VC_READ_QTY + VC_CHR_NUM
You can use any formula or syntax to calculate the value. The syntax of the procedure should be the following.
Use the following syntax
$Self.VC_CHANGE_QTY = $self.VC_READ_QTY + $self.VC_CHR_NUM
Make sure you release the procedure after creating it. Assign this procedure to configuration profile (CU42) of material VC_KMAT_PC.
Test the Model with reference characteristic to change quantity.
Transaction VA01 , Enter Material VC_KMAT_PC with quantity 2, you should see characteristic VC_READ_QTY (reference to VBAP-KWMENG ) has value 2. If you now enter value 2 to characteristic VC_CHR_NUM, you will see characteristic VC_CHANGE_QTY has been calculated to 4 (VC_READ_QTY + VC_CHR_NUM)
Now if you go back to the sales order main screen , you will see quantity of material VC_KMAT_PC is calculated and changed to 4 ( value coming from characteristic VC_CHANGE_QTY).