Skip to Content
author's profile photo Former Member
Former Member


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?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on May 25, 2009 at 08:08 AM

    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.


    Sai Srinivas D

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 25, 2009 at 09:56 AM

    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?

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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.



Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.