Purpose
This page was created to clarify the application logic that is responsible to determine the Net Price, when the condition is changed in BAPI_CONTRACT_CREATE or BAPI_CONTRACT_CHANGE. It is also valid for Scheduling Agreement BAPIs (BAPI_SAG_CREATE, BAPI_SAG_CHANGE).
Overview
When the condition is changed using BAPI, system tries to determine the new price based on the change or added condition entries. This only occurs, if the added or changed condition entry is valid for the current date. In case of future validity period, the pricing determination won’t occur.
For more information, refer to KBA 2806882.
Debugging Guide
Set a breakpoint in the following logic:
- Method PROCESS_PRICING of class CL_PRICING_PROVIDER_MM,
- FORM COPY_FROM_TKOMV of Include MV13AF0C.
Start the debugging in Method PROCESS_PRICING of class CL_PRICING_PROVIDER_MM. This Method is called when the BAPI is executed with a change condition that is valid for the current date.
System first fills table LT_TKOMV using Method PREPARE_DATA.
In this Method, system loops at the condition entries that the BAPI condition processing logic created (IT_KONH – validity periods, IT_KONP - conditions). Here check, if the values are correct. If not, it means that the error occurred during Condition processing. To analyze the relevant application logic for that, refer to Wiki page Condition update process - Debugging Guide (ME816).
If table LT_KOMV is correctly filled, you can return to Method PROCESS_PRICING and continue the analysis in FM RV_CONDITION_COPY.
In this FM, system calls FM RV_CONDITION_MAINTENANCE, which calls the general condition maintenance logic. Here check again whether the values are correct in COPY_TKOMV, because that will be the basis of the price determination.
If the values are correct, press F8.
The breakpoint stops in FORM COPY_FROM_TKOMV. Here system loops at the entries in table COPY_TKOMV and fills the condition amount in KONP-KBETR.
Then system calls FORM KONDITIONEN_ORDNEN.
In this FORM, system calls FM PRICING_SCHEME, which perform the final pricing determination steps.
If this FM, system calls the following FORMs.
FORMs XKOMV_AUFBAUEN_AUS_KOMT1 and XKOMV_AUFBAUEN_AUS_TKOMV fills table XKOMV from Pricing Procedure customizing and from the previously filled TKOMV. After these two FORMs are executed, XKOMV should contain an entry with the new price (KBETR).
FORM XKOMV_BEWERTEN performs the pricing calculation. In this FORM system loops at the previously inserted entries in table XKOMV. In the loop there are separate logic for different pricing cases. In this Wiki page, only the basic logic is covered, so that you can identify at which point the price becomes incorrect and then you can go back one step to analyze why it occurred.
In the LOOP system determines the condition basis. When an improper condition unit is set for the condition in BAPI, it can be that the system can’t find any conversion factor for the old and new unit and therefore the condition basis will be 0. This will cause the Net Price will be set to zero as well. For more details, refer to KBA 2806882.
Afterwards, system calls FORM XKOMV_KWERT_ERMITTELN, which calculates the net value. In some case the net value is used for pricing calculation.
In this FORM, system uses the following calculation:
Then it sets the calculated value into KWERT.
Then returning to XKOMV_BEWERTEN, system determines the price into variable ARBFELD and finally it will be set as Net Price. The value in KOMP-NETPR will be used to update the price of the item.
This value will be provided when returning to Method PROCESS_PRICING of class CL_PRICING_PROVIDER_MM.
Related Content
Related Documents
SAP Community Wiki - Condition update process - Debugging Guide (ME816)
Related SAP Notes/KBAs
KBA: 2806882 Net Price (EKPO-NETPR) remains zero after creating or changing the contract using BAPI