on 02-17-2014 9:14 AM
Hi All,
I have a requirement, For an ALV data export i need to provide two options for the customer.
one is 'Export to Excel' and another is 'Export to CSV'. As we know Export to Excel is a standard functionality provided as menu button, i have created another button to perform Export to CSV and it works well. But customer doesnt want this as a separate button and asking to add this as another menu item to the standard button 'Export' .
How can i achieve this?
Thanks,
Ramakrishna
Hi,
You can achieve this using button choice UI.
DATA: lr_func_settings TYPE REF TO if_salv_wd_function_settings,
lr_function TYPE REF TO cl_salv_wd_function,
lr_menu_action TYPE REF TO cl_salv_wd_menu_action_item,
lr_button_choice TYPE REF TO cl_salv_wd_fe_button_choice,
* create button choice
CREATE OBJECT lr_button_choice.
* create new tool bar button choice
lr_function = lr_func_settings->create_function( 'BUTTON_CHOICE_TB' ).
lv_text = 'Demo Btn Choice'
lr_button_choice->set_text( lv_text ).
* create menu objects for button choice
lv_id = 'EXP_EXCEL'
lv_text = 'Export to Excel'.
CREATE OBJECT lr_menu_action
EXPORTING
id = lv_id.
lr_menu_action->set_text( lv_text ).
* Add action menu to button choice
lr_button_choice->add_choice( lr_menu_action ).
* 2nd item
lv_id2 = 'EXP_CSV'
lv_text = 'Export to CSV'.
CREATE OBJECT lr_menu_action
EXPORTING
id = lv_id.
lr_menu_action->set_text( lv_text ).
lr_button_choice->add_choice( lr_menu_action ).
lr_function->set_editor( lr_button_choice ).
You can also get the existing Function and use add_choice to add another Item
lr_function = lr_functions->get_function_std( 'FUNC_ID' ). " func_id is the ID of standard function
You can also refer this document for adding custom button in Toolbar
Hope this helps u,
Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am trying to do exactly as described in this post by adding items to the Export button and not creating a new button choice as described.
The hint states:
lr_function = lr_functions->get_function_std( 'FUNC_ID' ). " func_id is the ID of standard function
Alhtough I do get the standard function using
lr_function_std = lr_func_settings->get_function_std( if_salv_wd_c_std_functions=>export ).
I cannot see how to assign it to a reference that I can use to add the action items to.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.