Application Development 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: 

open dataset

Former Member
0 Kudos

hi all,

i need to send the output to application server, if the program executed twice on the same day the output in application server should not overwrite the first executed output.

please help do we have no update option in open dataset.

please help me

my code:

OPEN DATASET f_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

thanks in advance.

2 REPLIES 2

Former Member
0 Kudos

Hello Kiran,

Did you see the help for open dataset statement ?

You can try this :

OPEN ... FOR APPENDING opens the file in append mode.

regards,

Advait

Former Member
0 Kudos

Hi kiran,

I use OPEN DATASET multiple times a day to write to a file sequentially. This does not delete the previous record. It only adds to the file.


DATA: dsn(40) VALUE '/usr/filename.txt'.
DATA: wa_itab like line of itab.

OPEN DATASET dsn FOR APPENDING IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC = 0.
LOOP AT ITAB INTO wa_itab.
TRANSFER wa_itab TO dsn.
ENDLOOP.
ENDIF.
CLOSE DATASET dsn.

Let me know if you have any questions.

SL