2009 Jul 27 12:49 PM
Hi Experts,
Im trying to read first a text file and I wanted to replace the contents of the said file, How can I save the changes that I did on the text file? do you know what FM I can use? Thanks
BR,
Chris
2009 Jul 27 12:54 PM
Hi,
First read the text file into internal table using FM shown below.
FM call to upload file
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_file_name
filetype = lv_filetype
has_field_separator = lv_gui_sep
TABLES
data_tab = gi_zhralcon_file.
Then after the reqd changes use the FM as shown.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = binfile
filename = 'D:\MYFILE.txt' //give the address where u want output.
FILETYPE = 'BIN'
tables
data_tab = pdftab
Hope it helps.
Regards
Rajesh Kumar
Hi Experts,
Im trying to read first a text file and I wanted to replace the contents of the said file, How can I save the changes that I did on the text file? do you know what FM I can use? Thanks
BR,
Chris
2009 Jul 27 12:52 PM
2009 Jul 27 12:54 PM
Hi,
First read the text file into internal table using FM shown below.
FM call to upload file
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_file_name
filetype = lv_filetype
has_field_separator = lv_gui_sep
TABLES
data_tab = gi_zhralcon_file.
Then after the reqd changes use the FM as shown.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = binfile
filename = 'D:\MYFILE.txt' //give the address where u want output.
FILETYPE = 'BIN'
tables
data_tab = pdftab
Hope it helps.
Regards
Rajesh Kumar
2009 Jul 27 12:57 PM
Hi,
What if the contents of my file doesn't contain any field separator, only a TAB, can I indicate there that I wanted to replace the TAB with a comma? Thanks
BR,
Chris
2009 Jul 27 1:01 PM
Hi Chrish again,
Yes you can upload and download file with Tab Separator.
In FM
GUI_UPLOAD
pass paramenter as
HAS_FIELD_SEPARATOR = 'X'.
Regards,
Vijay
2009 Jul 27 1:01 PM
No, you can not as ther is no such parameter.
This is just to download in tab delimited text file.
Regds,
Anil
2009 Jul 27 1:04 PM
Hi,
Yes you can idicate there that you want to replace TAB with COMMA.
Regards,
Pavan.
2009 Jul 27 1:05 PM
Hi Pavan,
Is there a parameter to indicate that, or do I need to code it manually? Thanks
BR,
Chris
2009 Jul 27 1:10 PM
Hi LeBron,
I dont think there will be some parameter for that. As per my knowledge is concerned you need to code it manually. thanks.
Regards,
Pavan.
2009 Jul 27 1:12 PM
Thanks everything is clear now, I will code it manually 😃
BR,
LBJ23
2009 Jul 27 1:13 PM
Hi,
Check WRITE_FIELD_SEPARATOR parameter documentation of GUI_DOWNLOAD in se37.
Hope it helps.
Regards,
Rajesh Kumar
2009 Jul 27 1:13 PM
You need to set 'X' value to the import parameter HAS_FIELD_SEPARATOR
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME =
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' X'
Value 'X' means: Fields are separated by tabs.
2009 Jul 27 1:14 PM
2009 Jul 27 12:57 PM
Hi,
You can try the following
1) Upload the text file to a internal table using GUI_UPLOAD.
2) Make the necessary changes to the internal table fields.
3) Pass this internal table to GUI_DOWNLOAD mentioning the same path and file name.
By this the text file will be replaced with the downloaded file with replaced contents.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |