cancel
Showing results for 
Search instead for 
Did you mean: 

Matrix-style expressions

pokrakam
Active Contributor
0 Kudos

Hi,

What is the best way to represent a rule based on a matrix of values?

Example: I have a plant and want my rule to return one or more categories.

Plant 1000: categories A, B

Plant 2000: categories A, C, D

Plant 3000: categories B, C, D

Unfortunately a decision table only permits a single elementary result per row, so the above cannot be implemented directly. So I end up having to create a multiple-result decision table containing:

1000: A

1000: B

2000: A

2000: C

...and so on, with 8 entries in total.

This works, but with larger datasets and multiple condition columns it becomes cumbersome to maintain, even with Excel.

If a "Matrix" expression type existed, it would look like this:

Category >>

vv Plant

ABCD
1000XX
2000XXX
3000XXX

And it would be dead easy to manage. Unfortunately, it doesn't exist.

One alternative would be to invert the logic to specify one entry for each category:

Plants 1000, 2000: Category A

Plants 1000, 3000: Category B

Technically feasible, but impractical to maintain because from the business point of view it's the wrong perspective.

Is there a more elegant way than a long multi-result table to achieve this?

Thanks,

Mike

Accepted Solutions (1)

Accepted Solutions (1)

christianlechne
Active Contributor
0 Kudos

Hi Mike,

perhaps I misunderstand your question: But it is possible to assign several result columns in one row:

Do you mean something different?

BR

Christian

pokrakam
Active Contributor
0 Kudos

Hi Christian,

sort of, it's actually a variable number of results of the same type, so using multiple result columns means we'd have to define columns R1, R2, R3 ...  R5 (or some reasonable maximum), and would then need to combine those back into a table, which is also a bit clumsy.

I suppose the problem can be split in two:

General: At a general level, the business would like to maintain multiple results in a single entry

Matrix: At a more specialised level, if the results are chosen from a small fixed set of possible values (such as categories), a matrix makes great sense. This is what I described in my first post. Calling a rule with plant 2000 would return a table of categories containing A, C, D.

Here's another real world use case of the general variant:

In workflow, we often need to assign who does something based on criteria X.

Company code 1000 -> users BATMAN and SPIDERMAN

Company code 2000 -> HOMERSIMPSON

...

I need to do:

Here's a quick mockup of what would be much nicer:

While it may seem trivial, it can cut what is currently a 500 row SM30 table down to a more manageable 100-200 lines.

The technical underpinnings are there, because you can create entry lists in conditions, just not in results.

Thanks & regards,

Mike

kakshat
Advisor
Advisor
0 Kudos

Hi Mike,

Just like you show in the mock-up, it is possible, in a BRF+ decision table, to maintain multiple values in a single result column (of type string) separated by a separator. Of course, then you would need to implement some logic to separate those values before consuming them (and this should be pretty simple using the SPLIT statement if they have to be directly consumed in ABAP without any preceding processing within BRF+).

Akshat

pokrakam
Active Contributor
0 Kudos

Hi Akshat,

Have already considered that and decided it's a bad idea. You lose all field validations and lookup functionality, so we're still better off having a multi-line dataset.

Thanks & regards,

Mike

christianlechne
Active Contributor
0 Kudos

Hi Mike,

thanks for the clarification.

The "limitation" you described is as it is in BRFplus.

What maybe an approach depends on how the data is entered into the table. I do not know if your data is directly entered into BRFplus or your business users prefer the data entry into Excel.

What may be an option is to let the users enter the data into the Excel (in the prefered way that you described) and consequently offer an alternative Excel upload to BRFplus that transforms the data from the Excel format into a decision table format. This way you can perform validity checks concerning ranges etc.during upload and offer a kind of decent data entry.

The down side is you have to implement it and you have to decide how to distribute the entries to the decision table (e. g. several result columns and single match mode vs. single result columns but several rows and multiple match mode). For sure not a perfect solution but maybe something to think about.

BR

Christian

pokrakam
Active Contributor
0 Kudos

Hi Christian,

Thanks for confirming. I thought as much, but figured it's worth a post on here to see if I missed a hidden trick or feature.

The excel conversion alternative is certainly feasible, but I think more work compared to just having multiple result columns that can be maintained directly.

For what it's worth, my 'workarounds' for managing many repetitive entries:

  • Recommend to the business are to do a pivot table in Excel to validate the completeness of the data.
  • Create expressions to group results that frequently occur together (e.g. SUPERHEROES returns BATMAN and SPIDERMAN), and insert those into the result. Of course this depends entirely on the amount and consistency of repetition in the business data.

Regards,

Mike

Answers (0)