Creating Efficient Territories in SAP Commissions
In summary, efficient territories can have a big impact on your calculation run times. But what makes a territory efficient? It all has to do with how you combine and place your references to the category hierarchies in the territory definition.
In most cases, your territories will reference multiple category hierarchies. When this is the case, building territories following the logic below will improve the performance of your calculation.
The basic logic is, you want your condition to fail quickly when using AND logic, and you want your condition to succeed quickly when using OR logic. Conditions fail more quickly if the larger hierarchy is first, while it will succeed more quickly if the smaller hierarchy is first.
Let’s look at two examples to illustrate this.
In this example, a global corporation has two hierarchies, Channel and Geography. Channel is a very small hierarchy; in fact, it has only two classifiers: Direct and Indirect. Geography, on the other hand, is huge; it has over 2000 classifiers representing postal codes around the world.
Each payee is assigned a channel and a geography. This means each transaction must meet both criteria. Here are a few examples:
- Direct AND 90028
- Direct AND 049483
- Indirect AND SW1X
Why does this improve performance? Consider this: we know that both conditions must be met. This means if either condition is false, the system can discard it and move on. For the geography, there is only about a 1/2000 chance the condition will be met, while for the channel, there is a 1/2 chance.
Let’s continue with the same corporation, but this time, we are adding an Industries hierarchy. Possible industries are Financial Services, Manufacturing, and Telecommunications, making this, again, a small hierarchy.
In this new scenario, each payee’s territory includes two criteria, Industry and Geography, but only one condition needs to be met for the territory to succeed. For example:
- Telecom OR 90028
- Financial Services OR 049483
- Manufacturing OR SW1X
This time, the situation is reversed. Because we are using OR logic, we want the condition to succeed quickly. Since the industry only has three classifiers, it has a 1/3 chance of succeeding…much higher than the 1/2000 chance from the geography. So, this time we’ll put the industry first.
Example 3: What if I’m using more than two criteria?
The simple answer is, the logic is the same. You can use parentheses to nest statements and force the territory to evaluate your statements in the correct order. Let’s look at an example in which the payees are assigned a territory that includes a single industry and a single channel, but can include multiple geographies. Some examples:
- Financial Services AND Direct AND (SE10 OR SW1X OR E14)
- Manufacturing AND Indirect AND (510000 OR 510700 OR 511400)
In this case, the order is still correct, since the only time we use OR logic is for the geographies, which are all using the same hierarchy.
In short, when creating territories, if you are combining your categories with AND, put the larger hierarchy first, and if you are combining your categories with OR, put the smaller hierarchy first.