Disabled button in alv
how we will disabled the button in alv report at run time
<b>*define</b>
data: g_exclude type ui_func,<br>
g_t_tlbr_excl type ui_functions.<br>
To exclude the icons:-<br>
Exclude alv sum button<br>
g_exclude = cl_gui_alv_grid=>mc_fc_sum.<br>
append g_exclude to g_t_tlbr_excl.<br>
Exclude alv count button<br>
g_exclude = cl_gui_alv_grid=>mc_fc_count.<br>
append g_exclude to g_t_tlbr_excl.<br>
Exclude alv average button<br>
g_exclude = cl_gui_alv_grid=>mc_fc_average.<br>
append g_exclude to g_t_tlbr_excl.<br>
Exclude alv maximum button<br>
g_exclude = cl_gui_alv_grid=>mc_fc_maximum.<br>
append g_exclude to g_t_tlbr_excl.<br>
*ALV display<br>
call method g_alv_grid->set_table_for_first_display
<br>
EXPORTING<br>
is_variant = g_variant<br>
is_layout = g_layout<br>
is_print = g_print<br>
it_toolbar_excluding = g_t_tlbr_excl<br>
CHANGING<br>
it_outtab = output table[]<br>
it_fieldcatalog = fieldcatalog[].
Similar Messages
-
Hi, I'm not able to disable a button that I added in the toolbar of an alv tree. Here is a piece of my code
Add_Button
data: lr_functions type ref to cl_salv_functions_tree.
lr_functions = mr_tree->get_functions( ).
lr_functions->add_function(
name = '&OPEN_ALL'
icon = l_icon
text = l_text1
tooltip = l_text1
position = if_salv_c_function_position=>right_of_salv_functions ).
Disable_Button
try.
lr_functions->ENABLE_FUNCTION(
name = '&OPEN_ALL'
boolean = abap_false ).
catch cx_salv_wrong_call CX_SALV_NOT_FOUND.
endtry.
Enable_function does not return an exception, so it found the button. But the button still enable. What's wrong?
Thanks, DavyHi Davy,
I'm facing same problem as you, did you resolved it?
My coode looks like this
data: l_function type ref to CL_SALV_FUNCTION.
l_function->set_enable( abap_false ).
Thanks in advance.
Well, it seems that i solved it.
Instead of using
l_function->set_enable( abap_false ).
i used
l_function->set_visible( abap_false ).
Edited by: Jorge Sancho Royo on Apr 2, 2008 1:46 PM -
How to enable or disable buttons on an interactive ALV report
I have two buttons on Interactive ALV report. Before displaying the ALV report, I want to enable or disable buttons on ALV depending on some conditions.I dont want to make the buttons visible or invisible. This is not an OO ALV report.
Please suggest !!!Then you have to use the event set_pf_status or parameter I_CALLBACK_PF_STATUS_SET for this pass the form name.
You have to Implement the form Routine.
FORM PF_STATUS using status type SLIS_T_EXTAB.
SET PF-STATUS 'STS' excluding status.
ENDFORM.
First create the pf-staus using SE41 or double click on the status name and create . By default you make them Disable mode. -
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 -
How to disable the custom button on alv?
Hi All,
i created a ALV Report .I created a Custom Button on ALV.Based on the input value i need to enable/disable that Button.
How can i achieve?And what are the methods i need to code?
Regards
RaviHi Ravi,
You create the button like this:
Data: mr_functions type ref to IF_SALV_WD_FUNCTION_SETTINGS,
mr_button_func type ref to CL_SALV_WD_FUNCTION
mr_functions ?= mr_alv_model.
CALL METHOD mr_functions->create_function
EXPORTING
id = '<<Button Id>>'
RECEIVING
value = mr_button_func.
CREATE OBJECT mr_button.
mr_button->set_text( 'some text' ).
mr_button_func->set_editor( mr_button ).
to sent enable/disable
mr_button->set_enabled(abap_false).
hope this will serve your purpose.
Regards,
Ritwik. -
HOW to Disable a button in ALV on application bar
Hi,
I have a button in ALV program and i want to disable that button which is on application bar is there any way plz tel me
Regards,
Salehahi ,
Copy the STANDARD status of the function group SALV into the application program
i.e in ur prg....
see below ex....
data:
t_spfli like standard table of spfli.
DATA:
w_program LIKE sy-repid.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE t_spfli
FROM spfli.
MOVE sy-repid TO w_program.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = w_program
i_callback_pf_status_set = 'STATUS'
i_structure_name = 'SPFLI'
TABLES
t_outtab = t_spfli
EXCEPTIONS
program_error = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*& Form status
text
-->P_T_EXTAB text
FORM status USING p_t_extab TYPE slis_t_extab.
SET PF-STATUS 'DEMO' EXCLUDING '&ODN'.
ENDFORM. "status
<b></b><b></b><i></i>
regards ,
Naresh. -
Custom button in alv and disabling all buttons in application tool bar
Experts,
Could you please help me for the below requirements.
1). How to disable all the buttons (like sorting, print, find, set filter...etc.) in tool bar using oops?
2). Where can I add my custom download button in alv report using oops?
Thanks in advance...
Sridhar..Step1:
Create on local class
Class <LCL_EVENT_RECEIVER> Definition
Define the below public methods.
Method Name HANDLE_TOOLBAR
Event Name TOOLBAR
Event Class CL_GUI_ALV_GRID
Importing E_OBJECT, E_INTERACTIVE
Method Name HANDLE_USER_COMMAND
Event Name USER_COMMAND
Event Class CL_GUI_ALV_GRID
Importing E_UCOMM
Class <LCL_EVENT_RECEIVER> Implementation
. Method HANDLE_TOOLBAR
Declare the structure <LS_TOOLBAR> of structure type STB_BUTTON
Append the button information as given below into table E_OBJECT->MT_TOOLBAR to display the custom button on ALV grid.
LS_TOOLBAR-FUNCTION = u2018DOWNu2019
LS_TOOLBAR-QUICKINFO = u2018downloadu2019
LS_TOOLBAR-TEXT = u2018downloadu2019
Method HANDLE_USER_COMMAND
In this method if E_UCOMM = u2018DOWNu2019 write your logic.
Step2:
1. To excluding the ALV grid buttons, fill the <LT_EXC> with function code CL_GUI_ALV_GRID=>MC_FC_EXCL_ALL
2. To generate the ALV Grid, call the method SET_TABLE_FOR_FIRST_DISPLAY
Class CL_GUI_ALV_GRID
Method Name SET_TABLE_FOR_FIRST_DISPLAY
Exporting
I_STRUCTURE_NAME ZDS_CM_EXT_SEL
LS_LAYOUT <LS_LAYOUT>
IT_TOOLBAR_EXCLUDING <LT_EXC>
Changing
IT_OUTTAB <GT_EXT_SEL>
Create the Instance for class <LCL_EVENT_RECEIVER>
Class <LCL_EVENT_RECEIVER>
Instance Name <LO_EVENT_FNAME>
Now set handler <HANDLE_USER_COMMAND> and <HANDLE_TOOLBAR_FNAME> events using instance <LO_EVENT_FNAME>
Call method 'SET_TOOLBAR_INTERACTIVE' to raise event TOOLBAR
Class CL_GUI_ALV_GRID
Instance Name <GO_GRID>
Method Name SET_TOOLBAR_INTERACTIVE -
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 -
Add Change/Edit button in ALV
Hello Experts,
How to insert the button in ALV grid toolbar. Now its showing Check,insert,append and delete button.How to add change or edit button in ALV ?
I'm using ALV componenet SALV_WD_TABLE.
Thanks.Hi Stars,
To achieve this, you have to two of ALV grid events. Use event TOOLBAR to add a button & event USER_COMMAND to implement a function.
In the method handling the toolbar event, we define a new button by filling a structure and appending it to the table attribute mt_toolbar of the object to whose reference we can reach via the parameter e_object of the event.
Example code snippet for your reference :-
DATA: ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
MOVE 3 TO ls_toolbar-butn_type.
APPEND ls_toolbar TO i_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 'PER' TO ls_toolbar-function. "#EC NOTEXT
MOVE icon_display_text TO ls_toolbar-icon.
MOVE 'Passenger Info'(201) TO ls_toolbar-quickinfo.
MOVE 'Passenger Info'(201) TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled. "#EC NOTEXT
APPEND ls_toolbar TO i_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 'EXCH' TO ls_toolbar-function. "#EC NOTEXT
MOVE 2 TO ls_toolbar-butn_type.
MOVE icon_calculation TO ls_toolbar-icon.
MOVE 'Payment in Other Currencies'(202) TO ls_toolbar-quickinfo.
MOVE ' ' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled. "#EC NOTEXT
APPEND ls_toolbar TO i_object->mt_toolbar.
Regards
Abhii -
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 -
Add Button with ALV Standard Toolbar.
Hi,
Can any one tell me how to add user-defined button with ALV
Standard toolbar? When I add Pf-status for alv output , standard alv toolbar is not displayed.
Plz do needful.On the toolbar event of your alv grid, all the button as shown in the code below.
FORM handle_toolbar USING i_object TYPE REF TO cl_alv_event_toolbar_set .
DATA: ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
MOVE 'EXCH' TO ls_toolbar-function. "#EC NOTEXT
MOVE 2 TO ls_toolbar-butn_type.
MOVE icon_calculation TO ls_toolbar-icon.
MOVE 'Payment in Other Currencies'(202) TO ls_toolbar-quickinfo.
MOVE ' ' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled. "#EC NOTEXT
APPEND ls_toolbar TO i_object->mt_toolbar.
ENDFORM
CLASS lcl_event_handler DEFINITION .
PUBLIC SECTION .
METHODS:
*To add new functional buttons to the ALV toolbar
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive ,
ENDCLASS.
CLASS lcl_event_handler IMPLEMENTATION .
*Handle Toolbar
METHOD handle_toolbar.
PERFORM handle_toolbar USING e_object e_interactive .
ENDMETHOD .
ENDCLASS.
DATA gr_event_handler TYPE REF TO lcl_event_handler .
*--Creating an instance for the event handler
CREATE OBJECT gr_event_handler .
*--Registering handler methods to handle ALV Grid events
SET HANDLER gr_event_handler->handle_toolbar FOR gr_alvgrid .
Hope this helps.
Thanks,
Balaji -
How to write code for page up and page down buttons on alv screen?
Hi,
Page up and page down buttons are not working in general alv report. Thease buttons are in disable mode. But is stnd. transactions (tcode : fbl5n) these are enabled and working properly, but we can't debug this with /h
How to write code for page up and page down buttons on alv screen?Poonam,
On doing the screen debugging it took me over to Include LSTXWFCC ,kindly check the below code.
module cc_display.
fcode = sy-ucomm(4).
case sy-ucomm(4).
when 'P--'.
perform cc_firstpage.
when 'P-'.
perform cc_prevpage.
when 'P+'.
perform cc_nextpage.
when 'P++'.
perform cc_lastpage.
when 'EX--'.
perform cc_firstcopy.
when 'EX-'.
perform cc_prevcopy.
when 'EX+'.
perform cc_nextcopy.
when 'EX++'.
perform cc_lastcopy.
I guess it can give you some lead.
K.Kiran. -
Hi experts,
I have a requirement to add 2 radio buttons on ALV toolbar.
I try to implement the toolbar event of class cl_gui_alv_grid, and add 2 radio buttons using the following code:
move 'RAD' to ls_toolbar-function.
move 'RADIO1' to ls_toolbar-quickinfo.
move 'RADIO1' to ls_toolbar-text.
move '4' to ls_toolbar-butn_type.
move ' ' to ls_toolbar-disabled.
move 'X' to ls_toolbar-checked .
append ls_toolbar to e_object->mt_toolbar.
clear ls_toolbar.
move 'RAD' to ls_toolbar-function.
move 'RADIO2' to ls_toolbar-quickinfo.
move 'RADIO2' to ls_toolbar-text.
move '4' to ls_toolbar-butn_type.
move ' ' to ls_toolbar-disabled. "#EC NOTEXT
append ls_toolbar to e_object->mt_toolbar.
But when I run this program,I find these 2 radio buttons look like normal button, is this correct?
And I don't know how to catch which radio button is checked or not.
Anyone having code for it or any suggestion for it, kindly let me know...
Thank you
Edited by: jie Wu on Nov 26, 2010 3:33 AMhello,
I visit this address, but it does't meet my needs....
I want to add radio button(button type 4) in ALV toolbar not the normal button(button type 0).
The more important is I want to find a way to get properity of toolbar in ALV grid.
Thank you. -
Parameter for hinding Eport PDF button in ALV
I believe that I once came across a parameter to globally disable the ALV button Export to PDF. Unfortunately I can not remember which it was and I seem unable to find it.
I am NOT talking about an ABAP method call (that I know), but a WebAS Parameter to disable it (because my Customer does not have a Java Stack).
Can someone help me out please...Hi,
call method l_table->if_salv_wd_std_functions~set_pdf_allowed( exporting value = abap_false ).
where in l_table is type ref to cl_salv_wd_config_table.
your coding is going to look like this
data : lo_interfacecontroller type ref to iwci_salv_wd_table , " Controller for ALV
lr_table_settings type ref to if_salv_wd_table_settings, " Table setting details of ALV
l_table type ref to cl_salv_wd_config_table, " Table configuration
lr_function type ref to cl_salv_wd_function, " Structure to Add Addition functional elements to ALV
lr_toggle_button type ref to cl_salv_wd_fe_button, " To Add Extra button on ALV
w_read_only type char1 value abap_true.
Get ALV component
lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
l_table = lo_interfacecontroller->get_model( ).
lr_table_settings ?= l_table
call method l_table->if_salv_wd_std_functions~set_pdf_allowed( exporting value = abap_false ).
Thanks,
Kumar -
Information button in ALV report
Information button in ALV report is not working. any suggestion
I have copied standard tool bar from standard program.During debugging, I have found that function code is defferent. Then I changed function code according to that.
Maybe you are looking for
-
MacBook Pro shuts down halfway to update OSX Yosemite
I updated my Macbook Pro to OSX Yosemite, and since I restarted it, it won't work....The Apple logo comes on with the loading bar, but loading gets at halfway and then 5minutes later the computer shuts off...Anybody can help please.
-
Extract DDL for Partitioned tables in Oracle 8i
Hi I am currently working on an Oracle 8i database. I have a need to extract the DDL of the existing tables & indexes. Dont need a schema level DDL extract, i just need it for a couple of tables and the corresponding indexes. I am currently using PL/
-
Invalid link message in Acrobat 7 but not in Acrobat X
Dear All, When clicking on an invalid external link in Abobe Acrobat 7, I receive the following error message: The specified file ... does not exist. But in Acrobat X, nothing happens in the same situation and I don`t know how to enable this message.
-
Hi, I have created my project in iDVD and I am making multiple copies. iDVD burns to DVD ok and the DVD's play fine in a DVD player or PC. After the 6th DVD the discs are now blank even though the iDVD progress bar tells me it has been burnt them. I
-
Wireless local radius authentication
Greetings, I have a AIR-AP1121G-A-K9, and I would like to authenticate users with a username and password on the AP using the local radius server. I used the configuration at http://www.aironet.info/en/US/products/hw/wireless/ps4570/products_configur