cancel
Showing results for 
Search instead for 
Did you mean: 

File adapter has to pick only fully written files.. Any way to do it?

Former Member
0 Kudos

Hi all,

I need to pick the files which is fully written.

Is there anyway we can tell in File adapter to pick the files which has written completly?

Right now the file adapter is picking the half written files and showing the warning as "Empty files" and the worse is that it is deleting the half written files.

Kindly anyone suggest how we can pick only files which have written completly.

Thanks

Seema

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi Praveen,

We have some of the files that are generated from SAP. So the jobs are divided into different part, first it collect all the information from the database and then the next one to collect all of them into a file. If the file size is more than 35Mb then it takes atleast 10min for dumping the data into a file .

So, in the mean time XI will pick the file and then it runs into error as because of partially written file . Faceing the problem we found some workaround for this and solve it.

Moreover , we are not certain about the job completion time , so we cannot schedule the time gap for file consuming..

Thanks,

JAY.

former_member181985
Active Contributor
0 Kudos

Hi JGD,

May be the file handling using different core languages (java, ABAP etc....) might be different.

As per my previous reply where I ran java program and checked if XI File Adapter picks the file but that is not happening.

Unfortunately I am not a ABAP expertise to simulate the same.

Thanks,

Gujjeti.

Former Member
0 Kudos

Hi Gujjeti,

No , It doesnot check the completion of the file. It just check the file name and pick it even though the file is half completed or just started to write it. If a file size is with in 1MB then it does not matter ,, But if the file file size is big then it first create a blank file along with the file name and then started writting it.

So, XI pick of the file checking it's file name. It does not care the content of the file.

Seema ,

Just let me know if you got a single file or multiple file to be processed in one time.

if it is a single file ,, do the following and hope this will work:

  • File is present in ../ABC/inbox/

and provide the same in CC

  • Write a script to check the end pattern.

If it fail to find the end pattern then again place the file in the same location.

  • As long as the file is present in the samelocation the script will continously check it.

  • Add the script in the Run operating Command before Message processing..

  • Once the file is completed the the script will be satisfied the condition and then XI will start processing the file.

  • But if you have multiple files then there may cause some problem in this perticular approach.

Do a lot of testing on this..

Do not forget to assign point ...

Thanks.

JAY.

former_member181985
Active Contributor
0 Kudos

Hi JGD,

Can you justify your explanation? I mean can you give a real example which I can simulate.

Mean while I tested the following java program which basically keeps on writing a string passed as argument, my program will never close the file stream as it runs in an infinite loop. So as per your explanation it should pick the file which is not happening and I am not seeing any message in MONI.

Java Code:

import java.io.*;

class TestWrite 
{
	public static void main(String[] args) 
	{
		BufferedWriter bw = null;
		int count = 0;
		if(args.length == 0)
		{
			System.out.println("Usage>java TestWrite passAnyString");
			System.exit(0);
		}

		try
		{
			bw = new BufferedWriter(new FileWriter("\\\\FilePolingDirectory\\filename.ext"));//give your XI file adapter pooling diretory
			System.out.println("Writing File......");
			while (true)
			{
				bw.write(args[0]);
				Thread.sleep(200);

			}

		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		finally
		{
			try
			{
				bw.close();
			}
			catch (Exception ne)
			{
				ne.printStackTrace();
			}
		}

	}
}

Thanks,

Gujjeti.

former_member181985
Active Contributor
0 Kudos

Hi,

As far as I know the File Adapter doesnt pick the files until unless the other application finishes writing the files.

Thanks,

Gujjeti.

Former Member
0 Kudos

Hi Guys,

The file is not coming from SAP. It is coming from someother tool and I do not know exactly when the files will fall into the folder which I need to pick. whenever it falls I need to pick the file but the adapter has to pick fully written file but not the one which is in the middle of writing. the file size will be anything.

Is there anyway our adapter can check to wait untill it finishes writing completly?

Hi Praveen,

>> As far as I know the File Adapter doesnt pick the files until unless the other application finishes writing the files.

even I felt the same. But adapter picking the file and showing warning as " Empty files cannot be processed" and it deletes the file immediately without processing and all that data will be lost.

Thanks

Seema

former_member181985
Active Contributor
0 Kudos

Hi,

That is what I am trying to convery, let the file be written by any third party tool or application apart from SAP.

I simulated this case, for me the file adapter is picking the file only after the application has written the file completely.

Simulation Case:

File Sender with 2 secs pooling time, no mapping in scenario and . file convention.

copied a 40 MB using windows copy command, any how it will take more than 2 secs to copy to the folder from where file adapter will pick the file.

I tried file sizes ranging from 10 MB to 60 MB. But the FileAdapter picks the file only after it gets copied completely.

May I know your XI version and Service Pack.

Thanks,

Gujjeti.

Former Member
0 Kudos

Hi reddy,

I think, I faced same problem in the past and I think it was solved by setting up 'Msecs to Wait Before Modification Check' parameter within advance mode tab of Sender File Adapter.

Msecs to Wait Before Modification Check

Enter the number of milliseconds that the adapter must wait before it checks whether the files have been changed.

This parameter is not available if you have selected File Content Conversion as the Message Protocoland then made an entry under Recordsets per Message that splits an input file into several messages.

Note

This parameter is applicable only for the File adapter. If you enter a value in this field when configuring the sender FTP adapter, it will have no effect.

Hope it helps you.

Carlos

Former Member
0 Kudos

Hi Seshagiri,

The poll interval can only be used to pick multiple file between that interval only. During the picking the picking of the second file the poll interval is used to maintain the time gap.I have also used this by increasing the poll interval but sometimes it pick the file within 2sec and sometimes in 1min..

And how comes you know that the file will be generated within that period of time. i mean suppose u expected the file to generated at 7:00am, and because of late run it may generated at 7:30 then, how comes you will check this.

Please let me know if i am wrong.

Thanks,

JAY

Former Member
0 Kudos

Hi Jay,

YES, You are right.

I dint thought this, thank you for the Info...

In this case it is better to Schedule the File Adapter particular time in a day

OR

He can follow the suggession given by You

Regards

Seshagiri

Former Member
0 Kudos

Hi,

Estimate the time to wtite the file completly into folder

And based on that parameter, set the Poll interval in the Sender File Adapter

So by this the file adapter will wait that time to pick the file again, in this time the file will be written completly into folder so that it can pick the complete file

Regards

Seshagiri

Former Member
0 Kudos

Hi Seema,

You can do that using a script,,

  • Generated the file from SAP in one folder,(../SAP/ABC/outbox)

  • Write a script that will check the end character or few last line pattern and then copy it to a new directory..(../SAP/ABC/outbox_post)

  • Pick the file from the ../SAP/ABC/outbox_post for the processing...

thanks,

Assign Point if helps..

JAY.