on 04-20-2015 2:38 PM
i got a requirement to upload and download excel file into webdynpro alv table.by default export to excel is available but the file downloading is in xls format instead of xlsx format.how to overcome this. and i need to upload the xlsx file after doing some changes in the downloaded file.how to convert file format from xls to xlsx.
i got the solution for this.
when we click on export to excel button in alv it will download the data into excel file with format(XLS) to download the file into (XLSX) format we need to maintain some entry for the field export_format of table salv_wd_admin(export_format field value = 10) then the std export to excel button in alv table download the data in excel file with format(XLSX).
we need to maintain the value in TMG(table maintenance Generator)/through spro settings.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if you do simple google search you can get the solution,
Excel File Upload And Display Data Using Web DynPro ABAP - Web Dynpro ABAP - SCN Wiki
Upload and Download files in Webdynpro ABAP - Web Dynpro ABAP - SCN Wiki
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
DATA lo_nd_sflight_node TYPE REF TO if_wd_context_node.
DATA lt_sflight_node TYPE wd_this->elements_sflight_node.
* navigate from <CONTEXT> to <SFLIGHT_NODE> via lead selection
lo_nd_sflight_node = wd_context->get_child_node( name = wd_this->wdctx_sflight_node ).
* @TODO handle non existant child
* IF lo_nd_sflight_node IS INITIAL.
* ENDIF.
lo_nd_sflight_node->get_static_attributes_table( IMPORTING table = lt_sflight_node ).
DATA : ls_sflight_node like line of lt_sflight_node,
lv_text type string.
LOOP at lt_sflight_node into ls_sflight_node.
CONCATENATE lv_text
ls_sflight_node-MANDT
ls_sflight_node-CARRID
ls_sflight_node-CONNID
ls_sflight_node-FLDATE
* ls_sflight_node-PRICE
* ls_sflight_node-CURRENCY
* ls_sflight_node-PLANETYPE
* ls_sflight_node-SEATSMAX
* ls_sflight_node-SEATSOCC
* ls_sflight_node-PAYMENTSUM
* ls_sflight_node-SEATSMAX_B
* ls_sflight_node-SEATSOCC_B
* ls_sflight_node-SEATSMAX_F
* ls_sflight_node-SEATSOCC_F
cl_abap_char_utilities=>newline
INTO lv_text
SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
CLEAR ls_sflight_node.
ENDLOOP.
DATA : lv_xstring TYPE xstring.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = lv_text
* MIMETYPE = ' '
* ENCODING =
IMPORTING
BUFFER = lv_xstring
* EXCEPTIONS
* FAILED = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
data : lv_clientwindow type ref to CL_WDR_CLIENT_WINDOW.
lv_clientwindow = WDR_TASK=>CLIENT_WINDOW.
data : lv_client type ref to IF_WDR_CLIENT.
lv_client = lv_clientwindow->client.
CALL METHOD lv_client->attach_file_to_response
EXPORTING
i_filename = 'rk.xlsx'
i_content = lv_xstring
i_mime_type = 'EXCEL'
* i_compression = IF_HTTP_ENTITY=>CO_COMPRESS_BASED_ON_MIME_TYPE
* i_in_new_window = ABAP_FALSE
* i_inplace = ABAP_FALSE
.
please find the code
Hi Rama,
This code won't work, as this works only for XLS format.
If we need to try for XLSX format, first create the document with reference to the available data using method cl_fdt_xl_spreadsheet=>if_fdt_doc_spreadsheet~create_document, which will directly convert your input compatible to .XLSX xstring and then try to call cl_wd_runtime_services=>attach_file_to_response. It will work for sure.
Please find the below document for your reference.
BR,
RAM.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.