Hi Neha,
Following is code to hide FPM_GAF_COMPONENT toolbar buttons.
DATA lt_buttons TYPE if_fpm_cnr_gaf=>t_button.
DATA ls_buttons TYPE if_fpm_cnr_gaf=>s_button.
DATA lo_fpm TYPE REF TO if_fpm.
DATA lo_cnr_gaf TYPE REF TO if_fpm_cnr_gaf.
lo_fpm = cl_fpm_factory=>get_instance( ).
lo_cnr_gaf ?= lo_fpm->get_service( iv_service_key = cl_fpm_service_manager=>gc_key_cnr_gaf ).
lo_cnr_gaf->get_buttons(
EXPORTING
iv_variant_id = 'VARIANT_1' " Variant ID (current variant if skipped)
IMPORTING
et_buttons = lt_buttons " List of current buttons in the CNR toolbar
).
READ TABLE lt_buttons INTO ls_buttons WITH KEY on_action = 'TEST'.
lo_cnr_gaf->define_button(
EXPORTING
iv_variant_id = 'VARIANT_1' " Variant ID (current variant if skipped)
iv_function = 'OTHER_FUNCTIONS' " see Interface IF_FPM_CONSTANTS and attribute GC_BUTTON
iv_element_id = 'TEST_ID' " ID only for app-specific buttons, for later change
* iv_visibility = cl_wd_button=>e_visible-none " Web Dynpro: Visibility
iv_enabled = abap_false
).
RETURN.
PFB the snapshot for reference.Here i created test component by implementing the above code in ONTOGGLE event of check box.
Initial screen has button test.
Image may be NSFW.
Clik here to view.
on selecting the check box,test button will be disabled
Image may be NSFW.
Clik here to view.
Your requirement is otherway round.Hope this solves your issue.
Thanks
KH