Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Disable a button

Former Member
0 Likes
412

I have a button in the application toolbar of the GUI status.I want to disable it and it should be enabled when a certain field in the database table is updated.Please suggest how can I do it.

2 REPLIES 2
Read only

Former Member
0 Likes
389

hello,

TO disable a button use the logic below


DATA: it_ucomm TYPE TABLE OF sy-ucomm.

AT SELECTION-SCREEN OUTPUT.
  APPEND :
    'PRIN' TO it_ucomm,  "for print
    'SPOS' TO it_ucomm,	 "for SAVE
    'ONLI' TO it_ucomm,  "for execute
    'E' TO it_ucomm,    "for back
    'ENDE' TO it_ucomm,  "for exit
    'ECAN' TO it_ucomm.  "for cancel
 
  CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
    EXPORTING
      p_status  = sy-pfkey
    TABLES
      p_exclude = it_ucomm.

Once the button is clicked, again the above logic can be altered to enable it again.

Regards,

Mansi.

Read only

Former Member
0 Likes
389

Hi,

You can disable a particular button in the GUI status by excluding that function code while setting the PF status.

Create a perform with name pf_stat_set and write this following code and pass this perform name to the parameter i_callback_pf_status_set of the ALV function module

FORM pf_stat_set USING extab TYPE slis_t_extab.

DATA: w_extab TYPE slis_extab.

w_extab-fcode = 'XXX'. "The function code of the button you want to exclude

APPEND w_extab TO extab.

SET PF-STATUS 'YYYY' EXCLUDING extab.

ENDFORM.

Thanks,

Sowmya