cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the columns of a decision table

former_member210541
Active Participant
0 Kudos

Hello Experts,

I am new to BRF.

We have a requirement of creating decision tables programatically with the columns supplied in an excel.

Once the table is created the users will like to verify it by downloading the table structure in an excel.

I have checked the method IF_FDT_DECISION_TABLE-GET_COLUMNS but am not sure how to use it.

Please guide me on how to use it.

Accepted Solutions (1)

Accepted Solutions (1)

christianlechne
Active Contributor
0 Kudos

Hi Tanmoy,

concerning your original question: The method you have referenced is the right one. The workflow to get the structure of a decision table is:

  1. Get an instance of the BRFplus factory via:
    lo_factory = cl_fdt_factory=>if_fdt_factory~get_instance( ).
  2. Get an instance of the decision table via:
    lo_decision_table = lo_factory->get_expression( lv_id ).
    lv_id is the UUID of the decison table expression that you want to examine
  3. Now you have to call the method IF_FDT_DECISION_TABLE~GET_COLUMNS on the object you just instantiated
    This method returns you a table where each line represnets a column of your decision table. The line type is IF_FDT_DECISION_TABLE~S_COLUMN

The structure contains the following elements:

  • col_no (TYPE int4) - this is simply the number of the column
  • object_id (TYPE if_fdt_types=>id): this represents the UUID of the dataobject that is linked to the column of the decision table
  • is_result (TYPE is_result): this field states if it is a result column (= TRUE) or a condition column (= FALSE) in the decision table
  • is_optional (TYPE is_optional): this states if the field is optional
  • input_required (TYPE is_required): this states if a input in the field is required
  • ui_mode (TYPE if_fdt_types=>ui_mode): this field gives you insight in the UI-mode (hidden, display only, editable)
  • is_action (TYPE abap_bool): this field says if this is an action column

This way you have all information at hand to know the structure of the decision table simply by looping over the table and evaluating the information stored there.

One example of such an evaluation can be found in the class CL_FDT_DT_EXCEL Tobias already mentioned i. e. in the private method GET_FORMATTED_DT_COL that iterates over the table and fetches all the information on the columns (including a "dereferencing" of the data objects via their UUID)

Hope that helps

BR

Christian

former_member210541
Active Participant
0 Kudos

Thanks Christian.

Answers (1)

Answers (1)

ttrapp
Active Contributor
0 Kudos

You can download it with the BRFplus workbench manually and of upload it.

Best Regards,

Tobias

former_member210541
Active Participant
0 Kudos

Not all users will have access to brf plus tcode, so what we are looking for is to have an interface built where the user will enter the decision table name and download its structure(the columns) or/and the data.

ttrapp
Active Contributor
0 Kudos

Did you try method  CL_FDT_DT_EXCEL=>CREATE_EXCEL_FROM_DEC_TAB ?

But would do it using the SAP workbench;

  • put all decision tables in a catalog so that they can find the decision tables easily
  • restrict the access for the "download users" to the minimum they need to fulfill their tasks

Best Regards,

Tobias

former_member210541
Active Participant
0 Kudos

Yes I did try that and we are using it to download the table content, but did not get any solution to download the table structure(columns).