cancel
Showing results for 
Search instead for 
Did you mean: 

How to add content to a decision table which already exists in BRFplus

former_member323788
Discoverer
0 Kudos

Hi guys,

If i want to add content to a decision table which already exists in BRFplus. what should i do?

For example, the id of decision table is FA163E1001DC1ED3BF8997A76884C553, and it already contains 4 rows, and here if i want to add the fifth rows, you can see the ABAP code below, but after executing, the fifth row still can not be added. so could you help me for this issue? maybe the way i do it is not correct.  Thank you very much!

DATA: lo_decision_table TYPE REF TO if_fdt_decision_table.

DATA: lt_table_data TYPE if_fdt_decision_table=>ts_row_data,
           ls_table_data TYPE if_fdt_decision_table=>s_row_data,
           lt_cell_table TYPE SORTED TABLE OF if_fdt_decision_table=>s_cell_data  WITH UNIQUE KEY col_no,
           ls_cell_table type if_fdt_decision_table=>s_cell_data,
           ls_range      type if_fdt_range=>s_range.
FIELD-SYMBOLS: <lv_value>         TYPE any.

lo_decision_table ?= cl_fdt_factory=>if_fdt_factory~get_instance( )->get_expression( EXPORTING iv_id = 'FA163E1001DC1ED3BF8997A76884C553'
                                                                                         ).
ls_table_data-row_no = 5.

ls_cell_table-col_no = 1.
ls_range-position = 1.
ls_range-sign     = if_fdt_range=>gc_sign_include.
ls_range-option   = if_fdt_range=>gc_option_equal.
CREATE DATA ls_range-r_low_value TYPE if_fdt_types=>element_text.
ASSIGN ls_range-r_low_value->* TO <lv_value>.
<lv_value> = 'P'.
INSERT ls_range INTO TABLE ls_cell_table-ts_range.
append ls_cell_table to lt_cell_table.
CLEAR ls_cell_table.

ls_cell_table-col_no = 2.
ls_range-position = 1.
ls_range-sign     = if_fdt_range=>gc_sign_include.
ls_range-option   = if_fdt_range=>gc_option_equal.
CREATE DATA ls_range-r_low_value TYPE if_fdt_types=>element_text.
ASSIGN ls_range-r_low_value->* TO <lv_value>.
<lv_value> = '>100'.
INSERT ls_range INTO TABLE ls_cell_table-ts_range.
append ls_cell_table to lt_cell_table.
CLEAR ls_cell_table.

ls_cell_table-col_no = 3.
ls_range-position = 1.
ls_range-sign     = if_fdt_range=>gc_sign_include.
ls_range-option   = if_fdt_range=>gc_option_equal.
CREATE DATA ls_cell_table-r_value TYPE if_fdt_types=>element_text.
ASSIGN ls_cell_table-r_value->* TO <lv_value>.
<lv_value> = '17'.
append ls_cell_table to lt_cell_table.
CLEAR ls_cell_table.

ls_table_data-ts_cell_data = lt_cell_table.

append ls_table_data to lt_table_data.

lo_decision_table->insert_rows( exporting iv_row_no = 5
                                           its_row_data = lt_table_data ).

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member323788
Discoverer
0 Kudos

Already resolve

juanluis_ramos
Explorer
0 Kudos

Hi Tingjun.

How you can resolve this.

How you can insert rows in a decision table?

regrads!

former_member323788
Discoverer
0 Kudos

Hi ,

After you inset the rows, you should activate and save it, like:

call method lo_decision_table->if_fdt_transaction~activate

   exporting

      iv_deep = abap_true.

call method lo_decision_table->if_fdt_transaction~save

     exporting

      iv_deep = abap_true.

juanluis_ramos
Explorer
0 Kudos

It Works!

Thank you very much Tingjun.