cancel
Showing results for 
Search instead for 
Did you mean: 

reading file sequentially from FTP using SAP PI file adapter

Former Member
0 Kudos

HI,

I am using SAP PI 7.11 (OS-Windows)

I have a interface where file is being read from a FTP location, using file adapter (sender file communication channel).

The requirement is to read the files from the FTP server one by one (sequentially), maintaining a gap of few minutes between each file access.

I am not allowed to use any OS level script.

Can this requirement be achieved using SAP PI alone.

thanks n regards

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

HI All,

Thanks for all responses. Finally i have decided to use a script at OS level to move files from one folder to another introducing a delay, as i think its easy to implement without disturbing the existing interface design.

But now struggling with another hurdle. In the OS level (Windows 2008) i have scheduled the script to move files every 1 min. But the client requirement is to have lesser duration. And in Windows 2008, there is no option to schedule a job with interval of less than 1 min. Trying to see if that can be done somehow.

Former Member
0 Kudos

Hi Sudeep,

Follow up question if possible, you said "And in Windows 2008, there is no option to schedule a job with interval of less than 1 min". Did you find a solution to overcome this?

Thanks,

Jake.

Former Member
0 Kudos

Hi Sudeep

Use EOIO in sender adaptere and then go for BPM. In NWBPM the delay can be put easily. Check the

blog below

http://scn.sap.com/community/bpm/blog/2013/09/27/sequential-split-of-messages-and-looping-in-nwbpm-p...

anandvithal
Active Participant
0 Kudos

Hi Sudeep,

You can easily add delay between files by using sleep/choice command in file channel "Run opearting system command after message processing"

If you have unix system use sleep command

this will introduce a delay of 60 secs between files

if you have windows system use choice command:

choice /c:yn /t:60 /d:y

Thanks,

Anand

anupam_ghosh2
Active Contributor
0 Kudos

Hi Sudeep,

                   You can try

1. Use QOS as EOIO to read files sequentially.

2. you can provide arbitary name of the queue.

3. You can use java mapping (in case this is a pass through scenario) to introduce a delay of 1 minute.

Even you can randomly set this delay interval. If this is not a pass through scenario you can use UDF also to introduce delay in the scenario.This way you can ensure that there is a few minute delay between processing of files. Please check this thread http://scn.sap.com/thread/3433549 and my response to it. This logic is to be transformed into java mapping.

Regards

Anupam 

Former Member
0 Kudos

Hi Anupam,

I tried your solution, but it is not happening. it is rather behaving abnormally.

Steps i followed:

1. QOS=EOIO in sender channel.

2. intruduced delay in Java mapping (by writing code Thread.sleep(120000))

But now the scenario behaves unexpectedly.

I have some 24 files in the source folder.

As the sender channel polls the folder, all messages are picked and sent to Integration Engine ,as seen in SXI_MOMNITOR (being processed throuh the same queue).

But the queue processes files in bulk. Sometimes messages get processed together producing four files in the output folder, and sometimes 5 files get processed together.

anupam_ghosh2
Active Contributor
0 Kudos

Hi Sudeep,

                    If this is not working I think Ambrish's solution with BPM is the safest one.

Only I wanted to avoid BPM therefore suggested the solution.

Regards

Anupam

former_member190624
Active Contributor
0 Kudos

Hi Sudeep,

why don't you try Changing  QOS(file channel-> processing tab) to Exactly Once In Order(EOIO) and provide a queue name.

Thanks

Hari.


Former Member
0 Kudos

Hi Hari,

Thanks... need few clarifications:

If i use QOS as "EOIO":

1. Will the files get read sequentially?

2. Can i give any arbitrary name for the Queue?

3. Will there be a delay between the file access? Will this be equal to the "Poll Interval" defined in the channel?

regards

Muniyappan
Active Contributor
0 Kudos

Hi,

If i use QOS as "EOIO":

1. Will the files get read sequentially?

Yes.

2. Can i give any arbitrary name for the Queue?

yes. you can give any name as your wish.

3. Will there be a delay between the file access? Will this be equal to the "Poll Interval" defined in the channel?

You can not make delay with the help of EOIO. say if you set poll interval as 60s after this time adapter will poll the directory and pick the files. if 10 files found, all will be processed with in a matter of second. so it will not provide any delay in here.

Regards,

Muniyappan.

ambrish_mishra
Active Contributor
0 Kudos

Hi Sudeep,

If you had looked at the thread I mentioned, it clearly mentions EOIO will not induce any delay,

Ambrish

ambrish_mishra
Active Contributor
0 Kudos

Hi Sudeep,

I don't think it is possible to read the files sequentially with a gap of few minuites.

You may have to pick the files (By Date) and then use BPM for this scenario to induce delay.

One thread which discusses the same requirement https://scn.sap.com/thread/1472536

Cheers,

Ambrish

Former Member
0 Kudos

hi Ambrish,

Can u elaborate how BPM can be used in this case?

My understanding is, if we have a File->BPM->File interface. The sender channel will poll all files in the source folder simultaneously and create multiple instances of the BPM, producing all output files simultaneously.

Even if we use EOIO in the sender channel, it may not help. As i have tried EOIO and delay induction through UDF (which didnt work).

Thanks for helping.

ambrish_mishra
Active Contributor
0 Kudos

Hi Sudeep,

EOIO with UDF or Java mapping will not work because the file might be picked up sequentially but might be processed within a second with delay in each message which does not induce a delay in message processing becasue all the threads (messages) execute independently.

>>>> how will the BPM work.

Please check Baskar's reply in the thread http://scn.sap.com/thread/2038059.

Hope it clarifies else revert back here pls.

Ambrish