Copyright © by Jeremy Meier A few years back, I was presented with a difficult dilemma - restricting multiple numeric ranges, dependant with character values. Normally, if it's simple enough you can just use constraints & "if statements" to get what you need - but this was really complicated - full of "or's, and's, in's and not's". Yuck. Out of the box SAP is no help to this. It doesn't support direct ranges (1-10) and specifying out 10 lines of nearly identical data is a maintenance nightmare. Variant tables are great as restricting to one value - but how can you restrict down the rules to a range of values with a variant table - without maintaining all the possible values? Problem: Restrict a menu with the following data ranges, using a variant table instead of a hard-coded constraint.
|Input Characteristic||Input Number Range Characteristic||Output Characteristic|
|A||1 - 100||000|
|A||100 - 200||A01|
|A||200 - 300||A02|
|A||300 - 500||A03|
|B||1 - 100||A04|
|B||100 - 500||A01|
|C||1 - 500||A05|
|C||500 - 600||A06|
|C||600 - 1000||A07|
|D||1 - 10||A08|
|E||10 - 1000||A08|
|F||100 - 300||A08|
|F||500 - 1000||A09|
|G||1 - 1000||A10|
Step 1: Build The Classification Structure Our first step is to build the classification structure consisting of the following characteristics & characteristic values:
|INPUT_CHAR||Character Based, Restrictable||A, B, C, D, E, F, & G|
|INPUT_NUMBER||Numeric Based, Restrictable||1 - 9999|
|CHAR_VALUE_TO_ASSIGN||Character Based, Restrictable||000, A01, A02, ... , A10|
|NUMBER_MIN_VALUE||Numeric Based, Restrictable||1 - 9999|
|NUMBER_MAX_VALUE||Numeric Based, Restrictable||1 - 9999|
After you attach your characteristics to your class, load a material & configuration profile your model should look something like this:
Step 2: Define Your Variant Table Structure This is the variant table structure I chose for this example:
Please notice the key fields that are selected. Normally, you wouldn't allow key fields to overlap, but this is one instance where I feel this is allowable. This method takes a great deal of restraint because the built in syntax/error checking in the variant table will not find issues.
Step 3: Populate Your Variant Table The variant table shown below is a representation of the data shown in the problem:
Again, you'll notice that this table will nearly always pass the syntax check because of the way the key values were structured. Great care in the maintenance of table of this nature must be taken to avoid configuration inconsistencies.
Step 4: Create Constraint Net, Constraints, & Attach to Configuration Profile OK. This is where the magic happens. The first constraint shown below is simple enough:
This constraint first makes the table restrictions. Second, it restricts the value of the input number to be greater than the minimum value for the range, but less than the maximum value. The final restriction is the opposite - making sure that the maximum is greater than the input number value, and the minimum value less than the input value. Now remember back to the problem. Instead of saying that the number ranges were 1 - 100 and 101 to 200, I stated that they were 1 - 100 and 100 - 200. This is the way engineering documented the problem, and it's probably easiest to always program to written documentation when possible, right? So, we need one more constraint:
What this says is if the input value falls on both a minimum for one line, and maximum for another, then it should always take the maximum value into consideration. If this were a spool for cable wire, it would take the smaller spool over the greater one if either spool could be used.
Editor's Comments: What you have just seen illustrated is a very simple example of how to use this technique. In my own case I had dozens ranges to restrict against, all based off that one numeric input value, and multiple different characteristics inputs (different INPUT_CHAR). None of ranges overlapped - in fact most conflicted - so it took 5 separate variant tables with as many as 500 lines to allow correct restriction in the configuration. I realize that many of my peers may question the way I used the table keys - but as I documented, to use the technique you need to be diligent and take great care in maintenance. This technique has saved my modelers hundreds of hours of maintenance and debugging, and I hope it works for you too. Please send comments to Jeremy Meier, at email@example.com.