Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to get the columns of a decision table

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.

Tags:
replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question