Remove standard button in ALV LIKE APPEND/INSERT/DELETE
Hi Expert,
I have a requirement in which we do not need APPEND/INSERT/DELETE button in ALV,Can you please tell how i can remove that.
Pleaae suggest.
Thanks
Mahesh
Check this
data lo_cmp_usage type ref to if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_alv1( ). " alv1 is my used alv component
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
data lo_interfacecontroller type ref to iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_alv1( ).
data lo_value type ref to cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model( ).
data: lr_std type ref to if_salv_wd_std_functions.
lr_std ?= lo_value.
lr_std->SET_EDIT_APPEND_ROW_ALLOWED( abap_false ).
lr_std->SET_EDIT_DELETE_ROW_ALLOWED( abap_false ).
lr_std->SET_EDIT_INSERT_ROW_ALLOWED( abap_false ).
Regards
Srinivas
Similar Messages
-
How to remove the the standard button APPEND/INSERT/DELETE in webdynpro alv
Hello,
how to remove the the standard button APPEND/INSERT/DELETE in webdynpro-abap alv
Thanks
RaksharUse this.
data lo_cmp_usage type ref to if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_alv1( ).
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
data lo_interfacecontroller type ref to iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_alv1( ).
data lo_value type ref to cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model(
data: lr_std type ref to if_salv_wd_std_functions.
lr_std ?= lo_value.
lr_std->set_export_allowed( abap_false ).
NOte: ALV1 is alv component name
Regards
Srinivas
Edited by: sanasrinivas on Dec 1, 2011 6:11 AM -
Disable some standard buttons from ALV display
Hello All,
I am creating an ALV display using object oriented approach. I know how to exclude some of the standard function buttons from the list.
But suppose instead of deleting, the requirement is to disable (I mean grayed out)
some standard buttons from ALV. Could anyone please comment on how to do this.
Many thanks in advance.
Regards
IndrajitHello Indrajit
The following sample reports shows how to disable toolbar functions. Run the report and the push the ENTER button repeatedly.
*& Report ZUS_SDN_ALV_EVT_TOOLBAR
*& This sample report explains the handling of event TOOLBAR in order
*% to activate or inactive buttons of the ALV toolbar.
*& Based on: BCALV_GRID_DEMO
*& Procedure: Copy BCALV_GRID_DEMO and replace entire coding OR
copy screen '0100' and GUI status 'MAIN100' from
BCALV_GRID_DEMO to this report.
REPORT zus_sdn_alv_evt_toolbar.
TYPE-POOLS: abap, cntb, icon.
DATA:
ok_code TYPE ui_func,
gt_sflight TYPE TABLE OF sflight,
g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
g_grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container.
PARAMETERS:
p_inact RADIOBUTTON GROUP grp1 DEFAULT 'X', " delete buttons
p_dele RADIOBUTTON GROUP grp1. " inactivate buttons
PARAMETERS:
p_newbut AS CHECKBOX DEFAULT ' ', " add new button
p_newddm AS CHECKBOX DEFAULT 'X'. " add dropdown menu
CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
md_cnt TYPE i.
CLASS-METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object
e_interactive
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_toolbar.
§ 2.In event handler method for event TOOLBAR: Append own functions
by using event parameter E_OBJECT.
DATA:
ls_toolbar TYPE stb_button,
ls_menu type STB_BTNMNU.
E_OBJECT of event TOOLBAR is of type REF TO CL_ALV_EVENT_TOOLBAR_SET.
This class has got one attribute, namly MT_TOOLBAR, which
is a table of type TTB_BUTTON. One line of this table is
defined by the Structure STB_BUTTON (see data deklaration above).
A remark to the flag E_INTERACTIVE:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'e_interactive' is set, if this event is raised due to
the call of 'set_toolbar_interactive' by the user.
You can distinguish this way if the event was raised
by yourself or by ALV
(e.g. in method 'refresh_table_display').
An application of this feature is still unknown...
ADD 1 TO md_cnt. " a simple counter
(1.a) Inactivate toolbar buttons
IF ( p_inact = abap_true ).
LOOP AT e_object->mt_toolbar INTO ls_toolbar FROM 1 TO md_cnt.
ls_toolbar-disabled = 'X'.
MODIFY e_object->mt_toolbar FROM ls_toolbar.
ENDLOOP.
(1.b) Delete toolbar buttons
ELSE.
DO md_cnt TIMES.
DELETE e_object->mt_toolbar INDEX 1.
ENDDO.
ENDIF.
(2) Add new button
IF ( p_newbut = abap_true ).
Add separator to separate default and new buttons
CLEAR: ls_toolbar.
ls_toolbar-butn_type = cntb_btype_sep. " separator
APPEND ls_toolbar TO e_object->mt_toolbar.
Add new button "DETAIL"
CLEAR: ls_toolbar.
ls_toolbar-function = 'DETAIL'.
ls_toolbar-icon = icon_detail.
ls_toolbar-quickinfo = 'QuickInfo'.
ls_toolbar-butn_type = cntb_btype_button.
ls_toolbar-disabled = abap_false.
ls_toolbar-text = 'Details'.
ls_toolbar-checked = ' '.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDIF.
(3) Add new dropdown menu
IF ( p_newddm = abap_true ).
Add separator to separate default and new buttons
CLEAR: ls_toolbar.
ls_toolbar-butn_type = cntb_btype_sep. " separator
APPEND ls_toolbar TO e_object->mt_toolbar.
Add new dropdown menu "DETAIL"
CLEAR: ls_toolbar.
ls_toolbar-function = 'DDMENU'.
ls_toolbar-icon = icon_detail.
ls_toolbar-quickinfo = 'QuickInfo'.
ls_toolbar-butn_type = cntb_btype_dropdown.
ls_toolbar-disabled = abap_false.
ls_toolbar-text = 'DD-Menu'.
ls_toolbar-checked = ' '.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDIF.
ENDMETHOD. "handle_toolbar
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
MAIN *
SELECT * FROM sflight INTO TABLE gt_sflight.
CALL SCREEN 100.
END-OF-SELECTION.
MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
Instantiate ALV grid control
CREATE OBJECT g_grid1
EXPORTING i_parent = g_custom_container.
CALL METHOD g_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
it_outtab = gt_sflight.
Set event handler for event TOOLBAR
SET HANDLER:
lcl_eventhandler=>handle_toolbar FOR g_grid1.
ENDIF.
$Comment: Toolbar can be modified on-the-fly
g_grid1->set_toolbar_interactive( ).
ENDMODULE. "PBO OUTPUT
MODULE PAI INPUT *
MODULE pai INPUT.
to react on oi_custom_events:
CALL METHOD cl_gui_cfw=>dispatch.
CASE ok_code.
WHEN 'EXIT'.
PERFORM exit_program.
WHEN OTHERS.
do nothing
ENDCASE.
CLEAR ok_code.
ENDMODULE. "PAI INPUT
FORM EXIT_PROGRAM *
FORM exit_program.
CALL METHOD G_CUSTOM_CONTAINER->FREE.
CALL METHOD CL_GUI_CFW=>FLUSH.
LEAVE PROGRAM.
ENDFORM. "EXIT_PROGRAM[/code]
Regards
Uwe -
Message on clicks on standard button of alv in webdynpro
Hi experts,
I want to show message on clicks on standard button of alv in webdynpro.Hi Rohit..
Also check this...
http://wiki.sdn.sap.com/wiki/display/Snippets/WebDynproABAP-ALVControllingStandard+Buttons
Cheers,
Kris. -
How to remove the buttons in ALV GUI?
Hi All,
I am using the FM REUSE_ALV_GRID_DISPLAY for disaplying the ALV grid. i need how to remove these buttons ( mail word processing, loal file, Mail recipient, ABC analysis, Microsoft Execl and Graphics ) from the ALV Gui?
please give solution.
Regards,
Santhahi,
IT_EXCLUDING TYPE SLIS_T_EXTAB OPTIONAL
you need to append the Fucntion codes to the it_exclude and then pass it to the parameter it_excluding.
append '&ABC' to it_excluding.
append '&BAC' to it_excluding.
call function 'REUSE_ALV_GRID_DISPLAY'
IT_EXCLUDING = it_exlcuding
Regards
Anver -
Hi all,
I need to change the text to the standard button "Export" in ALV for the text "Excel" and assing only one function to this button, the function I need is export to excel.
Does anyone knows how to solve this problem please?
Help is really appreciated.
Regards!In your first post you asked about ALV and now about non-ALV...
So about ALV you have the Excel download by default and you are able to change the text.
About non-ALV download I think you have to use the method: cl_wd_runtime_services=>attach_file_to_response.
Look at the last post in:
File download WD4A
Sergio -
How to remove standard buttons on Custom Control?
Hi ABAPers,
How to remove the standard buttons that are appear on custom control and also how to remove the description of line column details.
Because in my requirement I have to create one custom infotype in which I have to add four custom controllers. In record creation it displaying that buttons and line description. So I want to remove those buttons and line descriptions.
Could you please give me the solution for this?
Thanks in advance,
Regards,
kishoreHi Deepak,
CALL METHOD G_EDITOR1->SET_TOOLBAR_MODE
EXPORTING
TOOLBAR_MODE = 0
EXCEPTIONS
ERROR_CNTL_CALL_METHOD = 1
INVALID_PARAMETER = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Kishore. -
Inactive standard buttons in ALV
Hi Experts,
I had requirement to inactive some buttons in standard alv. For Example, sorting buttons,download to excel should be made inactive. Please provide your solutions to solve the issue.
Thanks and Regards,
BharatHi!
You can try this:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = wa_fcat[]
i_grid_title = gv_title
i_callback_program = sy-repid
i_callback_pf_status_set = 'SET_STATUS'
is_layout = gd_layout
TABLES
t_outtab = it_screen.
FORM set_status USING i_it_excluding TYPE slis_t_extab.
SET PF-STATUS 'z001' EXCLUDING x1 x2.
ENDFORM. " SET_STATUS
thanks,
Raul Natu -
Debugging standard button code in ALV
Hi All,
I would like to debug the "Export" button that is available on tool bar.Is it possibe? If yes, pls suggest.
Thank You,
Suresh.Hi Suresh,
On the View in Which the alv is displaying, go to methods, create a new method , type event handler, then select from drop down on standard_button_click. then put a debugger on the method and run the application. then after wards on click or select of any standard button on alv will trigger the method.from the parameters of the method you can check the button clicked and its properties.
Regards
Sarath -
How to remove a Sort button from ALV List
Hi Experts,
How to remove sort button from ALV List.
I have requirement where I need to remove the sort button from ALV list.
Kindly give me useful clues.
Higher points will be awarded for the useful inputs.
Thanks in Advance,
DharaniHi dharani,
1. UP and Down Sort Button will get removed.
2. Important code is marked in bold
3. Just copy paste.
4.
report abc.
TYPE-POOLS : slis.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvfcwa TYPE slis_fieldcat_alv.
<b>data : excl type SLIS_T_EXTAB.
data : exclwa type SLIS_EXTAB.</b>
data : begin of itab occurs 0.
include structure usr02.
data : end of itab.
START-OF-SELECTION.
select * from usr02
into table itab.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
<b>*----
IMPORTANT
fcodes to remove
Up and Down Sort Button
exclwa-fcode = '&OUP'.
append exclwa to excl.
exclwa-fcode = '&ODN'.
append exclwa to excl.</b>
Display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
<b>IT_EXCLUDING = excl</b>
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
regards,
amit m. -
Disable delete button in ALV grid
Hi Experts,
I have a functionality to disable some buttons in alv grid such as delete row,cut,print etc.
I know how to exclude them by using it_toolbar_excluding , but I need to disable them.
Can you please let me know how to handle this.
I am displaying the ALV grid by calling the method set_table_for_first_display.
Thanks in Advance
PrasanthHi,
By using below code you can disable any button in ALV display
data : tool_wa_exclude type ui_func.
tool_wa_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
append tool_wa_exclude to tool_it_exclude .
call method grid2->set_table_for_first_display
exporting
it_toolbar_excluding = tool_it_exclude
changing
it_outtab = it_ekpo
it_fieldcatalog = it_fcat
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4.
U need to pass tool_it_exclude internal table to method for displaying -
Hide 'Change Layout' button from alv toolbar
Hello All,
can anyone let me know how can we hide the change layout button or exclude the change layout button from the ALV tool bar using OOPS . what's the fcode for it.
Thank You !
RaviHi Ravi,
Please refer to this [Program|http://www.saptechies.com/disable-some-standard-buttons-from-alv-display/].
Hope this helps.
Regards,
Chandravadan -
Adding custom button in standard toolbar in ALV
Hello All,
I need to add a customized button called "Copy" on ALV. The following code is giving me few standard buttons like "Append" "Delete" "Insert" etc. So, how can I add "Copy" button besides one of these standard buttons.
data: l_value type ref to cl_salv_wd_config_table.
data: lr_table_settings type ref to if_salv_wd_table_settings.
lr_table_settings ?= l_value.
lr_table_settings->set_read_only( abap_false ).
Appreciate help.
Thks & Rgds,
HemalCreate One method
And inside that method write the below code
(Here i am creating delete button you can create any name button you want just replace the name
DATA lV_EDITBTN TYPE REF TO cl_salv_wd_fe_button.
DATA lr_buttonui TYPE REF TO cl_salv_wd_fe_button.
CREATE OBJECT lr_buttonui.
lr_buttonui->set_text( 'Details' ).
lr_buttonui->set_tooltip(
'Shows Detail Screen as per the View selected' ).
Generating Function Object for Button.*
DATA btn_button TYPE REF TO cl_salv_wd_function.
btn_button = lo_value->if_salv_wd_function_settings~create_function(
id = 'DETAILS' ).
btn_button->set_editor( lr_buttonui ).
DATA lr_buttonui1 TYPE REF TO cl_salv_wd_fe_button.
After that create another method and make it as a event ( it means now it become event )
select event ON FUNCTION FROM THE LIST
Inside that event write
CASE LV_FCODE.
WHEN 'DETAILS'.
wd_this->fire_OP_TODEATILS_plg( ).
endcase.
May be it may help -
Append, Insert controlling in ALV
Hello,
Currently I have to manually select the new line to that is appended or inserted. I want that when use press Append or Insert button in ALV it should pass the control and the new line to become the lead select row. My requirement is that when user make changes in the default fields and press append or insert, these default values should be replaced in the Item Detail section for that particular new row. I am able to capture the event when user press Append or Insert.
Shall appreciate soonest response.
Thks & Rgds,
Hemal
Edited by: Hemal Gandhi on May 12, 2010 4:45 PMit sounds like you want to used the Append/Insert functionality to just validate your inputs and re-wrote the whole row with the new changes; you don't really want to add a new row?
if I understand correct I think you will need to create your own custom APPEND/INSERT BUTTON to disable standard functionality of Adding a new row to the ALV and run ON_DATA_CHECK to modify current entries behind your custom button.
I will hide the APPEND/INSERT standard button and add a custom button at the same position with the same text calling ON_DATA_CHECK and binding new values to the row that has been change.
Maybe someone else has a better approach but that's what I will do, and I know it works!
thanks!
Jason PV -
Hi ,
How to remove the standard buttons on the WD4A alv grid like View (Std. View) , Print Version , Export , Filter , Settings.
Thanks,
KumarHow did u solved ?
Maybe you are looking for
-
How do I find the hardware specs on my ipad
How do I find the hardware specs on my iPad?
-
Iphone 4 wifi not connecting to home wifi
at home when im downstairs my wifi works when i go back upstairs it losses its connection and does not work. im sure its not my router being to far because my ipad and laptop has full bars of internet and my other siblings phones and laptops work.(al
-
Snippets cause script error when placed in different order
In a new topic, I insert two snippets: SnippetA and SnippetB. All is well. Now I want SnippetB to come before SnippetA, so I move it (or delete and replace it, or any other method one might use to get the order changed). Now in the preview or compile
-
Reg Check information in table
Hi Experts, I am developing a Program in account payble(AP), I want to know some field like : <b>Check status field, PO number, Invoice No and Voucher No</b> for that which table i use... Please suggest me, I alredy check PAYR, <b>REGUP,REGUH,BSIS,BS
-
Disappearing data ...etc
_HELP ME PLEASE_ using iphone4s ....and ipad2... contacts go missing, notes go missing, some photos assigned to contacts have become jumbled. i hear my key strokes click but some letters, spaces do not publish even though i have disabled autocorrect