Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Appending Flat File

Former Member
0 Likes
688

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 data in it.

What function module I have to use and how to use that?

Helpful answers will be rewarded.

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 data in it.

What function module I have to use and how to use that?

Helpful answers will be rewarded.

4 REPLIES 4
Read only

varma_narayana
Active Contributor
0 Likes
659

Hi..

You can do this with GUI_Download FM.

This is the sample code...

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = lv_len

filename = lv_filename

filetype = 'ASC'

<b> APPEND = 'X'</b> "To append the records to existing file

TABLES

data_tab = lt_itab .

<b>Reward if Helpful.</b>

Read only

Former Member
0 Likes
659

Hi,

Is this a flat file on the application server or on the presentation server?

Gareth.

Read only

former_member386202
Active Contributor
0 Likes
659

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

Read only

0 Likes
659

> 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

I think you mean

open dataset lv_path for appending
                    in text mode encoding default.

All of this is explained quite clearly in the on line help if you press F1 on the OPEN DATASET command.

Gareth.