How to hide 'layout button' on ALV toolbar
Hi,
I have an ALV and it has standard toolbar, now i want to hide 'Layout button' from the toolbar based on specific condition e.g when flag = 1.
How to do that.
Thanks,
If you are using the REUSE function, you can use the "EXCLUDING" parameter, and pass the FCODE for "Change Layout" to this table. This will remove the icon from the toolbar. Here is an example.
REPORT rich_0001 .
* Global ALV Data Declarations
TYPE-POOLS: slis.
* Internal Tables
DATA: BEGIN OF ialv OCCURS 0,
test1(10) TYPE c,
test2(10) TYPE c,
END OF ialv.
DATA: xfc TYPE slis_fieldcat_alv.
DATA: ifc TYPE slis_t_fieldcat_alv.
DATA: iexcluding TYPE slis_t_extab.
DATA: xexcluding LIKE LINE OF iexcluding.
PARAMETERS: p_hide TYPE c DEFAULT 'X'.
START-OF-SELECTION.
REFRESH iexcluding.
* If the user wants to hide the change layout icon, then add to IEXCUDING
IF p_hide = 'X'.
xexcluding-fcode = '&OL0'.
APPEND xexcluding TO iexcluding.
ENDIF.
REFRESH ifc.
xfc-reptext_ddic = 'Test1'.
xfc-fieldname = 'TEST1'.
xfc-outputlen = '10'.
APPEND xfc TO ifc.
xfc-reptext_ddic = 'Test2'.
xfc-fieldname = 'TEST2'.
xfc-outputlen = '10'.
APPEND xfc TO ifc.
* Call ABAP List Viewer (ALV)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_excluding = iexcluding
it_fieldcat = ifc
TABLES
t_outtab = ialv.
Regards,
Rich Heilman
Similar Messages
-
How to create multiple buttons in ALV Toolbar in Webdynpro ABAP
Hi all,
I am trying to create multiple buttons in Webdynpro ALV toolbar, please go through the code.
What happening is, second button is replacing the first one.
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_alv_table( ).
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_alv_table( ).
DATA lv_value TYPE REF TO cl_salv_wd_config_table.
lv_value = lo_interfacecontroller->get_model(
DATA lr_buttonui1 TYPE REF TO cl_salv_wd_fe_button.
DATA lr_buttonui2 TYPE REF TO cl_salv_wd_fe_button.
DATA button1 TYPE REF TO cl_salv_wd_function.
DATA button2 TYPE REF TO cl_salv_wd_function.
**First button
CREATE OBJECT lr_buttonui1.
lr_buttonui1->set_text('Button')."setting the text of the button on alv toolbar
button1 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON')."creating the function for alv button
button1->set_editor( lr_buttonui1 ).
**Second button
CREATE OBJECT lr_buttonui2.
lr_buttonui2->set_text('Button1')."setting the text of the button on alv toolbar
button2 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON' )."creating the function for alv button
button2->set_editor( lr_buttonui2 ).
How can I overcome this??
Thanks
EshwarHi Eshwar,
The button Ids are same for both the buttons in your code. You need to change it as BUTTON1, BUTTON2.
**First button
CREATE OBJECT lr_buttonui1.
lr_buttonui1->set_text('Button')."setting the text of the button on alv toolbar
button1 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON1')."creating the function for alv button
button1->set_editor( lr_buttonui1 ).
**Second button
CREATE OBJECT lr_buttonui2.
lr_buttonui2->set_text('Button1')."setting the text of the button on alv toolbar
button2 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON2' )."creating the function for alv button
button2->set_editor( lr_buttonui2 ). -
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 -
How to add Change Layout Button to ALV Toolbar?
Hi All,
I am using a SAP GUI STATUS 'STANDARD' that has almost all the funcationality needed except for the change layout button.
I have tried changing the GUI STATUS to 'STANDARD_FULLSCREEN' which has the button I am looking for but it does not show up.
What am I missing to have the 'Change Layout' Button show on the toolbar?
thank youI am using Classes.
I did not specify any type of table of 'exclude' buttons.
here is my code that display the ALV
DATA gr_alv TYPE REF TO cl_salv_table.
DATA gr_functions TYPE REF TO cl_salv_functions_list.
DATA gr_selections TYPE REF TO cl_salv_selections.
DATA gr_events TYPE REF TO cl_salv_events_table.
DATA gr_settings TYPE REF TO cl_salv_display_settings.
DATA gr_layout TYPE REF TO cl_salv_layout.
TRY.
cl_salv_table=>factory(
IMPORTING r_salv_table = gr_alv
CHANGING t_table = gt_rpt_details ).
PERFORM f_display_settings.
gr_alv->set_screen_status(
"pfstatus = 'Z_STANDARD'
pfstatus = 'ZSTANDARD_FULLSCREEN'
report = sy-repid
"i_save = 'A'
set_functions = gr_alv->c_functions_all ).
gr_events = gr_alv->get_event( ).
"create layout object
CREATE OBJECT gr_layout.
gr_layout->get_current_layout( ).
CREATE OBJECT event_handler.
SET HANDLER event_handler->on_user_command FOR gr_events.
gr_functions = gr_alv->get_functions( ).
gr_functions->set_all('X').
gr_functions->set_group_filter( value = if_salv_c_bool_sap=>false ).
* Set print preview
gr_functions->set_print_preview( ).
gr_alv->get_display_settings( ).
gr_alv->display( ). -
How to add Change Layout, savelayout, select layout Button to ALV Toolba
How to add Change Layout, savelayout, select layout Button to ALV Toolbar?
Moderator message: please (re)search yourself before asking.
[Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]
locked by: Thomas Zloch on Sep 10, 2010 10:57 AMVariant
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = gs_variant
i_save = c_save
it_default_fieldcat =
IMPORTING
e_exit = gf_exit
es_variant = gs_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF gf_exit = space.
cf_varia = gs_variant-variant.
ENDIF.
ENDIF.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = c_save
CHANGING
cs_variant = gs_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc NE 0.
cf_subrc = sy-subrc.
ENDIF.
Change Layout, savelayout, select layout Button pass the value which is in BOLD
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_user_command = 'U_COMMAND'
i_callback_top_of_page = 'TOP-OF-PAGE'
is_layout = fld_lay
it_fieldcat = fieldcatalog[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = it_sort[]
i_default = 'X'
i_save = 'A'
is_variant = gs_variant
it_events = it_event[]
TABLES
t_outtab = it_sales
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
Annasaheb -
Change layout Button In ALV Grid
Hi all,
I have a requirement where I am creating Field Catalogue from Z Table(has 60 fields) for few(12) fields.
The user would like to have the option to add more fields by changing the Layout. But I dont see the Fields in Hidden Column when I click the Change Layout Button in ALV Toolbar. It just displays the Field based on Field Catalogue defined.
Is there a way I can maintain all the fields without being displayed in ALV initally and letting the user select the hidden fields as per their requirement. As happens in SE16 where we can select the fields to be displayed.
Thanks for the support.Hi Abhilasha,
In the reuse_alv function module we can see a field I_SAVE.If you pass this as 'X' then the option of saving the layout variants are available.
Create a layout by,selecting just the fileds required for display and set it as the default variant.It can be made Global or user-specific.But we need to declare all fields in the fieldcatalog.
So if the default variant is set,everytime the program is run it shows only the fields selected in it but can select more form the change layout option.
Hope it helps.
Regards
Byju -
Hide Change Layout Button in ALV report o/p for MB52 Tcode
Hi,
Is it possible to Hide Change Layout Button in ALV output for Report MB52 using authoriztaion.
We have created a layout in which we are hiding some coloumns which the user should not see.
But if the change layout button is active then the user can add those coloumns to output.
Is this possible through authorizations. I want to avoid doing any chnages to the std sap program.
Thanks & Regards,
FawazCheck the object S_ALV_LAYO
-
Add on custom button to ALV toolbar in std tcode ME51N, ME52N and ME53N.
Hi All,
I have the requirement to add on the custom button to ALV toolbar in ITEM OVERVIEW for standard transaction ME51N, ME52N and ME53N. Does anyone know what enhancement point or user exit i should apply and how i can add on the custom button?
Thanks.There are no user exits or badi's for COOIS. You may have to make copy of the PPIO_ENTRY to ZPPIO_ENTRY including all the varians without changing their names like copy SAP&COOIS to SAP&COOIS. Create a T-Code ZCOOIS and replace COOIS in variant SAP&COOIS to ZCOOIS not in the name of the variant but in the field "Check Authorization for".
The PF-Status is found in the include LCOISOUTPUTF16 which is located in the function group COISOUTPUT you may have to copy that too. Finally you need to copy SAPLCOISOUTPUT with its GUI status GENERAL and add your custom button there. -
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. -
How to deactive a button in application toolbar
how to deactive a button in application toolbar?
Simple example
This example shows how to create a toolbar with a single Exit button, used to exit the program.
Steps:
Create a screen and add a custom container named TOOLBAR_CONTAINER
Code:
REPORT sapmz_hf_toolbar .
TYPE-POOLS: icon.
CLASS cls_event_handler DEFINITION DEFERRED.
G L O B A L D A T A
DATA:
ok_code LIKE sy-ucomm,
Reference for conatiner
go_toolbar_container TYPE REF TO cl_gui_custom_container,
Reference for SAP Toolbar
go_toolbar TYPE REF TO cl_gui_toolbar,
Event handler
go_event_handler TYPE REF TO cls_event_handler.
G L O B A L T A B L E S
DATA:
Table for registration of events. Note that a TYPE REF
to cls_event_handler must be created before you can
reference types cntl_simple_events and cntl_simple_event.
gi_events TYPE cntl_simple_events,
Workspace for table gi_events
g_event TYPE cntl_simple_event.
CLASS cls_event_handler DEFINITION
CLASS cls_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
on_function_selected
FOR EVENT function_selected OF cl_gui_toolbar
IMPORTING fcode,
on_dropdown_clicked
FOR EVENT dropdown_clicked OF cl_gui_toolbar
IMPORTING fcode posx posy.
ENDCLASS.
CLASS cls_event_handler IMPLEMENTATION
CLASS cls_event_handler IMPLEMENTATION.
METHOD on_function_selected.
CASE fcode.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMETHOD.
METHOD on_dropdown_clicked.
Not implented yet
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
SET SCREEN '100'.
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
IF go_toolbar_container IS INITIAL.
Create container
CREATE OBJECT go_toolbar_container
EXPORTING
container_name = 'TOOLBAR_CONTAINER'.
Create toolbar
CREATE OBJECT go_toolbar
EXPORTING
parent = go_toolbar_container.
Add a button
CALL METHOD go_toolbar->add_button
EXPORTING fcode = 'EXIT' "Function Code
icon = icon_system_end "ICON name
is_disabled = ' ' "Disabled = X
butn_type = cntb_btype_button "Type of button
text = 'Exit' "Text on button
quickinfo = 'Exit program' "Quick info
is_checked = ' '. "Button selected
Create event table. The event ID must be found in the
documentation of the specific control
CLEAR g_event.
REFRESH gi_events.
g_event-eventid = go_toolbar->m_id_function_selected.
g_event-appl_event = 'X'. "This is an application event
APPEND g_event TO gi_events.
g_event-eventid = go_toolbar->m_id_dropdown_clicked.
g_event-appl_event = 'X'.
APPEND g_event TO gi_events.
Use the events table to register events for the control
CALL METHOD go_toolbar->set_registered_events
EXPORTING
events = gi_events.
Create event handlers
CREATE OBJECT go_event_handler.
SET HANDLER go_event_handler->on_function_selected
FOR go_toolbar.
SET HANDLER go_event_handler->on_dropdown_clicked
FOR go_toolbar.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
http://www.erpgenie.com/abap/controls/toolbar.htm#Simple%20example
http://help.sap.com/saphelp_nw04/helpdata/EN/42/d2ab343e416635e10000000a1553f6/content.htm
help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCITOOLBAR/BCCITOOLBAR.pdf
Regards,
Jagadish -
What is the constant name for Change layout Button in ALV Grid ABAP Objects
Dear All,
I have one query please help me.
what is the constant name for Change layout Button in ALV Grid ABAP Objects.
With Rgds,
BabuHalo Vinod,
The consant name is cl_gui_alv_grid=>mc_fc_current_variant.
Regards
Arshad -
How to hide ,unhide columns in ALV List
Hi all,
How to hide ,unhide columns in ALV List..
Plz guide me.
Thanks in advance..
AlbertHi Joseph,
Check the following thread:
Hide Unhide columns of ALV grid Report.
Regards,
Archana -
How to hide "Resfresh" button in top yellow bar of guided procedures?
Hi Folks
I would like to remove the "Refresh" button in the top yellow bar of an guided procedures workitem. You get to this yellow bar when you click on an uwl workitem which is associated with guided procedures view. Does anybody know how to hide this button?
Thanks a lot for helping!!
Kind regards
BettinaDear Bettina,
this will be a feature of NetWeaver CE 7.2.
Until then it simply is not possible.
There is one workaround, you can use the SingleTask view of a Process Instance, which however will show ONLY the action itself, without the Process Title, or the Ctx Panel or the Phase Navigator.
If this works for you, I can guide you how to achieve it.
Regards,
George. -
How to disable the button in application toolbar in report pgm
Can anyone help with How to disable the button in application toolbar in report pgm
Hi,
You can use it_excluding to disable button on the tool bar.You have to find the function code for the required button and append that function code to the it_excluding .The optional IMPORTING parameter IT_EXCLUDING is an internal table. It is only needed if the caller uses the list tool standard interface but wants to deactivate interface functions which he or she does not need.You can have your defined pf-status using I_CALLBACK_PF_STATUS_SET.
SAMPLE PROGRAM
tables spfli.
type-pools: slis.
DATA W_FCODE TYPE SLIS_EXTAB-FCODE.
data: t_spfli TYPE SPFLI OCCURS 0 WITH HEADER LINE.
select * from spfli into table t_spfli.
data : t_excluding TYPE SLIS_T_EXTAB .
W_fcode = '&OUP'.
append w_fcode to t_excluding.
W_fcode = '&ODN'.
append w_fcode to t_excluding.
call function 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'SPFLI'
IS_LAYOUT =
IT_FIELDCAT =
IT_EXCLUDING = T_EXCLUDING
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.
http://help.sap.com/saphelp_nw2004s/helpdata/en/99/49b844d61911d2b469006094192fe3/frameset.htm
Regards,
Priyanka. -
How to let the button in the toolbar more distinct when its be selected?
hi.
How to let the button in the toolbar more conspicuous(distinct) when its be selected?Chnge it's backgroung color, it's border, it't icon if has one.... Coice the way you more like.
Abraham.
Maybe you are looking for
-
New aluminum Macbook and S-Video
New aluminum Macbook and S-Video It have come to the conclusion that the new MacBook's and MacBook Pro's can not output to S-video. I have tired the Apple Mini DisplayPort to DVI and then the Apple DVI to Video but no luck, the two do not connect as
-
Problem with ORA --0094 : Invalid identifier
Hi All, I am facing an issue while executing a query in the Oracle 11g R2 database. Let us take an example. create table test (ID int not null, country_Name Varchar(20)) if i do select * from test where country_Name="someValue". It gives ORA- 0094 er
-
Simple question - minimize application
I have a simple question to nokia developers. Why I cannot minimize most of my applications in Nokia Asha 302? In Nokia E50 I could. Why are you going backwards in usefulness of your software?
-
Expression Grouping and Summing
I am working on a report where I have an expression that gets the Max value of a field in the detail row of my report. I have four levels of grouping that I then need this expression to sum. The expression is: =Max(IIF(LEFT(Fields!JobNum.Value,1)=
-
Load-balancing with OCI connections
Gurus, Oracle Identity Federation (OIF) can leverage an Oracle database as its transient data store in which case it uses JDBC-OCI connections to connect. However, there is no provision in OIF of defining multiple databases for load-balancing purpose