on 2018 Dec 05 11:19 AM
Hi ,
Can anyone please let me know if there is any FM to upload internal table data in .xls on application server.
I have tried Open dataset... close data set but it works perfectly for .csv, If I try .xls with the same file and when I download it from CG3Y to my PC (Just ot verify the excel sheet) fields are not separated its coming on one cell only.
I have also tried FM "MS_EXCEL_OLE_STANDARD_DAT" (Suggested on some threads) but it is for downloading excel file on my PC, not useful for application server.
Regards,
sachin
Request clarification before answering.
Sorry, but why do you think that your application server can read data from MS Excel file?
Please read again answers here: https://archive.sap.com/discussions/thread/1737852
P.S. And: https://github.com/ivanfemia/abap2xlsx
https://blogs.sap.com/2010/07/12/abap2xlsx-generate-your-professional-excel-spreadsheet-from-abap/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Valdim,
Thanks for your response.
In my case User have the script that directly pick file from application server and download it. I just need to upload the .xls file in batch job. I don't want to opne that .xls file in application server. I tried to upload it from cg3y and download it by CG3Z tcode, It was working fine.
So I am looking for a FM which takes data from internal table and store it in application server in .xls format.
regards,
sachin
What does your internal table contain?
If you have some numbers and strings in your internal table (not a binary excel file) then you will need to create excel file using abap. And abap2xlsx is a solution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
It's better if you can provide more detail about your current work e.g. abap code
By the way, as I see, your need is to write internal table to application server .xls file. You may seperate your data by horizontal tab (cl_abap_char_utilities=>horizontal_tab) then fields will be seperated into each column.
Best Regards,
Nam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
convert your internal table to excel like this:
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = DATA(lr_table)
CHANGING
t_table = lt_tab ). " your data in this table
CATCH cx_salv_msg .
EXIT.
ENDTRY.
TRY.
lt_fcat = cl_salv_controller_metadata=>get_lvc_fieldcatalog(
r_columns = lr_table->get_columns( )
r_aggregations = lr_table->get_aggregations( ) ).
lr_result = cl_salv_ex_util=>factory_result_data_table(
r_data = REF #( lt_tab )
t_fieldcatalog = lt_fcat ).
cl_salv_bs_lex=>export_from_result_data_table(
EXPORTING
is_format = if_salv_bs_lex_format=>mc_format_xlsx " based on sap version
ir_result_data_table = lr_result
IMPORTING
er_result_file = DATA(lr_xstring) ).
CATCH cx_salv_unexpected_param_value .
EXIT.
ENDTRY.
then convert the xstring to binary table:
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lr_xstring " this is the XSTRING of the file u want to upload
IMPORTING
output_length = lv_output_length
TABLES
binary_tab = lt_solix_tab.
after that use open data set to write that binary table to application server.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
57 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.