Mark checkboxes in ALV output grid as selected

前端 未结 1 1342
眼角桃花
眼角桃花 2021-01-13 22:13

I am creating an ALV output grid using class cl_gui_alv_grid. One of the columns of the output table is defined as a checkbox by using the corresponding record

相关标签:
1条回答
  • 2021-01-13 22:24

    If you want to set the checkbox according to initially shown data in the alv grid, just fill your outtab checkbox field with abap_true (='X') if condition is matched. If you would not use the checkbox parameter of the fieldcatalog you would just see 'X' for checked and ' ' for not checked.

    If you want to set the checkbox according to user input, after they edited some fields in the alv grid, use the following alv grid events to change outtab:

    METHODS:
          handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
            IMPORTING er_data_changed,
    
          handle_data_changed_finished FOR EVENT data_changed_finished OF cl_gui_alv_grid, "executed only if no errors, outtab holds changed data
    

    I also found some comments I made, when I had to deal with these events

    *&---------------------------------------------------------------------*
    *&      Method  handle_data_changed
    *&---------------------------------------------------------------------*
    *      raised when at least one cell is modified in the ALV
    *     - modified entries are not stored in gt_outtab yet, but er_data_changed object
    *     - mt_good_cells holds every changed field thats valid according to type declaration
    *----------------------------------------------------------------------*
    *&---------------------------------------------------------------------*
    *&      Method  handle_data_changed_finished
    *&---------------------------------------------------------------------*
    *      - raised when data validation is valid
    *      - NOW outtab holds valid changed data
    *----------------------------------------------------------------------*
    
    0 讨论(0)
提交回复
热议问题