cancel
Showing results for 
Search instead for 
Did you mean: 

How to auto calculate the Condition Value based on a Formula.

former_member273995
Participant
0 Kudos

Hi Gurus,

There is requirement from the business to auto calculate the Discount Percentage based on the formula e.g Discount percentage = (A-B)/A*100, where A is a Gross price (e.g 150$) and B is the discounted price (e.g 90$) of a particular product and after applying the above formula the discount percentage (auto calculated) should be = 40%

How can I achieve this in a pricing procedure ?

Accepted Solutions (0)

Answers (2)

Answers (2)

VeselinaPeykova
Active Contributor

Probably I failed to understand the task which you have and what kind of challenges you are facing.

You ask a developer to create a VOFM routine with the logic that you require and then you assign this routine to a statistical condition line or to a subtotal line in V/08 (this is similar to how profit margin is represented in RVAA01).

former_member273995
Participant
0 Kudos

Apologies, if I failed to explain the scenario. Let me elaborate it further. I have 2 non statistical condition types ZTPR = Trade price and ZPRD = Price Discounts in the pricing procedure but Our customer price is fixed for the specific period of time e.g 1 year which is not a part of the pricing procedure and in order to achieve the customer price and record Trade price sales and Price discounts separately in the company's books we record both values to GL and and their net off (Trade price - Price Discount) becomes the net order value or net price for the customer.

But Trade Price is tends to change frequently due to the Trade price increase approval we receive from local regulatory body, so every time the Trade price (ZTPR) is changed user has to revise the price discounts (ZPRD) in order to achieve the customer price and to get correct net order value, as I explain earlier that customer price is fixed and Trade price change frequently and it should not impact the customer price that we already agreed with customer for a specific period.

so now what I am thinking about is, instead of driving the customer net price which is fixed, I should re-configure my pricing procedure and derive the price discount (ZPRD). I will create another condition type Customer Price (ZCPR) and what I want that user should only create condition records for the ZTPR and ZCPR in the system and ZPRD should be auto calculated e.g (ZTPR = 100 and ZCPR = 90, ZPRD should be = 10 (in percentage) ) by doing, this every time when user change condition record for ZTPR, discounts will be calculated automatically in the next sales order and customer price will always be intact.

so, my question is how can I achieve this, is there any standard routing available that I can use and user does not have to maintain the condition record for ZPRD but it will be auto calculated at the sales order?

VeselinaPeykova
Active Contributor
0 Kudos

shadab.ali4

what I described can be applied for non-statistical condition types as well.

I used this in a past project, it is definitely feasible, talk to your ABAPer.

S0022029617
Active Participant
0 Kudos

If A & B are represented by two different condition types then you can code your logic in a Condition Base Formula and assign it to the level/Step No. where you want these margin % to be displayed.

e.g.

Step Cond. Description Alt. cond. base routine

10 A Gross price 150$

20 B discounted price 90$

40 Margin % Routine with margin logic

In case you want to store the value in the document you can assign any of the subtotals from 1 to 6, subsequently the value will get stored in KZWI1 to KZWI6 of VBAP and VBRP table

former_member273995
Participant
0 Kudos

Yes A & B are a non statistical condition type but I want the result of the routine to be stored in another non statistical condition type and post the value to the GL.

S0022029617
Active Participant
0 Kudos

yeah add your new condition type at step 40 as mentioned above and assign your condition base formula as explained above - new cond. type can be with condition class discount or surcharge). The Value will be stored against this new condition type and you will be able to fetch it from the KONV table.

former_member273995
Participant
0 Kudos

Finally Got my desired result by a creating VOFM --> Formula menu --> Condition value.

FORM FRM_KONDI_WERT_601.
*{ INSERT DEVK918530 1
*{ INSERT DEVK918530 1

DATA: ZYKOMV LIKE XKOMV OCCURS 0 WITH HEADER LINE.
DATA: V_KBETR LIKE xkomv-kwert,
V_ZTPR LIKE xkomv-kwert,
V_ZCPR LIKE xkomv-kwert.

CLEAR ZYKOMV.
REFRESH ZYKOMV.
ZYKOMV[] = XKOMV[].

"Reading KOMV Table to retreive TP AND Customer Price Values
READ TABLE ZYKOMV WITH KEY KSCHL = 'ZTPR'.
V_ZTPR = ZYKOMV-KWERT.

READ TABLE ZYKOMV WITH KEY KSCHL = 'ZCPR'.
V_ZCPR = ZYKOMV-KWERT.

if V_ZTPR ne 0.
"Calculating Discount Value
xkwert = ( V_ZTPR - V_ZCPR ) * -1.
"Caluclating Discount Percentage
"XWORKM = TP Conition Rate. (Attached as a subtotal routine in the pricing procedure ZNAT25)
"XWORKL = Customer Price Rate. (Attached as a subtotal routine in the pricing procedure ZNAT25
xKOMV-KBETR = ( XWORKM - XWORKL ) * 10 .
*modify xkomv.
" In case TP is 0 then both Discount Value and Discount percentage will be 0
else.
xkwert = 0.
xKOMV-KBETR = 0.
endif.

ENDFORM.