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

Adding a file to the application server

Former Member
0 Likes
976

Hi Friends,

I need to send few files into the same file on the application server. I have used OPEN DATASET...FOR APPENDING. But the file is adding the data to the already existing data instead of overwriting the already existing file. I need help to overcome this.

Thanks,

Raj

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
904

Hi Raj,

Use syntax,

OPEN DATASET FNAME FOR OUTPUT MESSAGE MESS.

do not use for appending...

Regards,

Azaz.

6 REPLIES 6
Read only

Former Member
0 Likes
905

Hi Raj,

Use syntax,

OPEN DATASET FNAME FOR OUTPUT MESSAGE MESS.

do not use for appending...

Regards,

Azaz.

Read only

0 Likes
904

I tried with FOR OUTPUT but I cannot append by using FOR OUTPUT.

Thanks,

Raj

Read only

0 Likes
904

Hi,

For not appending the file already present in the application server check the code present in the link,

http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3cc0358411d1829f0000e829fbfe/content.htm

For appending the data in the file,

http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3ccd358411d1829f0000e829fbfe/content.htm

Regards,

Azaz Ali.

Read only

0 Likes
904

Hi Raj,

Try this if you want in binary mode,

OPEN DATASET FNAME FOR OUTPUT In binary mode .

Try this if you want in text mode,

OPEN DATASET FNAME FOR OUTPUT In text mode encoding default .

Please dont forget to reward all helpful answers.

Regards,

Azaz Ali.

Read only

Former Member
0 Likes
904

Hi,

Try removing the FOR APPENDING addition in the OPEN DATASET..

Thanks,

Naren

Read only

Former Member
0 Likes
904

Dear Raj

To keep it simple, take it this way:

p_file is the filename.

1. APPENDING MODE:

open dataset p_file <b>for APPENDING</b> in text mode encoding default.

Here, if p_file already exists it is opened to append the exisiting data in the file. If the file does not exist it is open a new file.

2. OUTPUT MODE:

open dataset p_file <b>for OUTPUT</b> in text mode encoding default.

Here everytime the file is opened as a new one.

Hope the above info helps you.

Kind Regards

Eswar