cancel
Showing results for 
Search instead for 
Did you mean: 

File /FTP adapter -> Need to pull files that are 2 or more days old

Former Member
0 Kudos

XI experts,

We have SAP XI 3.0 in our landscape and have a unique requirement in XI where the business wants to pull files from File system only those files that are 2 or more days old .

I can do this by pulling all files thru a file adapter and then calling a proxy in R/3 to check the File Timestamp .. This file time-stamp will be mapped in XI using a Java function for accessing adapter specific attributes .

BUT , can we have some selection criteria in the file adapter itself where it will pull only those files that are 2 or more days old .... Maybe something in the Adapter modules ??? Would appreciate your reply .

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Ashutosh,

I think as suggested writing an small command level script would be easy way to check file date..

Otherwise you need to write File Adapter -module before to validate date-time.

Check out this blog if you are planning to write a module...

/people/sap.user72/blog/2005/07/04/read-excel-instead-of-xml-through-fileadapter

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/da5675d1-0301-0010-9584-f6c...

Hope this will help you.

Nilesh

Former Member
0 Kudos

Nilesh ,

Thanks for your reply .. I think i can use feature of writing an OS level command to check the file date .... BUT i have one more question ..

Can the OS command that i write in the ' Run Operating System Command After Message Processing ' section of the sender File adapter , STOP file adapter processing according to the date identified in the command ....

Like , if the command finds that the file date is recent , then somehow it should let file adapter know that file should not be processed .. Is this possible ??? If yes. HOW ??? This way i will not un-necessary process a messsage in XI , only those messages with old file date-stamp will be processed ...

I would like to stop the processing at the adapter framework itself if the condition is not met .......Would appreciate your reply .

Former Member
0 Kudos

Hi Ashutosh,

I think if you able to raise an exception in Command Script itself...it shd stop processing..

Check out Michal's blog....I have read somewhere in his blog / thread...

Let me check if I can find out..

Nilesh

Former Member
0 Kudos

Ashutosh,

Check out thread...check out the reply from Guru..Something interestic...really helpful for your scenario...

I think this will solve your issue... ( Guru's reply is fantastic...even I learned something tricky way of handling file..)

Nilesh

Former Member
0 Kudos

Nilesh ,

Thanks for the tip and the Blog link ... Well , i think Guru's trick might help...One last question ( i guess ) .. Where do we save this command file that we will use in the adapter before/after message processing ??? I am still confused in this area .... We have SAP R/3 4.7 as the application system and SAP XI 3.0 ,,, so where does this command file reside ??

Would appreciate your reply .

Ashutosh

Former Member
0 Kudos

Hi Ashutosh,

Check out this Michal Blog..

/people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching

Some usefull tips /trics are mention in question forum..I mean in comment..

Also check out this thread and blog as well..

/people/sameer.shadab/blog/2005/09/21/executing-unix-shell-script-using-operating-system-command-in-xi

Hope this will help.

Nilesh

Former Member
0 Kudos

Nilesh ,

Thanks for all the replies and good helpful answers ...

I think i am going to follow Guru's trick by writing a small shell script before/after message processing. ..

I will surely let you know when i complete this ..

Thanks for all your time and efforts.

Ashutosh

Former Member
0 Kudos

You are welcome Ashutosh!!

Let us know the result...n how you achieve that...would be some good learning for others as well.

Nilesh

Former Member
0 Kudos

Nilesh,

If my issue gets resolved , then i will change the 'Reward point ' of your last reply to ' Solved Problem ' ....

Will let you know ...

Bye for now ..

Ashutosh

Former Member
0 Kudos

Nilesh ,

Writing after some weeks gap , BUT if you remember this discussion , i was trying to execute an OS command file from File adapter , i was going to try Guru' trick ... AND FYI -> I tried his trick of having a dummy file and then writing a Unix shell script command file to be called from File adapter which changes the name to the file name that adapter is suppose to poll....... BUT i found out that adpater executes the OS file only when it finds the file ,,, therefore the file that the adapter is polling should be present in the source directory and then it executes the OS command file .. ANYWAY , what i did is i am having a dummy.txt file which my adapter will always poll and then my OS command file will find old files on the directory that i want and change the filenames to (filename)_OLD.txt and i am calling a ABAP proxy which will then connect to the directory i want and access all files that have _OLD as suffix in the filenames.

Well , i think i can even do this without XI by triggering my ABAP program and doing the same stuff as mentioned above , BUT bottom-line , the OS command file works and point to mention is : OS command file is executed by adapter only when the file it polls is found by the adapter. ....

Thanks for everything and Convey my Thanks to Guru if you happen to be in touch with him ..

Regards,

Ashutosh

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello,

You can use the option

"Run Operating System Command Before Message Processing".

Check if the file is old enough or not to be processed from the Filename.

Regards,

Former Member
0 Kudos

1) Try Using Processing Sequence (for transport protocol File System (NFS))

If you use placeholders when specifying the file name, define the processing

sequence of the files:

○ By Name: Files are processed alphabetically by file name.

○ By Date: Files are processed according to their time stamp in the file

system, starting with the oldest file.

2)Try developing a module for achieving the functionality, and deploy the same.

3)Use the Adapter-Specific Message Attribute

<b>Source File Timestamp</b> and ,Use the value of the same for discarding te file content of those files which are not 2 days old..

*Reward points if helpful*

Regards,

Sushil.