Function PRICING
1. Form KONDITIONSVORSTEP (LV61AA12)
- read customizing data
- build KOMT1 (pricing procedure, relevant condition types including their characteristics)
- build KOMT2 (relevant accesses)
- read pricing type (STEU)
- USER EXIT userexit_pricing_rule
- read pricing type (STEU)
- USER EXIT userexit_pricing_rule
If something is incorrect in standard pricing types you have to check it here. Internal table STEU contains the attributes of pricing types and shows at what circumstances a condition is redetermined.
Customer specific pricing types are defined in the User Exit.
Customer specific pricing types are defined in the User Exit.
2. Form KONV_EINLESEN (LV61AA11)
- pricing worktable TKOMV (pricing worktable that contains information of all items) is filled if necessary
3. Form XKOMV_AUFBAUEN_AUS_KOMT1 (LV61AA67)
- checks if condition has to be redeterrnined
perform xkomv_aufbauen_pruefen
if sy-subrc eq 0 => Condition will be redetermined
if sy-subrc eq 0 => Condition will be redetermined
- condition Access (read KBETR)
perform konditionen_lesen => database will be red
- read Data e. g. for VPRS
perform xkomv_fuellen_ohne_konp => perform xkomv_kbetr_ermitteln
perform xkomv_fuellen_ohne_konp => perform xkomv_kbetr_ermitteln
4. Form XKOMV_AUFBAUEN_STEUERN (LV61AA57)
- read tax pricing procedure and enter taxes in XKOMV
5. Form XKOMV_AUFBAUEN_AUS_TKOMV (LV61AA58)
- read TKOMV and decide if condition will be copied into XKOMV.
perform xkomv_aufbauen_pruefen => checks, depending on condition customizing of TKOMV, values and actual pricing type.
if sy-subrc = 4 => copy TKOMV to XKOMV.
6. Form XKOMV_BEWERTEN (LV61AA55)
- userexit_xkomv_bewerten_init
- LOOP
loop at xkomv.
- value of the condition basis gets determined
perform konditionsbasis_ermitteln
calculate XKOMV-KAWRT
- run condition basis fomiula
if xkomv-kofra ne 0.
- if preisfindungsart ne ‘E'
lf pricing type = E nothing will be done while running PRICING, no calculation, but formulas will be run (withoutchanging XKOMV)
- * execute condition basis formula not changing xkomv
This part of the coding is only run if pricing type = E. XKOMV will not be changed even if the values within thisformula have been changed.
xkomv = rettkomv. (rettkomv includes the values before running the formula)
- if xkomv-kofrs ne 0.
Run scale base formula if set in the customizing
- condition value gets determined
perform xkomv_kwert_ermitteln.
calculate XKOMV-KWERT
currency conversation
If xkomv-kofrm NE 0. => run calculation formula
- * execute condition value formula not changing xkomv
This part will only be run if pricing type = E
- * calculated subtotals in KOMP
- Net price is calculated
* recalculate komp-netpr
KOMP~NETPR is calculated
- * inactivate lines prior to last active price
Only the last price of the pricing procedure will be active => Note 836243
- userexit_xkomv_bewerten_end
7. Form XKOMV_AUSSCHLUSS (LV61AA56)
- perform konditionsausschluss
read customizing of condition exclusion groups
8. Form XKOMV_UEBERTRAGEN_NACH_TKOMV (LV61AA42)
- append lines of XKOMV to TKOMV
XKOMV only includes one item, TKOMV includes all iterns of the document.
Subtotals (lines in XKOMV without condition types) are not appended to TKOMV
Function PRICING_COMPLETE
All items will be calculated again depending on pricing type. Check preisfindungsart_kopf if you need to know which pricing run will be triggered
- LOOP AT tkomp.
* new pricing if necessary
Depending on the pricing type the necessary function modules are called. The standard pricing is done again, normally there is only a calculation.
No condition records will be redetermined.
- * build GKOMV per item
Table GKOMV will be build including all group conditions of an item.
- * calculate group conditions
determine correct scale base and correct KBETR
- LOOP AT gkomz.
Recalculate XKOMV values based on GKOMV changes.
Determine rounding differences
PRlClNG_COMPLETE is only called while going to Header conditions or while saving a document (Due to performance issues). It might happen that item values are changing again afier saving the doucment or going to Header conditions.
Function PRICING_COPY
Each and every condition of the referenced document is copied from KONV table into XKOMV of the new document. If necessary the conditions are fixed (XKOMV_KSTEU).
- LOOP AT u15_konv INTO konv.
u15_konv includes all conditions of an item (PRlClNG_COPY is called for each item separately).
u15_konv includes all conditions of an item (PRlClNG_COPY is called for each item separately).
- pricing type is set in field ‘MODE’ at this part of the coding. You can check each time if 'MODE' contains the correct value as it is set in the copy control
customizing. In standard it is normally‘D’ or ‘G’.
- userexit_pricing_copy
In this user exit it is possible to change everything in XKOMV. Here it is possible to change KSTEU if a special condition should be recalculated again
In this user exit it is possible to change everything in XKOMV. Here it is possible to change KSTEU if a special condition should be recalculated again
later in the pricing process.
- If the quantity has been changed while copying the conditions, the value will be adjusted
arbfeld = xkomv-kwert * quantity_new / quantity_old.
- At the end of this function XKOMV will be copied to HKOMV and then HKOMV will be copied to TKOMV. TKOMV is used in function module PRICING
Fonte: http://scn.sap.com/community/erp/sd/billing/blog/2013/10/03/pricing-programs
Nenhum comentário:
Postar um comentário