cancel
Showing results for 
Search instead for 
Did you mean: 

Custom button ALV to download data to excel and word.

Madhu2004
Active Contributor
0 Kudos

Hai Experts,

I have a requirement in which i need to add a button on the alv tool bar

which has the functionality of downloading the data in the alv to

word/excel/notepad..

i got the prcedure to download the data but my problemis how to capture the data in the alv into an internal table.

if i can capture the column headings and the data into an internal table, my problrm of downloading the data solves.

so please help how to capture the data along with the headings displayed in the

ALV into an internal table.

its urgent,,,,

Madhu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

check this link for a guide how to add and remove buttons from the ALV in web dynpro:

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40794172-b95a-2910-fb98-b86d8a0918b4">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40794172-b95a-2910-fb98-b86d8a0918b4</a>

part of this document:

Get reference to ALV component and configuration model

To obtain a reference to the ALV component and its configuration model you can use the following code.

The configuration model can be used to set all sorts of properties of the ALV

DATA: lr_salv_wd_table TYPE REF TO iwci_salv_wd_table,
r_table TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
* get reference to ALV component interface lr_salv_wd_table = wd_this->wd_cpifc_alvmain( ). 
* get ConfigurationModel from ALV Component
wd_this->r_table = lr_salv_wd_table->get_model( ).

Hide / add function buttons in your ALV

You can hide all function buttons of the ALV with one of these methods.

* Set toolbar visibility to false. data: lr_function_settings type ref to if_salv_wd_function_settings. lr_function_settings ?= wd_this->r_table. lr_function_settings->set_visible( CL_WD_UIELEMENT=>E_VISIBLE-NONE ). * set default ALV Functions off data: lr_standard_functions type ref to if_salv_wd_std_functions. lr_standard_functions ?= wd_this->r_table. lr_standard_functions->set_sort_headerclick_allowed( ABAP_false ). lr_standard_functions->set_filter_filterline_allowed( ABAP_false ). lr_standard_functions->set_filter_complex_allowed( ABAP_false ). lr_standard_functions->set_sort_complex_allowed( ABAP_false ).

You can set individual functions with these methods:

CALL METHOD cl_salv_wd_config_table=>if_salv_wd_standard_functions~set_<x>_allowed
EXPORTING
Value = ABAP_true.

Where <x> is to be replaced with the property of your choice.

Answers (2)

Answers (2)

Former Member
0 Kudos

did u get the solution if yes pls let me know

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

Data you can get directly from the context itself, to read the headers.

data: lr_column_settings TYPE REF TO if_salv_wd_column_settings.

data: lr_column TYPE REF TO cl_salv_wd_column,

lr_column_header TYPE REF TO cl_salv_wd_column_header.

data: lr_salv_wd_table TYPE REF TO iwci_salv_wd_table.

data: lr_config type ref to CL_SALV_WD_CONFIG_TABLE.

lr_salv_wd_table = wd_this->wd_cpifc_<nameof your used component>( ).

lr_config = lr_salv_wd_table->get_model( ).

lr_column_settings ?= lr_config.

lr_column = lr_column_settings->get_column( '<attribute name>' ).

CALL METHOD lr_column->get_header

RECEIVING

value = lr_column_header.

lr_column->get_text( lv_str ).

Regards

Abhimanyu L