‎2007 Nov 11 10:51 PM
Hello Gurus,
I need to copy an existing *.csv file on the application server to a different location as a *.txt file with the code page UTF-8 /8400/ in the background.
Example:
I have a file with the name is: 'new.csv' in the DIR: '/SERVER/NEW'.
I need to convert the file to 'UTF-8' and copy to DIR: '/SERVER/ARCHIVE' with the name: 'archive.txt'
I was able to get the file via FM: DX_FILE_READ into an internal table. Now I tried to use GUI_UPLOAD, but failed due to the fact the GUI_UPLOAD will just upload a file from PC to an internal table. Additionally I need to run the report in background. So the FG: SFES will not do.
Could you please give me a hint on this?
I am running in a circle
Any help will be rewarded.
Thank you!
Martin
‎2007 Nov 11 11:06 PM
Hi Martin,
As you know any presentation server upload FM's will not work in background.
But there is a workaround. Check below may help you
Regards,
Atish
‎2007 Nov 11 11:06 PM
Hi Martin,
As you know any presentation server upload FM's will not work in background.
But there is a workaround. Check below may help you
Regards,
Atish
‎2007 Nov 11 11:08 PM
Hi Martin,
While reading from the directory use OPEN DATASET FOR INPUT and read the data to internal table.
Now you got data in you internal table, move data from internal table to APP SERVER to the necessary directory using OPEN DATASET FOR OUTPUT.
Hope your problem will get resolved.
Reward points if it helps,
Satish
‎2007 Nov 12 9:27 AM
Hello Atish, Satish
Thank you for the quick answer!
@Atish,
Your guide is very helpful and I have downloaded it for further use, however I do not need to make any uploads/downloads from and to PC in the background.
@Satish
The OPEN DATASET helped. This works in the background as well.
I have allotted points to both of you as promised.
Thanks again!
Sample of the code I used:
OPEN DATASET g_out_file FOR OUTPUT IN TEXT MODE ENCODING UTF-8.
LOOP AT lt_file INTO ll_file.
TRANSFER ll_file TO g_out_file.
ENDLOOP.
CLOSE DATASET g_out_file.
Where g_out_file is the path and file name and lt_file and ll_file are internal tables I retrieve by FM: DX_FILE_READ /type: dxrawdata/