Skip to Content
avatar image
Former Member

ALV OO display_protocol not working after 'forcing' a check_data_changed

Hi experts,

I'm having an issue with an OO editable ALV. I've had to add an option for the user to append lines to the ALV uploading an Excel file and I am having problems showing the protocol entry messages.

I have managed to force the flow to raise the event handle_data_changed once the new data is loaded in the ALV grid's content table and then I would need to check the uploaded data in order to show error messages if such errors occur. I'm adding the messages in the handle_data_changed method of my event receiver local class, via the method add_protocol_entry, and it seems to be doing it ok (at least I see no difference with how it is done when I add a new line manually to the ALV), but when the code addresses the display_protocol method nothing happens.

I forced the handle_data_changed event doing something like this in the PAI:

  data(lv_refresh) = abap_true.
  gr_grid->check_changed_data( importing e_valid   = data(lv_valid)
                                changing c_refresh = lv_refresh ).

  gr_grid->set_delta_cells( exporting it_delta_cells = lt_delta_cells
                                          i_modified = abap_true ).
 gr_grid->check_changed_data( importing e_valid   = lv_valid
                                changing c_refresh = lv_refresh ).

In the lt_delta_cells I populate the new data added via Excel upload.

Then, in my handle_data_method I check the data, add protocol messages where needed...

lr_data_changed->add_protocol_entry( exporting i_msgid = 'ZZZZ'
                                               i_msgty = 'E'
                                               i_msgno = '001'
                                              i_fieldname = 'FIELD' ).

... and finally, if mt_protocol contains something, I try to show the protocol messages:

lr_data_changed->display_protocol( ).

Also, on the layout definition for the ALV I am setting the following (not really sure if it's needed at all):

  cs_layout-val_data   = abap_true.

I'll appreciate any kind guidance with this.



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jul 04, 2017 at 10:56 AM


    I think it's called automagically if there are any entries in the error tables.

    Add comment
    10|10000 characters needed characters exceeded

    • This is how I force my grids to validate themselves:

      Method External_Validation_Check.
             Data: l_Valid Type Boolean.
      *      Validation checks triggered by a PAI from one of the 'report' buttons.
      *      Force the check by changing the GridModified property,  or the other
      *      grid....
             If i_UComm = Me->fc_Save.
                Me->Set_UComm( i_UComm ).
                Call Method Me->if_Cached_Prop~Set_Prop
                    PropName  = 'GridModified'
                    PropValue = '1'.
                     e_Valid = l_Valid ).
                l_Valid = Abap_True.
             e_Valid = l_Valid.
             Free: l_valid.

      And then I call the Save_Data method of the grid:

  • Jul 04, 2017 at 07:32 PM

    I can't be sure you have the same issue as I had, but calling the method ACTIVATE_DISPLAY_PROTOCOL( 'X' ) of CL_GUI_ALV_GRID, had solved the issue for me.

    Add comment
    10|10000 characters needed characters exceeded