on 06-02-2012 10:39 AM
Hi,
I have seen all the blogs for Creating Excel from Web ui.
Sap has give standard functionality to create CSV file from table view.
But My requirement is, when user selects Rows from Table View on web ui Like below:
Say User have selected all the three rows below :
only these row will be taken into internal table as a Row or header and create Excel out of it like below :
company Code | alternative meter Id | Recorder id |
Here the internal table will be dynamic as user can select any number of fields.
Please guide me in this.
Thanks
Sunita.
Hi Sunita,
You can redifine method CL_BSP_WD_CONTEXT_NODE_TV->IF_BSP_WD_MODEL_TV_EXCEL_EXPRT~GET_DATA_XML in your model controller as follows:
DATA: lt_config_tab TYPE bsp_dlc_column_descr_tab,
lr_table_model TYPE REF TO zl_zsample__priceel_cn00,
lr_col TYPE REF TO if_bol_bo_col,
lv_string TYPE string.
FIELD-SYMBOLS <ls_config_data> TYPE bsp_dlc_column_descr.
* Get configuration data.
IF iv_config_table IS NOT SUPPLIED.
lt_config_tab = cl_bsp_dlc_table_utility=>get_table_from_config_xml( iv_config_xml ).
ELSE.
lt_config_tab = iv_config_table.
ENDIF.
LOOP AT lt_config_tab ASSIGNING <ls_config_data>.
* Only consider data if it was not removed by personalization.
IF <ls_config_data>-hidden IS NOT INITIAL.
DELETE lt_config_tab INDEX sy-tabix.
CONTINUE.
ENDIF.
WHILE <ls_config_data>-name CA '.'.
SPLIT <ls_config_data>-name AT '.' INTO lv_string <ls_config_data>-name.
ENDWHILE.
ENDLOOP.
* Get marked rows and set collection
lr_col = me->collection_wrapper->get_marked( ).
lr_table_model = me.
lr_table_model->set_collection( lr_col ).
* Forward to XML generator.
rv_content_bin = cl_chtmlb_xml_provider=>get_xml_from_model( it_config = lt_config_tab
iv_table_model = lr_table_model
iv_name = me->structure_name
iv_view_controller = iv_view_controller ).
Hope it helps.
Regards,
Eric
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One Clarification required, what if it displays all the rows,user can hide or delete the fields from EXCEL.
If you would really like to modify, Copy your Tag, Copy the class and assign your own class to your tag.
Then redifine method as per u r requirement by calling the configuration, then get the selected rows and export it to Excel.
regards,
Charan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Krishna,
How do I export it to Excel. As I have created a dynamic table where is My Rows are converted as Column.
Do we have any direct class? or HTML or Javascript code?
I refererred this PDF by David Lawn, But it has javascript code. in which my onclientclick event is not getting triggered,
Please help me.
/Sunita
User | Count |
---|---|
4 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.