‎2021 Jul 16 8:38 AM
Hi Guys,
I want to save a CSV file in a specified path. The path should be selectable in the selection screen.
I created my file with the function module SAP_CONVERT_TO_CSV_FORMAT. So I just need the option to save them.
Would be nice if someone can help me
thx
‎2021 Jul 17 5:09 PM
Hi Dear, try coding and running the following sample code.
Best Regards!
Roberto FORTI Santos
call function 'SAP_CONVERT_TO_CSV_FORMAT'
exporting
i_field_seperator = ';'
tables
i_tab_sap_data = internal_table
changing
i_tab_converted_data = csv_table[]
exceptions
conversion_failed = 1
others = 2.
if ( sy-subrc eq 0 ).
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\data.csv'
tables
data_tab = csv_table[].
endif.
‎2021 Jul 16 8:48 AM
Two ways:
But I guess there are a lot of resources in the site where you could get that information, if you just wanted to search for them
‎2021 Jul 16 8:48 AM
and as the OP has deleted himself, I'll ask the moderation team to delete this thread entirely... what a waste of time
edited: the OP has returned from oblivion, it seems... maybe a SAP glitch in the time-space continuum
‎2021 Jul 16 9:15 AM
‎2021 Jul 16 9:54 AM
my pleasure... now it's your turn to:
- learn from this post (the entire Q&A process)
- decide if the answers provided are enough (I don't care which, I'm not hunting for rep, I'm a lucky guy)
- mark que question as answered (if it is)
and, please, the next time you have a question to ask, do yourself a favor and dig deeper: search for tutorials (I guess you are learning), look at the ABAP examples (they are not as bad as they seem) and tell us in your question what did you tried before asking the question. Do NOT post a plain requirement. Prove me that my time writing all this has been an investment and not a waste of time.
‎2021 Jul 16 8:50 AM
Hello Mario,
Please try the following solution
1. Use method cl_gui_frontend_services=>file_open_dialog to get dialog box to open and choose the filepath to download and save the file
2. Use GUI_DOWNLOAD function module to download and save the file in the path chosen from step 1.
Do update if the solution works for you.
Regards,
Juby
‎2021 Jul 16 9:15 AM
‎2021 Jul 17 5:09 PM
Hi Dear, try coding and running the following sample code.
Best Regards!
Roberto FORTI Santos
call function 'SAP_CONVERT_TO_CSV_FORMAT'
exporting
i_field_seperator = ';'
tables
i_tab_sap_data = internal_table
changing
i_tab_converted_data = csv_table[]
exceptions
conversion_failed = 1
others = 2.
if ( sy-subrc eq 0 ).
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\data.csv'
tables
data_tab = csv_table[].
endif.