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

append file on application server

karuna_gangireddy
Contributor
0 Likes
400

Hi All,

I am having a file on the server. I have to append the contents to this file. I am using 'OPEN DATA SET......' and 'TRANSFER....' but the contents are not saving to the file.

Here is what my code looks like:

data: fpath type pfeflnamel.

data: begin of filedir occurs 10.

include structure salfldir.

data: end of filedir.

data: filedata(265) type c 'ABCDEFC'.

CALL FUNCTION 'RZL_READ_DIR_LOCAL'

EXPORTING

NAME = fpath

TABLES

FILE_TBL = filedir .

loop at it_filedir.

zfile_name = filedir-name.

endloop.

OPEN DATASET zfile_name FOR APPENDING IN TEXT MODE ENCODING DEFAULT.

IF SY-SUBRC = 0.

TRANSFER filedata TO zFILE_name.

CLOSE DATASET zFILE_name.

ENDIF.

But this code is not appending the data to the file. Can anyone please let me know where ia m doing wrong.

Thanks in advance,

Karuna.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
337

loop at it_filedir.

zfile_name = filedir-name.

endloop.

OPEN DATASET zfile_name FOR APPENDING MODE

zfile_name is the file path on application server. Once the file is opened loop at it_filedir and transfer it_filedir to zfile_name.

1 REPLY 1
Read only

Former Member
0 Likes
338

loop at it_filedir.

zfile_name = filedir-name.

endloop.

OPEN DATASET zfile_name FOR APPENDING MODE

zfile_name is the file path on application server. Once the file is opened loop at it_filedir and transfer it_filedir to zfile_name.