SAP MDG · UTILITIES
How do I read a BRF+ decision table in ABAP and map the result into a generic internal table?
Use CL_FDT_FACTORY to get the BRF+ object by ID, cast it to IF_FDT_DECISION_TABLE, read columns and rows at a timestamp, resolve each column’s technical name with CL_FDT_MAINTENANCE=>GET_ADMIN_DATA_DETAILS, then map each cell value dynamically into the matching component of the result structure.
Use CL_FDT_FACTORY to get the BRF+ object by ID, cast it to IF_FDT_DECISION_TABLE, read columns and rows at a timestamp, resolve each column’s technical name with CL_FDT_MAINTENANCE=>GET_ADMIN_DATA_DETAILS, then map each cell value dynamically into the matching component of the result structure.
The implementation shown in GET_DECISION_TABLE reads a BRF+ decision table by its ID, obtains the generic BRF+ instance, casts it to IF_FDT_DECISION_TABLE, and then reads both columns and rows at the same timestamp. Each column’s admin name is resolved with CL_FDT_MAINTENANCE=>GET_ADMIN_DATA_DETAILS, and the row cell content is copied dynamically into the corresponding component of the output row.
Process flow
- Capture timestamp with GET TIME STAMP FIELD.
- Call CL_FDT_FACTORY=>GET_INSTANCE_GENERIC using the decision table ID.
- Cast the instance to IF_FDT_DECISION_TABLE.
- Read metadata with GET_COLUMNS.
- Read content with GET_ROWS.
- Loop over row data and create output rows.
- Resolve each column name with CL_FDT_MAINTENANCE=>GET_ADMIN_DATA_DETAILS.
- Move single values or range low values into the matching structure component.
No SPRO or transaction-code configuration is shown in the retrieved source for this utility method.
Referenced tables
| Object | Purpose |
|---|---|
None explicitly accessed in GET_DECISION_TABLE | The method works on BRF+ runtime objects and dynamic ABAP structures rather than directly selecting from database tables. |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example
Exact relevant implementation excerpt from the knowledge document.
1METHOD get_decision_table.
2* *Read Decision Table
3
4
5 DATA:
6 lv_time_now TYPE if_fdt_types=>timestamp.
7
8 GET TIME STAMP FIELD lv_time_now.
9
10 cl_fdt_factory=>get_instance_generic(
11 EXPORTING
12 iv_id = iv_id
13 IMPORTING
14 eo_instance = DATA(lt_generic_ref)
15 ).
16
17 DATA(lt_decision_table) = CAST if_fdt_decision_table( lt_generic_ref ).
18
19 lt_decision_table->get_columns(
20 EXPORTING
21 iv_timestamp = lv_time_now
22 IMPORTING
23 ets_column = DATA(lt_columns)
24 ).
25
26 DATA(lv_col_count) = lines( lt_columns ).
27
28 lt_decision_table->get_rows(
29 EXPORTING
30 iv_timestamp = lv_time_now
31 IMPORTING
32 ets_row_data = DATA(lt_table_rows)
33 ).
34
35 LOOP AT lt_table_rows ASSIGNING FIELD-SYMBOL(<fs_row>).
36 APPEND INITIAL LINE TO et_table ASSIGNING FIELD-SYMBOL(<fs_result_row>).
37
38 LOOP AT lt_columns INTO DATA(ls_column). "#EC CI_NESTED
39 cl_fdt_maintenance=>get_admin_data_details(
40 EXPORTING
41 iv_id = ls_column-object_id
42 IMPORTING
43 ev_name = DATA(lv_col_name)
44 ).
45
46 TRY.
47 DATA(lv_cell) = <fs_row>-ts_cell_data[ ls_column-col_no ].
48 CATCH cx_sy_itab_line_not_found.
49 CONTINUE.
50 ENDTRY.
51
52 IF lv_cell-r_value IS BOUND.
53 DATA(lv_value_ref) = lv_cell-r_value.
54 ASSIGN lv_value_ref->* TO FIELD-SYMBOL(<fs_value>).
55 IF <fs_value> IS ASSIGNED.
56 ASSIGN COMPONENT lv_col_name OF STRUCTURE <fs_result_row> TO FIELD-SYMBOL(<fs_result_value>).
57 IF <fs_result_value> IS ASSIGNED.
58 <fs_result_value> = <fs_value>.
59 UNASSIGN <fs_result_value>.
60 ENDIF.
61 UNASSIGN <fs_value>.
62 ENDIF.
63
64 ELSEIF lv_cell-ts_range IS NOT INITIAL.
65 lv_value_ref = lv_cell-ts_range[ 1 ]-r_low_value.
66 ASSIGN lv_value_ref->* TO <fs_value>.
67 IF <fs_value> IS ASSIGNED.
68 ASSIGN COMPONENT lv_col_name OF STRUCTURE <fs_result_row> TO <fs_result_value>.
69 IF <fs_result_value> IS ASSIGNED.
70 <fs_result_value> = <fs_value>.
71 UNASSIGN <fs_result_value>.
72 ENDIF.
73 UNASSIGN <fs_value>.
74 ENDIF.
75 ENDIF.
76 ENDLOOP.
77 ENDLOOP.
78ENDMETHOD.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How can I implement GET_DECISION_TABLE in ABAP?
- How do I extract rows from a BRF+ decision table using CL_FDT_FACTORY?
- How do I convert BRF+ decision table output into an ABAP table?
Possible questions
- How do I read a BRF+ decision table in ABAP and map the result into a generic internal table?
- How can I implement GET_DECISION_TABLE in ABAP?
- How do I extract rows from a BRF+ decision table using CL_FDT_FACTORY?
- How do I convert BRF+ decision table output into an ABAP table?
- What classes are used to read a BRF+ decision table?