Skip to Content

Using a Structure data-object as the result of a Search Tree

Hello,

I am modelling a BRF+ "Search Tree" for calculating the BuPa credit worthiness.

The algorithm looks something like this:

  • Check1: If true, RESULT-RATING = 'A1' + RESULT-SOURCE = 'Check1' ; ELSE
  • Check2: If true, RESULT-RATING = 'A2' + RESULT-SOURCE = 'Check2' ; ELSE
  • ...
  • Checkn --> If true, RESULT-RATING = 'An' + RESULT-SOURCE = 'Checkn' ; ELSE
  • Default rating

Basically the structure contains the credit-worthiness score and additional details of the check.

I am not sure how to populate the structure :(

Is there any built-in BRF+ expression which can do the structure mapping? (similar to the mapping done in procedure call)?

Any pointers will be appreciated.

BR,

Suhas

Add comment
10|10000 characters needed characters exceeded

  • There is no direct way to map the structure fields in BRF+.

    But as Mike Pokraka has pointed out, if the number of conditions are finite(read: can be managed manually) then one can use decision tables to fill a structure. The columns of the result structure then become the "result columns" of the decision table.

    In my case, the credit-worthiness score needed to be saved in the DB. Therefore i defined the result the "Search Tree" as actions(instead of variables). In the action called an "ABAP Procedure" to update the DB.

  • Get RSS Feed

1 Answer

  • Best Answer
    Aug 02, 2017 at 12:28 PM

    Search trees allow for dynamic conditions but have rigid results. Decision tables do the opposite - the search criteria are fixed but results can be highly flexible. As I understand, you want a combination of both.

    I would implement this as two expressions in a ruleset with local context data. The search tree provides the result and passes it on to a decision table which populates the returning expression in the format you need.

    Add comment
    10|10000 characters needed characters exceeded

    • I agree, and another way to differentiate is that ABAP calls are useful to push technical logic into the ABAP layer, which sounds exactly like what you're doing.

      "isn't there an expression to map a structure?" -> No, that's what I suggested to use a decision table for. It will work well if it's a finite number of entries (and not too many). It could be a candidate for a custom expression type, or perhaps implemented as a BRF+ function. But then I don't see too many use cases.

      Is there a reason you can't return a structure from your expressions to start with? Perhaps using a decision tree instead of a search tree? Or how about slicing your rule in other ways? e.g. If it's returning a category and a set of values, then perform the category determination in a tree and do the value calculation(s) in a decision table.

      I don't know your scenario, so these are just a few ideas...