This question comes courtesy of Krishna. He writes (edited for clarity):
My requirement is to give a discount for the first 50 sales orders. I tried this using the condition update tool. It is limited to only 3 sales orders. I want to make it for 50 sales orders, but I am not getting anywhere. Please help me.
I’m not sure there’s much good news ahead on this one, but let’s take a closer look at the ‘Maximum number of orders’ in the Condition Update function.
What is ‘Condition Update’ in SAP?
I’ve written about the ‘Condition Update’ function in the past. When activated on a particular condition type, this function leverages a standard SAP LIS structure (S071) to track the use of this condition type. Additional parameters become available on the Condition Record (VK11/VK12) to allow for restrictions to be set:
- Limit the dollar amount of the condition. This is handy if, for example, you want to offer new customers a 10% discount on their orders up to a total value of $1,000.00. After that amount, the discount automatically stops applying.
- Limit the total, collective quantity that can take advantage of the condition. Similar to the above scenario, you can extend a special price or discount to a customer for a limited quantity. For eample, each customer gets 10% off the first 100 items. This can be on a single order or cumulatively across multiple.
- Limit the number of orders that can take advantage of the condition. This is ideal for extending an offer or price for a certain number of orders. As above, this is a cumulative value. But…
The limit that Krishna is referring to is that last one — limiting to a certain number of Sales Orders. There is a built-in restriction on the ‘Maximum number of orders’ value: 3 orders. Not 10. Not 5. Three. Here is the explanation in the field help (F1) on that field:
But surely there is a way to extend this to be some value greater than ‘3’, right? Well, SAP Note 615370 (“Condition update: Functions and restrictions”) says otherwise:
Specifying a maximum number of orders
1, 2 or 3:
If a maximum of three orders is specified, for example, the condition record is used only in the first three orders. As of the fourth order, the condition record is no longer taken into account. A maximum number larger than three orders cannot be specified.
…and to put a final nail in the coffin of hope, the solution reads:
There is no solution. The design is restricted.
Perfect. “There is no solution”. This seems crazy, right? You can set a maximum value of $999,999,999 which could be across hundreds of orders (theoretically), but you’re limited to a measly 3 orders for the Max Orders function.
The whole condition update function is supported by an LIS structure, S071. Every condition with the “Condition Update” flag set on the Condition Type will create a record in S071 when it is used on a Sales Order. You can view this table in your SAP system using transaction SE16n.
Unfortunately, I’m unaware of any ways to bypass this restriction on the…restriction. Standard SAP will support only between 1 and 3 for the maximum number of orders value. HOWEVER, the fact that the S071 table is updated for ALL ‘Condition Update’ conditions is very interesting. One potential solution would be to write a custom pricing requirement that checks the number of sales orders used for that condition. The solution would look like this:
- Maintain the ‘Condition Update’ flag in Pricing Condition Type customizing.
- Create your condition records in VK11 WITHOUT specifying a Max number of Orders (or any other restrictions).
- Create a VOFM Pricing Requirement that does the following:
- Finds the current Condition Record Number.
- Queries S071 for that Condition Number.
- Count the number of past orders retrieved. You may need to exclude your current document number if it’s listed.
- Compare the total number of past orders to your limit number. This could be hard coded in the requirement (not recommended), or maintained in a TVARVC variable or Z-table.
- If below the threshold, the requirement passes; otherwise do not apply the condition.
In case it isn’t clear, I haven’t actually tried this method, but assuming that S071 table is updated upon Sales Document Save (which it should) you should be able to use it in your logic.
Though not technically a workaround, as mentioned above SAP does allow for a limitation on the quantity of an item to which the condition can be applied. Frustratingly, this is a cumulative restriction which could potentially involve a multitude of orders. This value is only useable when working with a quantity-, weight- or volume-based condition type. A percentage, for example, will not show this field. SAP explains its usage in that same Note:
Specifying a maximum condition basis
For example, 200 PC:
The condition basis is fully taken into account only if the specified upper limit of 200 PC is not exceeded. The specified upper limit is a cross-document limit and therefore does not apply to each order item or order individually.
This means that: The system cumulates the condition bases of all order items. As soon as an order item exceeds the upper limit, the system takes into account only the remaining difference between the upper limit and the condition bases that have been cumulated to date, instead of the actual condition basis. For all other orders or order items, the condition basis is calculated as zero.
You can see that condition updates are used from the fact that the field for the maximum base value (KOMV-KMXAW) is also displayed on the condition detail screen for the relevant condition in the order. Depending on the situation, this field has one of the following attributes:
“X Maximum value set: limit has been exceeded” or
“Y Maximum value set: limit has not yet been exceeded”
Here is what the condition maintenance screen (VL11, VK12) looks like for this type of restriction:
Again, this is not a workaround, but it is another type of restriction that will work across many orders.
Yet again, SAP provides a less-than-flexible solution, but provides the mechanics for creating one of your own design. If anyone decides to try the custom pricing requirement out, please let me know how it works in the comments below.
And thanks to Krishna for posing the question!