‎2006 Nov 13 10:04 AM
I need to upload a text file to an ABAP program and needs to replace some characters and save file back again to the source. Which techniques or functions I can use to fulfil this requirement.
Thanks in Advance.
‎2006 Nov 13 10:07 AM
use GUI_UPLOAD to read the data.
GUI_DOWNLOAD to save the data back.
u can do the required operations on the data on the data present in a internal table after the first fm
santhosh
‎2006 Nov 13 10:07 AM
use GUI_UPLOAD to read the data.
GUI_DOWNLOAD to save the data back.
u can do the required operations on the data on the data present in a internal table after the first fm
santhosh
‎2006 Nov 13 10:08 AM
1)upload file using gui_uplaod into internal table.
2) do changes required in internal table.
3)now download file from new internal table to frontend.
‎2006 Nov 13 10:10 AM
Hello Eswar,
You can do this by the following way.
Declare a Itab whcih has same structure as that of file.
Use GUI_UPLOAD to upload the file to the itab.,
Change the content of the itab.
Use GUI_DOWNLOAD to download the file.
If useful reward.
Vasanth
‎2006 Nov 13 10:10 AM
use fm 'WS_UPLOAD' to upload your data into internal table and then use 'WS_DOWNLOAD' to download the file and use the same filename.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = 'C:\file.txt'
FILETYPE = 'ASC'
HEADLEN = ' '
LINE_EXIT = ' '
TRUNCLEN = ' '
USER_FORM = ' '
USER_PROG = ' '
DAT_D_FORMAT = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = internal table
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = ' '
CODEPAGE = ' '
FILENAME = 'C:\file.txt '
FILETYPE = 'ASC'
MODE = ' '
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
COL_SELECT = ' '
COL_SELECTMASK = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = internal table name
FIELDNAMES =
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
i think it should be helpful for u.
Shiba Prasad Dutta
‎2006 Nov 13 10:11 AM
Hi
It depends on where the file u have to upload is.
Anyway to upload/download the file you have only two method:
- From Presentation Server: FM GUI_UPLOAD and GUI_DOWNLOAD
- From Application Server: statament OPEN DATASET/CLOSE DATASET
In both case I believe u should upload the data file into an internal table, modify the records in this table and downlad the records of the table to the file.
Max