cancel
Showing results for 
Search instead for 
Did you mean: 

File Processing

former_member223432
Participant
0 Kudos

Hi Gurus,

I have requirement to fetch a file from a Folder which has 2 files..one is actual file and other one is triggerfile(empty content).

u2022 A file should only be picked up if trigger file with the same name is available. I did put a file without trigger file and that file was processed. That should not happen because this means that it is possible that PI is processing files which are not complete yet. trigger file is used to indicate that all records are written and the file is ready to be processed.

How can i achieve this in PI..please advice.

Your help would be really appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

former_member184681
Active Contributor
0 Kudos

Hi,

I do not think it is possible to achieve what you require with PI configuration.

Is it possible to influence the way your file is created? If so, try doing it the same way PI does it in Receiver File Adapter: have your file created initially under a different name, and once the file is completely created, change its name. At the same time, use file name filtering in PI's Sender CC.

Hope this helps,

Grzegorz

former_member223432
Participant
0 Kudos

HI Grzegorz,

Thanks for your prompt reply...

Could you please elobarate more on this "Is it possible to influence the way your file is created?""

How to use file name filtering in PI's Sender CC??

your help would really be appreciated.

Thanks

Former Member
0 Kudos

Hello,

You can proceed with any one of the following:

1. Convince your client to write the main file & trigger file in a TEMP folder. And once the file has been written completely, ask them to run a background job and move the main file to the actual folder from where the PI Sender file adapter picks up and processes further.

2. Write/Execute an OS command (Batch/Shell Script) before processing of message to check for both the files. And pick up the main file for processing when the trigger file is available for the main file. You can can this OS command from the File Sender adapter from PI before the processing

3. There is an option available in PI FIle Sender adapter (in additional tab) which checks if the file is growing in content/size (millisecs to wait before modification check). You may use this in your file sender adapter and simply ignore the trigger file (this would be just a dummy file from your client & PI will ignore it and just process the main file when it is complete and ready to be processed).

Please check the following for details:

http://help.sap.com/saphelp_nwpi711/helpdata/en/44/682bcd7f2a6d12e10000000a1553f6/content.htm

Hope this helps.

Regards, Gaurav

former_member223432
Participant
0 Kudos

Thanks Gaurav....Wish i could reward you with more points...problem solved.

Answers (7)

Answers (7)

former_member223432
Participant
0 Kudos

Thanks grzceg, problem solved

former_member184681
Active Contributor
0 Kudos

Hi,

I got a solution for you finally! Have a look at this help document:

http://help.sap.com/saphelp_nwpi71/helpdata/en/44/692ab8a4b633eae10000000a1553f6/frameset.htm

All you need to do now is use following configuration:

1. Define an <Additional File 1> in File List parameter.

2. Specify the part of your file name that needs to be replaced to get the name of the trigger file as the value of <Additional File 1>.namePart parameter. For instance, use ".txt"=".trg" if your original file's extension is .txt and trigger file's extension is .trg. Both files must be placed in the same directory and have their names almost identical (except for the part you define here).

3. Set the <Additional File 1>.optional parameter value to NO. Thanks to this, your message will not be processed if the trigger file does not exist.

Note that you can have access to the additional file during message mapping (although this does not seem necessary in your case). You also need to be aware that every time your original file starts to be processed, but no trigger file exists yet, message processing will be canceled with an error message. But as far as we know until now, there is no better solution to solve your problem.

Hope this solves your problem finally,

Greg

former_member184681
Active Contributor
0 Kudos

Hi,

The actual shell script depends on PI's operating system. If it is Windows, try using this shell script code:

if mkdir "%F:~-4,4%.EXT" exists (
  del mkdir "%F:~-4,4%.EXT"
  move %F c:\destination\directory
)

You might need to put that code in a .bat file to have it executed.

Additionally, use the extension of your trigger file instead of EXT and your target directory for further processing instead of c:\destination\directory.

Hope this helps,

Grzegorz

former_member223432
Participant
0 Kudos

Thank you so much Grzeg...

just want to understand ur code....it will just look for .TRG(EXT) files..if presen, delete and move the remaining files to the destination provided...am in right??

Could you also please let me know where do i write this peice of code and execute....kindly help.

Your help wold realy be appreciated.

Thanks

former_member223432
Participant
0 Kudos

Any valuable suggestions please?

Will my shel script works for FTP with FCC? thanks in advance.

Regards

former_member223432
Participant
0 Kudos

Any Valuable suggestions please??

your reply would really be appreciated...

Regards

former_member223432
Participant
0 Kudos

Sorry guys, the option 1 given by Gaurav wont work for my requirement as i have File content conversiona and option1 works only with NFS

Former Member
0 Kudos

Hi ,

Write a OS command in the file sender communicational channel, that script should check both the files.. when both the files are generated on the specific folder move the actual file into another folder where file adapter should pick.

This should be an easy way for your requirement....

former_member223432
Participant
0 Kudos

Hi Harleen,

Do you have any idea as to how to write OS command in the file sender channel?

your inputs would really be appreciated.

former_member184681
Active Contributor
0 Kudos

In your sender File Adapter, you can specify exact Source Directory and File Name. But alternatively, you can mark Advanced Selection for Source File and specify the desired files as: Directory + File Name Mask + Exclusion Mask. Find further details [here|http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/content.htm] if required.

Could you please elobarate more on this "Is it possible to influence the way your file is created?"

What I meant is: is the file generated by a custom application that you can adjust when necessary? Are you able to develop it the way I described it? Or is it a standard behaviour of a 3rd party system that you cannot influence/change?

Hope this helps,

Grzegorz

Former Member
0 Kudos

if ur main concern is to pick the completly written file then instead of creating the triggering file u can use "Msecs to Wait Before Modification Check" option



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

http://help.sap.com/saphelp_nw73/helpdata/en/44/682bcd7f2a6d12e10000000a1553f6/content.htm