cancel
Showing results for 
Search instead for 
Did you mean: 

Can we use append and overwrite fucntion in file adapter at one time.

Former Member
0 Kudos

Hi SDners,

I have reqiurment , that i have to append the records in one file as i sending data in batchs for one day, at the same time i want to overwrite the existing file for next day.so my querey is that can i do appending and overwrite function both at one time.

Regards

Ganga

Edited by: gangadhar kh on Feb 2, 2010 1:56 PM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

solved

santhosh_kumarv
Active Contributor
0 Kudos

Standard functionality does not allow you to do this, workaround could be tried with OS command...

check my wiki [More with the File Adapter|https://wiki.sdn.sap.com/wiki/display/XI/MorewiththeFileAdapter] Scenario # 2. This should help you at least a little...

~SaNv...

Former Member
0 Kudos

HI Santosh,

that means we have to write the adapter module.or can we do one thing that can we make two communication channel and send some value from ECC side in payload that if <field1 Value=1> then append (CC) will be activate and when lnew day record will come like first field value=2 then overwrite(CC) will be activated.

Regards

Former Member
0 Kudos

Dear Sdners,

Plz help..........

Regards

Former Member
0 Kudos

Hi,

At the end of the day use file -to-file scenario to pick the file which your appending in whole day.

use processing mode DELETE at sender side for this interface so that new file will be created for next coming data.

Regards,

Suresh

santhosh_kumarv
Active Contributor
0 Kudos

>>that means we have to write the adapter module.

No.....

You could do the below

Let the Scenario be with mode as append in the communication channel.

Schedule a Shell script in CRON job(if linux OS) to run at the end of the day. The script will rename the actual file/ delete the file / archieve it to an different location. By this when the interface run for the first time the next day it will create a new file since the existing file might have renamed/moved/deleted and for the remaining of the day it will append to the existing file.

~SaNv...

Former Member
0 Kudos

Hi Santosh,

thanks for your help.how can we achive to use script.the script which you have given in ur blog that script we have to use. but my system OS is Windos NT.......

Regards

Edited by: gangadhar kh on Feb 3, 2010 7:27 AM

santhosh_kumarv
Active Contributor
0 Kudos

Use MS-DOS.... i.e. create a batch file to rename/delete file and make it as schedule job..

~SaNv...

Former Member
0 Kudos

Hi SAntosh,

I am using file adapter at receiver side so what i want to do that , i will write one script and which will delete or overwrite the Existing file in target folder.plz correct me if i am wrong.

Regards

santhosh_kumarv
Active Contributor
0 Kudos

In receiver file adapter use mode as "Append" and file name for eg. sourcefile.txt. The below 2 cases are possible in this.

1. The CC will create file sourcefile.txt and write content to it if file does not exist already.

2. If file exist already, it will append the contents to the existing file sourcefile.txt.

Write a script/batch file and schedule it to run once in a day which will rename the file for eg. sourcefile_old.txt or delete it.

So when the interface runs for the first time after script/batch execution, it will execute case#1(since sourcefile.txt is either deleted or renamed) mentioned above, in all other run it will execute case#2.

Hope this clarifies.

~SaNv...

Former Member
0 Kudos

HI Santosh,

Thanks for reply ,this means it will not overwrite the existing file ,it will create the new file with diiferent name.

Reagrds

Former Member
0 Kudos

HI Santosh,

Can you Plz responed.

Regards

Ganga

santhosh_kumarv
Active Contributor
0 Kudos

>>this means it will not overwrite the existing file ,it will create the new file with diiferent name.

It will not overwrite. PI Interface will create file with the same name, the script will rename the actual file to a diff file name every day..

~SaNv...

Former Member
0 Kudos

HI ,

Then in this case the duplicase will happenn beacuse we are sending all records on daily basis.

Regards

Former Member
0 Kudos

HI Santosh,

To meet our req can we make to communication channl .from ECC side In our structure will send the value if X=o then overwrite CC will be used and if X=1 the append CC will be used..........

Regards