cancel
Showing results for 
Search instead for 
Did you mean: 

How to read BRF+ decision table into an internal table in ABAP

jasper_blok
Participant
0 Kudos

Hello.

I need to get the complete content of a BRF+ decision table in an internal table in ABAP.

Is that possible?

Can someone show me some example code?

kind regards,

Jasper Blok

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jasper

You haven't provided any information about "why" you want to extract data from a Decision Table but I'll assume that you want to use BRFPlus to store the data for your rule(s) but pull the data into your ABAP and implement the logic for your rule(s) there?

What you're asking for is definitely possible but... (please excuse this quick sidetrack 🙂

BRFPlus is not just a *repository* to store the data for your rules, it's main purpose is to be used as a rules *engine* to process your rules and either answer a question or make a decision. The idea is that the "rule knowledge" (both rule data and rule logic) should be abstracted from your ABAP program so that it is more visible and (hopefully) easier to understand.

So instead of trying to pull data from a Decision Table, my suggestion is that you should be passing data from your ABAP code to a BRFPlus Function and asking it to give you the answer your code needs. Your code should only be interacting with the BRFPlus Function and should never know which type of Expression is being used to answer the question, otherwise it totally defeats the purpose of the abstraction. So, once your Function is defined correctly in BRFPlus and called from your ABAP code, you should be able to change the Expression type from a Decision Table to a Decision Tree or Value Range or any other type of Expression and not have to change a single line of ABAP code.

But back to your specific question...

If you do a where-used search on method GET_TABLE_DATA of class interface IF_FDT_DECISION_TABLE then you should find the example code you're looking for. But please notice that most (if not all) of this code just does administrative tasks on the data. None of the code that I have seen pulls the data from a Decision Table to use it in a business-related application

If you want to share more information about your business requirements and what decisions/questions you need answered in your ABAP code then this forum might be able to advise on the best way to implement it in BRFPlus (at a high level, at least).

Kind Regards

Glen

jasper_blok
Participant
0 Kudos

Hey Glen,

First of all thanks for taking the time to help me with my problem.

The 'why' of my question is this.

I want to use a decision table to help determine the approvers in a workflow.

The import for the decision table is GL account and cost center. In the situation the decision table does not return anything, we want to show the whole table to the user, who then has to make a manual decision on who should approve. To be able to show the decision table to the user i need it in an internal table in ABAP.

I did find the method GET_TABLE_DATA you mention. The problem i have now is that the table i get is build up off 3 columns.

ROW

COLUMN

GUID

Basicly that is a table with a GUID for all cells of the table. I have not been able to find the code to match that GUID to some class that can read that data.

For now however, I think that I may have a workaround.

Next to GL account and cost center i will build a column which will always contain an 'X'.

For a normal check of the decision table I will pass GL account, cost center and the 'X'-column.

When i dont get any results, i will query the table with only the 'X'-column, That should return all values in the table.

Still, if someone could show me how to read the table, i would be very grateful.

Strange thing is also that the class CL_FDT_CONVENIENCE does have all sorts of CREATE methods, but no GET methods.

Anyway, thanks again Glen.

Kind regards,

Jasper

kakshat
Advisor
Advisor
0 Kudos

Hi Jasper,

Sorry, I cannot give you a very good answer for this but whatever I can manage based on something I noticed recently. If you can get hold of the transport request for your BRF+ application, you should see some tables (perhaps, but not sure, starting with '/') in the object list. Some of these tables would be the corresponding DDIC tables for your decision tables. And, if you view their contents in SE11/SE16, you would see some meaningful data. Probably, from that, you can get an idea as to how to link those tables and get the table records.

Answers (2)

Answers (2)

kmoore007
Active Contributor
0 Kudos

Have a look at demo program FDT_DEMO_REPORT_DEC_TABLE_ADV.  After the START-OF-SELECTION, it has logic to read the entire decision table.

jasper_blok
Participant
0 Kudos

Ok, just to come back with the results.

I managed to get the whole table, the way to do this is by not passing any data in the context.

To be able to do that, the columns (GL account and cost center) in the table definition should be marked as 'optional'.

This resulted in the whole table being returned.

Thanks to all who participated. Case closed.

Regards,

Jasper

Former Member
0 Kudos

Hi Jasper

Sorry for requesting more info and then not getting back to you. I've been "offline" for a few days.

I'm glad to hear you were able to work this one out. All the best with it.

Regards

Glen

Former Member
0 Kudos

Hi Jasper,

I have a requirement to extract a BRF decision table and send the data to another system.

Can you elaborate on how you called the GET_TABLE_DATA method and include an example?

It would be very appreciated.

Regards,

Mark

0 Kudos

Bronze

Hi Jasper,

Can you please elaborate more how you were able to achieve the result as i need to get the values of decision table from BRF+ into some table. This table can be the return type from BRF+ or we need to do in code. Please explain.

Reagrds,

Abhishek

Jocelyn_Dart
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Abhishek, This post is 2 years old.  Please start a new discussion.

Rgds,

Jocelyn (with my moderator hat on)

kmoore007
Active Contributor
0 Kudos

Have a look at demo program FDT_DEMO_REPORT_DEC_TABLE_ADV.  After the START-OF-SELECTION, it has logic to read the entire decision table.