cancel
Showing results for 
Search instead for 
Did you mean: 

Pricing

Former Member
0 Kudos
85

Dear All,

I am an ABAPER. I was asked to write Routine for Pricing. The following is my requirement:

The graduated scale has been assigned for pricing in Sale order. The scenario is like for a single contract, they fixed the following pricing scales.

0 to 1000 -- 99 USD

1000 to 2000 -- 98 USD

2000 to 3000 -- 97 USD

3000 to 4000 -- 96 USD

4000 to 5000 -- 95 USD

For example, I have created a first sale order (7036) for a material P100; Quantity:1500 EA

Sale Order1 - 7036:

Item -- Material -- Quantity -- Unit

10 -- P100 -- 1500 -- EA

For this item, the price is taking the scale correctly as given in the procedure.

99 * 1000

98 * 500

Now while creating a second sale order for the same material, I have to consider the previous sale orders material for fixing the price.

Sale order2 - 7037:

Item -- Material -- Quantity -- Unit

10 -- P100 -- 1500 -- EA

For this second sale order, the price should calculate as

98 * 500

97 * 1000

Can anyone suggest is it possible to fix pricing scales in the routine for this scenario?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Prem,

Yes you can do it. As you said, its for single contract.

Whenever you careate a sale order, you will give the reference as contract number.

What you need to do in the pricing routine is, while creating the second sale order, you need to pick up all the sale orders, referred to your contarct , and then sum up the quantities.

As the current order quantity and previous order quantities summed up, then you can find the scale, where this quantities falls in and accordingly you can calculate the price.

in your example itself, when you create the first sale order,

as there is no other sale orders created, for 1500 quantity..

1000 for 99 $

500 for 98 $ (this 500 quantity falls in second record).

when you create another sale order with 1500 quantity, so the total becomes 3000. which falls under 2000 to 3000 -- 97 USD

you can add the quantity to the first order , to get the second scale.

So if you add 500 to the first sale order which falls in the second scale i.e. 1000 to 2000 sale.

The remaining 1000 ( Which is pending in the second ) will come under third scale.

Hope you understnad what I mean to say. If you have still issues please let me know.

Regards,

Sai Srinivas D

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks sai,

As you have suggested, in the routine I summed up the previous sale order quantities and then I added it to the current sale order. Finally I moved this total quantity to "Scale Base Quantity". For the above discussed example, I moved 3000 to Scale base quantity (ie., XKWERT)

But it is not picking the scale correctly.

In the routine, how should I calculate price other than Scale base quantity? or is it enough to populate Scale base quantity to calculate the price internally by system?

Former Member
0 Kudos

Hi Prem,

Clarify one thing. Are you writing this routine for scale base quantity?

Regards,

Former Member
0 Kudos

Hi Prem,

XKWERT is condition value . its not the quantity.. Please check once again.

Regards,

Sai

Former Member
0 Kudos

Hi Sai,

I noted that Scale Base value (XKWERT) can be the value or quantity that has been entered in the document.

To elaborate, I will tell you the steps I did for this purpose.

1. In VOFM transaction, FORMULAS menu, selected Scale Base.

2. In the Formulas Scale Base value, I created new Routine 910 for PR00

3. Assigned this routine 910 in VOK0 transaction for PR00.

4. In the routine, I wrote the following code to populate the XKWERT value.

xkwert = komp-mglme + lv_kwmeng.

where komp-mglme is Current order quantity 
and lv_kwmeng is previous order quantity.

When creating a 2nd sale order, while debugging, I found XKWERT has the order quantity (ie 1500 as in the above example). Thats why I summed the previous order quantity to XKWERT.

If this is not right, can you suggest what should be written in the routine?

Former Member
0 Kudos

Hi Prem,

That is correct. Thats what you need to do.

Is the scale values are being picked up in the document or not ?

Regards,

Sai

Former Member
0 Kudos

Hi Sai,

Yes, It is picking Scale values..

But it is not calculating price correctly for each items.

Here in our example, While creating sale order with 1500 quantity, the scale base value increases to 3000. So the price splits as shown below:

99 * 500

98 * 500

97 * 500

The Net value is 147.00

But this is wrong. We need to get

98 * 500

97 * 1000

How to get this done?

Former Member
0 Kudos

Hi Prem,

You can try this.

Put the previous order quantity into one variable and current order quantity to another variable.

Deduct from the current order quantity ( Say X Quantity ), and this to the previous order quantity, which should fulfill the scale fully..

Then the remaining quantity (Q - X) will fall under the next scale.

Like: 1st order has 1500 quantity and second also has 1500 qty.

Make a select query on Scales table to pick up all scales..

( Logically.. X is nothing but the value which rounds the previous order to close the maximum range of scale )

As the X quantity has the previous scale, Multiply with previous scale quantity.

The remaining (Q - X) will fall under the next scale. ( Of course Q - X should be lass than 1000 ).

Hope its clear.

Regards,

Sai