cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP ABAP: How to make inactive a custom button on ALV Grid?

former_member611643
Participant
0 Likes
622

Hi, guys!

I've created ALV Grid for my data and added the custom button `&Save` on the ALV Grid toolbar.

Now I want to realise the logic when the user clicks on `&Save` the button should become inactive.

Would be grateful for useful advice or a step-by-step guide.

Here's my code for ALV and Button event:

DATA:
    lt_fieldcat  TYPE slis_t_fieldcat_alv,
    lt_sort      TYPE slis_t_sortinfo_alv,
    lt_excluding TYPE slis_t_extab.

DATA(ls_layout_alv) = VALUE slis_layout_alv( colwidth_optimize = abap_true
                                             zebra             = abap_true ).

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_grid_title             = CONV lvc_title( lv_grid_title )
        it_fieldcat              = lt_fieldcat
        it_sort                  = lt_sort
        i_callback_program       = sy-repid
        is_layout                = ls_layout_alv
        i_callback_pf_status_set = `PF_STATUS`
        i_callback_user_command  = `USER_COMMAND`
      TABLES
        t_outtab                 = gt_report_success
      EXCEPTIONS
        program_error            = 1
        OTHERS                   = 2.

FORM pf_status USING it_pf_status TYPE stt_fcode.
  SET PF-STATUS `Z_STATUS`.
ENDFORM.

FORM user_command USING r_ucomm     LIKE sy-ucomm
                        rs_selfield TYPE slis_selfield.
  CASE r_ucomm.
    WHEN `&SAVE`.
      " Here should be the code which makes button inactive after click
  ENDCASE.
ENDFORM.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member736527
Active Participant

You need to "exclude" the buttons that you want to hide, and pass it on to the ALV in IT_EXCLUDING parameter.

Below links can help you.

Disable a button on Application Toolbar of a screen

"Excluding" not working with PF status In ALV tool bar