cancel
Showing results for 
Search instead for 
Did you mean: 

Identify current days file to be processed

former_member194786
Active Contributor
0 Kudos

Hi Experts,

We have a requirement wherein we receive files from a 3rd party daily. However, at the 3rd party end they have a restriction that they maintain the last 7 days files in their FTP directory.

Our requirement is that once the file is transferred to NFS, we need to process only the current days file from the 7 files available. What are the possible ways to handle this without having to make a change in existing design in PI?

One way that we could think of was to use script to identify the file using the file name (which has date in it) and then delete all the other files.

Would like to know your views on this.

Regards,

Sanjeev.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sanjeev,

really interesting "issue"... I would like to have a "pure PI" solution but see my suggest

I'm quite sure it's probably possible to do this selection by enhancing your FILE Adapter with a specific Module: by checking the filenames vs the current date... but unfortunately I did not do yet.

Of course, another way should be to have another inbound directory like "ToBeProcessed" compare to directory "Last7files" providen directly on Legacy server... if they have some flexibilty on their process....

But as it seems it's not the case (?!), I suggest to define this "ToBeProcessed" directory on one of your file server. So to ask to your admin team to:

1. have your own file server (not this one of your third-party).

2. create a litle FTP command (or Unix script) to pick-up the good file (current date) and move it to your "TobeProcessed" directory on your file server.

Simetime we have such script in most of the case to rename the Third-Party filename to our own naming convention.

With this solution, you don't change your PI interface, but just the source server/directory in your CC. So easy for PI.

Have you ask the question to your server admin team ?

Regards.

Mickael

former_member194786
Active Contributor
0 Kudos

Thanks for the suggestion Mickael. Appreciate the quick response!

Yes, that is what we are plannig to do as of now. That is, we will have a "Temp" directory where all the 7 files will be placed initially. Then a script would move the current day's file to the "toBeProcessed" directory and other files will be discarded.

However, what I would like to understand if there is any other better solution to this.

Answers (2)

Answers (2)

bhavesh_kantilal
Active Contributor
0 Kudos

Sanjeev,

1. Use the File adapter ASMA propoerty - File TimeStamp.This has the File Date Time Stamp of the last modification of the file.

2. Have a Enhanced RD that checked, the ASMA property with the Server Current Data Time. If they match, set the receiver. If they do not match, then ignore message.

Set the Enhanced RD to "ignore if no Receiver found ".

Avoids custom scripts and will work like a charm.

Ofcourse you might argue that I do not want to read all 7 files into XI but then this is a more scalable and configurable solution than a script.

My 2 cents worth!

Cheers,

Bhavesh

Former Member
0 Kudos

hi Bhavesh,

personally I like it (*) and I will be less stupid after this day. Thanks for this 2 cents worth.

Sanjeev, I let you to give points to Bhavesh. else here the link relating to Bhavesh' solution.

[Help sap - Determining a Receiver Dynamically|http://help.sap.com/saphelp_nwpi71/helpdata/EN/b9/64663c7a6c2545ae292fb26d8c33c4/frameset.htm]

regards.

Mickael

(*) (if source file size is not too big, as the 7 files will be read instead of one),

Shabarish_Nair
Active Contributor
0 Kudos

The only problem with using the SourceFileTimeStamp approach is that the unwanted files too will be read and loaded into PI. But if that is a manageable factor, then you have your solution.

- this is something we had done for a similar requirement.

former_member194786
Active Contributor
0 Kudos

Thanks Bhavesh/Shabarish,

Yes, this is something that we had considered. However, since we are already live with this interface, not very willing to change the interface at this point of time. Lets see how it goes.

Appreciate your inputs.

Regards,

Sanjeev.

Former Member
0 Kudos

Hi Sanjeev,

I assume that, file name will have a timestamp (date and time) in your case. If that is the case, when third party provides you the 7 days files and in which you only need to pick up current day files.

To make sure that, PI file adapter picks up the current day files, you can use Dynamic configuration UDF in the mapping and make sure that, PI File adapter searchs the files in source directory with file name schema like <currentDate>.txt.

Modifying file name schema every time with currect date is possible with Dynamic configuration program. Please let me know if you need more help in writing this Dynamic Configuration code in MM.

Regards,

RK