Skip to Content
0

BRF Plus DDIC binding refresh

Jan 15 at 03:19 PM

158

avatar image

Hello All,

Requirement : I have a Decision table with DDIC structure as result data object. I would like to add new fields to the structure + refresh the binding at the same time during execution.

I am able to add new fields to DDIC structure but method SET_DDIC_BINDING is not refreshing the binding. Any hints to achieve the binding refresh.

P.S: I have found couple of threads with same problem but were not answered.

Thanks,

Mohammad

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Mohammad Rizwan Jan 24 at 02:01 PM
0

As Christian said, there was an issue from my side..Refreshing binding using APIs is very simple and straight forward..

DATA :lo_fdt_structure TYPE REF TO cl_fdt_structure,
      lt_dd03p         TYPE STANDARD TABLE OF dd03p.

*--Step 1: Get Instance using Application ID
DATA(lo_fdt_factory) = cl_fdt_factory=>if_fdt_factory~get_instance( '0050568B37E21ED7BC82ACD66B077540' ).

TRY.
*--Step 2: Get Instance using Result Structure ID
    DATA(lo_data_object) = lo_fdt_factory->get_data_object( 
                                        EXPORTING iv_id          = '0050568B37E21ED7BC8322C9555AB5E3'
                                                  iv_data_object_type = if_fdt_constants=>gc_data_object_type_structure ).
  CATCH cx_fdt_input INTO DATA(lo_fdt_input).
ENDTRY.

lo_fdt_structure ?= lo_data_object.

*--Step 3: Get the DDIC structure bound to Result structure
TRY.
    DATA(l_ddic_binding) = lo_fdt_structure->if_fdt_data_object~get_ddic_binding( ).
  CATCH cx_fdt_input INTO lo_fdt_input.
ENDTRY.

*--Step 4: Change the DDIC structure
CALL FUNCTION 'DDIF_TABL_GET'
  EXPORTING
    name      = CONV ddobjname( l_ddic_binding )
  TABLES
    dd03p_tab = lt_dd03p.

APPEND INITIAL LINE TO lt_dd03p ASSIGNING FIELD-SYMBOL(<fs_dd03p>).
<fs_dd03p>-tabname   = 'ZCOE_RESULT_STRUCTURE'.
<fs_dd03p>-fieldname = 'RESULT4'.
<fs_dd03p>-position  = '0004'.
<fs_dd03p>-rollname  = 'CHAR10'.
<fs_dd03p>-domname   = 'CHAR10'.

CALL FUNCTION 'DDIF_TABL_PUT'
  EXPORTING
    name      = CONV ddobjname( l_ddic_binding )
  TABLES
    dd03p_tab = lt_dd03p.
COMMIT WORK.
CALL FUNCTION 'DDIF_TABL_ACTIVATE'
  EXPORTING
    name     = CONV ddobjname( l_ddic_binding )
    excommit = 'X'.

CALL FUNCTION 'DB_COMMIT'.

*--Step 5: Refresh the Result Structure binding
TRY.
    lo_fdt_structure->if_fdt_data_object~set_ddic_binding( EXPORTING iv_ddic_typename = l_ddic_binding
                                                           IMPORTING ets_object_id    = DATA(lt_fresh_list) ).
  CATCH cx_fdt_input INTO lo_fdt_input.
ENDTRY.
Share
10 |10000 characters needed characters left characters exceeded
Christian Lechner
Jan 16 at 10:44 AM
1

Hi Mohammed,

can you please check if the system recognizes that the DDIC binding is not up-to-date? You can do that by calling the method IS_BINDING_UP_TO_DATE of the class CL_FDT_STRUCTURE (as you are dealing with a structure, right?)

If this method states that the binding is up to date, you have to debug why this is the case

If the method states that the binding is not up to date, I am afraid that you have to debug into the method DERIVE_DATA_OBJECT_INTERNAL of CL_FDT_STRUCTURE.

Cheers,

Christian

Show 4 Share
10 |10000 characters needed characters left characters exceeded

Hello Christian,

I have debugged the method DERIVE_DATA_OBJECT_INTERNAL and found that data is being retrieved from buffer. For instance, elements in the structure are retrieved from below method:

IF iv_rebind EQ abap_true. Line 56 of method DERIVE_DATA_OBJECT in CL_FDT_STRUCTRUE
   lts_element = if_fdt_structure~get_elements(  ).

Even if structure has changes, this method retrieves the data in the buffer.

Thanks,

Mohammad

0

Hi Mohammed,

the fetch from the buffer is okay, as this refers to the existing/current structure in BRFplus and not to the updated DDIC structure. The information about the DDIC structure is located in the reference

lo_structdescr->mt_structure_component

Here you should find the new fields.

I just tried it with the report FDT_DDIC_BINDING_UP_TO_DATE and the refresh worked for me.

So to narrow down the problem:

  • Does the report recognize the change of the DDIC structure?
  • Can you update the binding via the report successfully?
  • When you debug your code, does the above-mentioned reference contain the new fields?

Best regards

Christian

1

Hi Christian,

Even the table you mentioned is filled in below method from buffer table GT_BUFFER If data related to specific type already exists.

      eo_typedescr = cl_fdt_typedescr=>describe_by_name( iv_id       = mv_id
                                                         iv_typename = lv_typename ).

Report FDT_DDIC_BINDING_UP_TO_DATE worked for me also.

Thanks,

Mohammad

0

Hi Mohammad,

if the report works (updates the DDIC binding) there must be a deviation between your code and the one of the report. So some debugging from your side is necessary to find that out.

Best regards,

Christian

1
Mike Pokraka Jan 15 at 04:39 PM
0

Not sure I understand the problem. This is not possible at the same time. Go to your structure and click on refresh binding, this should add the new fields. Save, activate, and go to your DT and it should have the new fields available in your results column.

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Thanks Mike, Let me be clear..

  • Refresh Binding from BRF+ workbench is triggering the method SET_DDIC_BINDING to update the structure with all the changes from DDIC structure.
  • Report FDT_DDIC_BINDING_UP_TO_DATE is also triggering the same method

I have changed the DDIC structure (added new fields) which was bound to my BRF+ data object and then tried to call the same method but it was not refreshing the binding.

0

OK, you're trying to do it programatically, the question makes more sense now. I have not had the need to change DDIC bindings from code so can't say from experience, but it should work as you describe. Just to ask the obvious, are you doing a commit at the end?

I would test it with a simple standalone example, and if that doesn't work then raise a message with support.

0

Yes of course, I am committing..

0