Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Like error msg in chain endchain, but in ALV

Hey experts,

I would like to do my own input check in ALV, I already made the input check, but I don't know how to highlight the current cell and block the alv while the wrong data is not changed to the correct one.

I want to achieve this

on the picture you can see the automatic input check because of the foreign key of that field. But I want to implement my own input check.

I already made data_change event handler, where I doing the input check, but I don't know to block the alv, while the user correct the input.

I already know how to add that Error Log and how to highlight the cell, but I still don't know how to block the alv to don't allow me save the data while I don't change the value of the cell.

if er_data_changed->mt_mod_cells is not INITIAL.

       loop at er_data_changed->mt_mod_cells into ls_cell.

         check ls_cell-fieldname eq 'ID_KNIZNICE'.

         check ls_cell-value is not initial.

         select SINGLE * from zbr_t_kniznice into wa_kniznica

           where id_kniznice eq ls_cell-value

           AND aktivne eq 'X'.

         if sy-subrc NE 0.


           " here somehow block it


       ENDLOOP.

endif.

Regards,

Robert

Former Member
replied

Hi,

See program BCALV_EDIT_03 .

Regards.

Before the save

data: gui_alv_grid_1 TYPE REF TO cl_gui_alv_grid.

CALL METHOD gui_alv_grid_1->check_changed_data

     IMPORTING

      e_valid = l_valid.

Also I do a full check of the data (I create my own cl_alv_changed_data_protocol )    

data: ob_alv_changed_data_protocol TYPE REF TO cl_alv_changed_data_protocol .

* create protocol handler
* Based on Include LCKMLDUVACTF02
    IF ob_alv_changed_data_protocol IS INITIAL.
      CREATE OBJECT ob_alv_changed_data_protocol
         EXPORTING
           i_calling_alv = gui_alv_grid_1.
      APPEND LINES OF it_fieldcatalog TO ob_alv_changed_data_protocol->mt_fieldcatalog.
    ELSE.
      CALL METHOD ob_alv_changed_data_protocol->refresh_protocol.
      CALL METHOD ob_alv_changed_data_protocol->free.
      CLEAR ob_alv_changed_data_protocol.
      CREATE OBJECT ob_alv_changed_data_protocol
         EXPORTING
           i_calling_alv = gui_alv_grid_1.
      APPEND LINES OF it_fieldcatalog TO ob_alv_changed_data_protocol->mt_fieldcatalog.
    ENDIF.

Regards.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question