Different Discount for Each Variant in Sales Document
While implementing variant pricing we came across a specific requirement where the business want a different % discount for each variant.
For example.
In Sales order below is the pricing structure with variant pricing.
Condition Type | Variant | Price |
VA00 | I-CPU | 1000 |
VA00 | 16 GB | 400 |
VA00 | A-Graphic Card | 200 |
VA00 | Modem | 50 |
The requirement was to calculate different % of discount on each variant.
Condition Type | Variant | Price |
VA00 | I-CPU | 1000 |
VA00 | 16 GB | 400 |
VA00 | A-Graphic Card | 200 |
VA00 | Modem | 50 |
Discount
Condition Type | Variant | % | Amount |
| I-CPU | 5% | 50 |
| 16 GB | 2% | 8 |
| A-Graphic Card | 3% | 6 |
| Modem | 1% | 0.5 |
Solution:-
We copied VA00 condition type and created ZY00 and changed below fields
- Calculat. Type = A (Percentage)
Plus/minus = X (Negative)
Variant Cond. = Activated.
Create a Pricing routine under Condition Formula for Basis (Condition Base Value) and write below code.
FIELD-SYMBOLS: <fs_xkomv> TYPE komv_index.
CHECK sy-tcode NE 'VA23'.
LOOP AT xkomv ASSIGNING <fs_xkomv>
WHERE kschl EQ 'VA00'
AND varcond EQ xkomv-varcond.
xkwert = <fs_xkomv>-kbetr.
ENDLOOP.
Assign the pricing routine to discount condition type in pricing procedure.