11-14-2007 11:08 AM
Hi Experts,
I am having a requirement of appending new records in a flat file every time when i am executing a transaction.
I am having a flat file ( DAT type ). When I am executing a transaction code some new records will be generated and these records should be appended to the existing flat file with out deleting the existing records in it.
<b>What function module I have to use and how to use that?</b>
Helpful answers will be rewarded.
11-14-2007 11:28 AM
It depends on where your file is being stored.
If your file is stored on the application server, the you do not need a function module, you should use the open dataset command.
You will need to add "for appending" to your open dataset statement. Check the F1 help on the open dataset command in your program for more details.
open dataset <filename> for appending.
If you are storing the file on your local PC, then one way to do it is to first upload the file using Function Module GUI_UPLOAD, add your records, then download it back to the desktop using GUI_DOWNLOAD. I am not aware of any method to add records directly to a file on the desktop.
Best Regards,
Chris H.
11-14-2007 11:30 AM
Hi,
If ur flate file is on presentation server then use fm GUI_DOWNLOAD
*--Call function to download the error file
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = file
filetype = 'ASC'
APPEND = 'X'
TABLES
data_tab = pr_eord_error
EXCEPTIONS
file_write_error = 1
no_authority = 5
unknown_error = 6
access_denied = 15
file_not_found = 19.
And if its on application server then use open dataset
ex. *-- Open Dataset
OPEN DATASET lv_dsn FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
Regards,
Prashant
11-14-2007 11:33 AM
There are two cases
Case 1. If u want to download into Local Pc
then u have to use GUI_Download --->
exporting ---> append = 'X'.
case 2 : If u want to download into App server
then u can use
open data set for append mode
11-14-2007 11:36 AM