Set Conditions in Transportation Management and Avoid Pitfalls
Automation and flexibility in transportation management are essential, because manual processes cost time and time is money. Making decisions is one of the many processes in transportation management that you want to standardize and accelerate through automation. For example, when deciding which freight agreement to use depending on the purchasing organization, carrier, means of transport, and so on. One way to realize automation and flexibility at the same time is to use decision tables and conditions via the Fiori Launchpad.
How to create condition definitions
One of the many advantages of conditions: There is no need for additional programming and new situations can quickly be responded to by adapting or extending the configuration, without the need for development skills. The areas of application are diverse in nature. Wherever process decisions are to be made on the basis of if-then formulations, by defining individual selection values or excluding certain values or entire ranges of values, and these condition values can be in a state of dynamic change, the use of decision tables can provide an enormous advantage in terms of flexibility, but also simplification for the customer.
To create a condition definition in SAP TM, one opens the conditions worklist via the SAP Fiori Launchpad. From there you can create new conditions or modify existing conditions.
Data Access Definition as Basis
The basis of each condition is the data access definition. Here you specify which BOPF data objects or values are to be evaluated in the definition. You can already create sufficient complexity here, as you can choose between business object-based, data crawler-based or class-based data access definitions. The latter will again require development capacities, while the former will access standard information of a BOPF object.
Once you have set up the data access definition, the interesting part of the condition definition begins – the combination of values (include/exclude) that lead to certain results. It is important to know that besides include conditions there are also exclude conditions. So values can be included or excluded. This is already known from the selection options in SAP ABAP screen fields. But a pitfall is that in the standard only includes can be created at first and only at second glance the excludes are available.
Unfortunately, there are a few small stumbling blocks when creating conditions that lead to undesired results. Troubleshooting is then difficult. The cause is often already in the configuration of a condition – i.e. in the decision tables. Especially if the condition is a bit more complex, debugging becomes a little adventure. Now, sadly, not every non-computer scientist has had a course in propositional logic, but this is an important basis for understanding how decision tables work.
Use case: Billing agreement determination
In our example, a freight agreement is to be found on the basis of several values, which will be used for cost determination. Specifically, a freight agreement is to be found for carrier 519862 with means of transport Z001 for a freight order that only contains material of freight group MOLKEREI.
But due to an incorrectly set condition, the wrong agreement was determined all the time. On the basis of this, we can easily explain various pitfalls, such as the problem with the logic and why there is an error message: Namely, no freight costs were determined at all.
The incorrect condition
Conditions are always processed sequentially!
- Conditions are therefore processed from top to bottom until a condition is fulfilled. Therefore, the order can be very crucial. In the example above, the last line must not be in the first place, because all freight orders fulfill this condition, because it simply does not matter which values this freight order has.
Each value column is connected by an AND!
- Here we are using propositional logic. All values of a line must always be fulfilled, so that the condition is fulfilled.
A line is thus read as follows:
- If the purchasing organization = 0020
- AND the transport service provider is 0000519862
- AND the country is = DE
- AND any means of transport (so it doesn’t matter which one)
- AND any material freight group
- AND any notified quantity
- AND any order reason
- AND any document type…
… then the agreement 8100000005 applies.
Caution: There are also stumbling blocks
There are a lot of stumbling blocks in the area of conditions and propositional logic. The easy ones are that you made a mistake, that you entered wrong values or that you entered too many values which prevent the condition from being fulfilled. But there are other pitfalls that are easy to overlook at first glance.
Let’s start with the first stumbling block: the freight order has entered the required values, the condition is evaluated and the agreement 8100000005 is found. Nevertheless, no calculation takes place – the freight costs cannot be determined. Here the invisible error is in the found agreement or in the tariff price table behind it.
This is only valid for the material freight group HMILCH. This means: the condition was configured incorrectly in that the material freight group was not limited accordingly. If the agreement is only valid for HMILCH anyway, then this information must be entered as well.
After correcting this error, we already get to the next stumbling block, because we get the next wrong value – agreement 8100000009. After all, we wanted a condition in which the means of transport is neither Z001 nor Z002.
The logic behind the conditions
In Figure “faulty condition”, dot 2 marks the error. However, it only becomes visible to the logic eye when you edit it.
If you change a value in a column and want to enter several values, these are always linked by a logical OR. But this also means exactly that: A logical OR is always true if one or both variable values are true. In logic, one likes to write logical operation tables to see when an expression is true or not true.
A logical OR is a disjunction, logical AND is a conjunction. We don’t have to discuss that the term “OR-connection” is simpler, but science is sometimes characterized by using as complicated terms as possible to say that actually everything is quite simple.
However, the picture illustrates the problem of our above condition quite well. It is valid that the means of transport “must not be equal to Z001 or not equal to Z002”. Visualized as a logic table, it also becomes visible where the problem lies if a means of transport is actually Z001 and why the condition is nevertheless fulfilled.
In the following representation the NOT is still represented as a column. The NOT means a reversal of the truth value. So if the means of transport is equal to Z001, then the expression “NOT Z001” is false. The result of an expression is then in the link column – here OR as a gray column. So from the white column the value in the yellow column is negated and the linkage from both yellow columns is in the gray column.
- If Z001 True, then NOT Z001 is False.
- If Z002 False, then NOT Z002 is True.
So if NOT Z001 is False OR NOT Z002 is True, then the expression is also True – because one of the two must be True for the whole expression to be True.
Now we have found the problem: If the means of transport is Z001, then yes, it is necessarily not Z002, thus satisfying the OR condition, and thus we find the wrong freight agreement 8100000008 – wrong because, after all, it is not supposed to be either Z001 or Z002.
Now how to prevent such a problem in the conditions? Logic comes into play here as well, in the form of “De Morgan’s rule”:
- not (a and b) is equivalent to ((not a) or (not b)), as well as not (a or b) is equivalent to ((not a) and (not b)).
In our example we want to cover exactly the latter rule: “Not Z001” and “Not Z002”. So the OR equivalent to this is “NOT (Z001 OR Z002)”. This means that instead of including an expression like “NOT Z001”, we simply need to exclude an expression like “Z001”. Because then the OR rule will work as desired.
The expression is only true if neither Z001 nor Z002 are set.
Implementing the solution
Now, to implement this solution, let’s remember the possibility of inserting excludes and includes. As already mentioned, this is done via a detour. First we select the “Direct value input”. Then we select Change and “Insert Exclude Condition”. This is awkward because the include condition is still there. But this will be deleted immediately. And then we see what we want to see: the desired “not”.
We add a second exclude condition and equip it with “is equal to” Z001 or “is equal to” Z002. Because we want to say: “not” (equal to Z001 or equal to Z002) – see Figure 13: Transformed logic table. So you have to think the other way round, because the “not” is outside the imaginary bracket.
Now the system also finds the correct agreement because no other condition applies to the freight order, namely 8100000023 and not 8100000009 as before. In the end we “only” applied a logic rule and created the new condition “not (Z001 or Z002)” from “not Z001 and not Z002” and built it into the condition configuration.
We are here for You!
With correctly set conditions, you can simplify many steps in SAP S/4HANA TM in the area of transportation processes, contracting or freight cost calculation. It is worthwhile to delve deeper into the topic of propositional logic. Did we spark your interest or do you have any questions? Please feel free to contact us at any time at firstname.lastname@example.org.
Senior Technical Consultant SAP Logistics
Great Flexibility for Your Transportation Processes with Conditions in SAP S/4HANA TM
Automation and flexibility in transportation management are essential, because manual processes cost time and time is money. More flexibility and automation with the Fiori Launchpad.
SAP S/4HANA Transportation Management: It won’t work without Business Partners!
SAP S/4HANA TM will replace the existing LE-TRA at the end of 2027. But what do companies need to consider when transferring master data from the “Business Partner”? Read more in the article.
#futureoflogistics: leogistics Points the Way to the Future of Logistics
What is the significance of technologies such as AI and machine learning in logistics? How can sustainable logistics work?
Standing Up To Digital Freight Forwarders
Digital freight forwarders are entering the transport order market. How can classic freight forwarders keep pace?
Solving Complex Planning Problems With The Help Of Machine Learning – A Practical Example
Machine learning can provide valuable assistance in solving almost unsolvable tasks – and thus increase the efficiency of many processes.
Container management: Do you still have all containers in stock?
Virtually nothing works in logistics without containers. With smart container management, the cycle can be controlled efficiently.
How to successfully migrate from SAP TM 9.5 to S/4HANA TM
You have decided to migrate from your SAP TM 9.5 system to SAP S/4HANA Transportation Management? But what happens next? What needs to be migrated in the first place? What tools and S/4HANA utilities are there and what do they cover? And what S/4HANA best practices exist?
SAP S/4HANA 2020 FPS01: Many New Features in Stock
However, FPS01 not only offers new possibilities for TM, but also on the other side of the warehouse gates we get a slew of interesting enhancements for EWM.
SAP S/4HANA 2020 FPS01: SAP TM and EWM Improve Interface Communication
What´s new in the SAP S/4HANA 2020 FPS01 release? (PART 1/2)
We have taken a look at the innovations and want to present the most interesting features such as “Advanced Shipping Receiving”.
Latest news and blog posts from the world of intelligent supply chain management.