Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
Showing results for 
Search instead for 
Did you mean: 
Former Member

Function PRICING


     - 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

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.


     - pricing worktable TKOMV (pricing worktable that contains information of all items) is filled if necessary


     - checks if condition has to be redeterrnined

          perform xkomv_aufbauen_pruefen
          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


     - read tax pricing procedure and enter taxes in XKOMV


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


Note 900089 - Pricing: Processing steps for FORM XKOMV_BEWERTEN

     - 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 (without changing 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 this formula 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


     - perform konditionsausschluss
          read customizing of condition exclusion groups


     - 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


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.


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).

     - 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

          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