cancel
Showing results for 
Search instead for 
Did you mean: 

Removing "print version" button in alv

sivadm
Advisor
Advisor
0 Kudos

Hi Experts,

I am trying to hide the buttons in ALV table.

I did hide all other buttons except "Print Version".

Can anyone assist.

Thanks,

Siva.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

HI Sivasankar,

this is the code to disable it:

l_value->if_salv_wd_std_functions~set_pdf_allowed( abap_false ).

Regards,

Abdul

Answers (4)

Answers (4)

Former Member

Hi,

I think use this "'SALV_WD_EXPORT' to hide the print version

Use the below code -

***Reference to the standard button reference of the ALV
  DATA:
    ls_functions_std type SALV_WD_S_FUNCTION_STD_REF.

***Modifying The standard functionality buttons
 if lt_functions_std1 is not initial.
  loop at lt_functions_std1 into ls_functions_std.

    case ls_functions_std-id.

      when wd_assist->GC_APPEND_ROW.                           "'SALV_WD_INPUT_APPEND_ROW'
        CALL METHOD LS_FUNCTIONS_STD-R_FUNCTION->SET_VISIBLE
          EXPORTING
            VALUE = CL_WD_UIELEMENT=>E_VISIBLE-NONE.

      when wd_assist->GC_INPUT_DELETE.                         "'SALV_WD_INPUT_DELETE'
        CALL METHOD LS_FUNCTIONS_STD-R_FUNCTION->SET_VISIBLE
          EXPORTING
            VALUE = CL_WD_UIELEMENT=>E_VISIBLE-NONE.

      when wd_assist->GC_INSERT_ROW.                           "'SALV_WD_INPUT_INSERT_ROW'
        CALL METHOD LS_FUNCTIONS_STD-R_FUNCTION->SET_VISIBLE
          EXPORTING
            VALUE = CL_WD_UIELEMENT=>E_VISIBLE-NONE.

      when wd_assist->GC_EXPORT_EXCEL.                        "'SALV_WD_EXPORT_EXCEL'
        CALL METHOD LS_FUNCTIONS_STD-R_FUNCTION->SET_VISIBLE
          EXPORTING
            VALUE = CL_WD_UIELEMENT=>E_VISIBLE-NONE.

      when wd_assist->GC_PDF.                                     "'SALV_WD_PDF'
        CALL METHOD LS_FUNCTIONS_STD-R_FUNCTION->SET_VISIBLE
          EXPORTING
            VALUE = CL_WD_UIELEMENT=>E_VISIBLE-NONE.

      when wd_assist->GC_INPUT_CHECK.                            "'SALV_WD_INPUT_CHECK'
        CALL METHOD LS_FUNCTIONS_STD-R_FUNCTION->SET_VISIBLE
          EXPORTING
            VALUE = CL_WD_UIELEMENT=>E_VISIBLE-NONE.

      when wd_assist->GC_EXPORT.                                "'SALV_WD_EXPORT'
        CALL METHOD LS_FUNCTIONS_STD-R_FUNCTION->SET_VISIBLE
          EXPORTING
            VALUE = CL_WD_UIELEMENT=>E_VISIBLE-NONE.

      when wd_assist->GC_FILTER .                               "'SALV_WD_FILTER'
        CALL METHOD LS_FUNCTIONS_STD-R_FUNCTION->SET_VISIBLE
          EXPORTING
            VALUE = CL_WD_UIELEMENT=>E_VISIBLE-NONE.

      when wd_assist->GC_SETTINGS.                              "'SALV_WD_SETTINGS'
        CALL METHOD LS_FUNCTIONS_STD-R_FUNCTION->SET_VISIBLE
          EXPORTING
            VALUE = CL_WD_UIELEMENT=>E_VISIBLE-NONE.
    endcase.                     "Case ls_functions_std-id
    clear LS_FUNCTIONS_STD.
  endloop.                       "LOOP at lt_functions_std1 into ls_functions_std.
endif.                           "IF lt_functions_std1 is not initial.

Regards,

Lekha.

sivadm
Advisor
Advisor
0 Kudos

q

sivadm
Advisor
Advisor
0 Kudos

q

Former Member
0 Kudos

Check interface if_wd_std_functions, this has a wide range of toolbar functions. The fucntions that you want to disable/hide just set the value as false as follows :

* disable standard fucntions
lo_value->if_salv_wd_std_functions~set_pdf_allowed( abap_false ).

lo_value->if_salv_wd_std_functions~set_edit_check_available( abap_false ).
lo_value->if_salv_wd_std_functions~set_edit_insert_row_allowed( abap_false ).
lo_value->if_salv_wd_std_functions~set_edit_delete_row_allowed( abap_false ).
lo_value->if_salv_wd_std_functions~set_sort_headerclick_allowed( abap_false ).

Regards,

Radhika.

Former Member
0 Kudos

Hi,

Exactly where could i put this code to get it to work? Thanks

Samir

Former Member
0 Kudos

I would suggest WDDOINIT. Initialize your ALV in the WDDOINIT method and use th above provided lines of code to hide the required standard buttons.

Regards,

Radhika.

Former Member
0 Kudos

Thanks Radhika,

Could you please provide the code lines that i would need to initialise and also the type of lo_value?

Many thanks,

Edited by: Samir Vora on Jun 22, 2009 3:46 PM

Former Member
0 Kudos

Hi Samir,

You can use the code wizard to instantiate you ALV component.

Check this [https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1190424a-0801-0010-84b5-ef03fd2d33d9]

Page 7 and 8, instantiate the ALV and get model.

Regards,

Radhika.

Former Member
0 Kudos

Many Thanks Radhika

0 Kudos

Hi,

put the below codes in WDDOINIT of COMPONENTCONTROLLER

   DATA lo_cmp_usages TYPE REF TO if_wd_component_usage.

   DATA lo_interfacecontroller TYPE REF TO IWCI_SALV_WD_TABLE .

   DATA lv_value TYPE REF TO cl_salv_wd_config_table.

* Output is the Component Use deifined for component SALV_WD_TABLE

   lo_cmp_usages =   wd_this->wd_cpuse_output( ).   

   IF lo_cmp_usages->has_active_component( ) IS INITIAL.

     lo_cmp_usages->create_component( ).

   ENDIF.

   lo_interfacecontroller =   wd_this->wd_cpifc_output( ).

   lv_value = lo_interfacecontroller->get_model).

* Hide the Print Version from ALV Toolbar

   lv_value->if_salv_wd_std_functions~set_pdf_allowed( ABAP_False ).

Hope this will resolve your issue.

Regds

Pksurya