cancel
Showing results for 
Search instead for 
Did you mean: 

Initializing screen values using GET_DATA method gets cleared

Former Member
0 Kudos

In the enhancement Post-Method of CL_EHFND_FBI_GUIBB_FORM->get_data( )

method , I have code that initializes the FORM field QIM_ID to a specific value when the screen initially opens, by changing field in CS_DATA structure.

When the screen is initially opened, the field is initialized with the specified value.

However, if any event is executed on the screen, the GET_DATA method is executed and clears the initialization. Is there a structure in addition to CS_DATA that needs to be updated or synchronized?

Below is code used:

* If Incident 'Report Incident - Simplified' - QIM configuration

    if me->core_object->ms_uibb_key-config_id =

'ZEHHSS_INC_REC_QIM_FRM'.

      read table ct_field_usage into ls_field_usage with key name =

'QIM_ID'.

      lv_index = sy-tabix.

      ls_field_usage-read_only = abap_true.

      modify ct_field_usage from ls_field_usage index lv_index.

      ev_field_usage_changed = abap_true.

      if io_event->mv_event_id ne 'FPM_START' and

         io_event->mv_event_id ne 'FPM_LEAVE_INITIAL_SCREEN'.

        if me->core_object->mv_qim_update_flg is not initial.

          clear me->core_object->mv_qim_update_flg.

* Set QIM Issue ID

          if me->core_object->mv_qim_issue_id is not initial.

            assign component 'QIM_ID' of structure cs_data to

<lv_field>.

            <lv_field> = me->core_object->mv_qim_issue_id.

          endif.

          ev_data_changed = abap_true.

        endif.

      endif.

    endif.

  endmethod.                    "IPO_ZCL_EHFND_FBI_GUIBB_FORM~GET_DATA

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Got it to work by adding code to in GET_DATA to add changes to view instance change log:

if me->core_object->mv_qim_update_flg is not initial.

....

****Fill lt_change_log first with changes

****

   mo_view_inst->flush( changing ct_change_log = lt_change_log )

   ev_data_changed = abap_true

.

endif.

Former Member
0 Kudos

Hi Raynald,

Can you provide the code to fill in the lt_change_log ?

I'm having a hard time to find samples on that.

Thanks

Former Member
0 Kudos

Here is the code for those needing it:

     lt_change_log         TYPE /bofu/if_fbi_view_instance_new=>tt_change_log.

DATA:

     ls_change_log         TYPE /bofu/if_fbi_view_instance_new=>ts_change_log.

DATA:

     ls_changed_fields     TYPE /bofu/if_fbi_view_instance_new=>ts_changed_fields.

ASSIGN COMPONENT 'SALES_EXT_ORG_ID' OF STRUCTURE ls_data2 TO <newv>.

ASSIGN COMPONENT 'SALES_EXT_ORG_ID' OF STRUCTURE cs_data TO <oldv>.

       ls_changed_fields-name = 'SALES_EXT_ORG_ID'.

       GET REFERENCE OF <ls_data> INTO ls_change_log-ROW.

       GET REFERENCE OF <newv> INTO ls_changed_fields-new_value.

       GET REFERENCE OF <oldv> INTO ls_changed_fields-old_value.

       INSERT ls_changed_fields INTO TABLE ls_change_log-t_changed_fields.

     INSERT ls_change_log INTO TABLE lt_change_log.

      mo_view_inst->flush( changing ct_change_log = lt_change_log ).

     ev_data_changed = abap_true.

Answers (1)

Answers (1)

guillaume-hrc
Active Contributor
0 Kudos

Hi,

I'm not sure I get it right but... when do you set the MV_QIM_UPDATE_FLG to 'X'?

Indeed, you clear it the first time you get into your code:

        if me->core_object->mv_qim_update_flg is not initial.

          clear me->core_object->mv_qim_update_flg.

Then, you shall never come again in your 'blue' code.

Am I right?

Best regards,

Guillaume