Skip to Content

File Processing

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

  • Best Answer
    Posted on Jan 12, 2012 at 12:49 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 12, 2012 at 01:18 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 12, 2012 at 01:22 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 12, 2012 at 02:09 PM

    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....

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 12, 2012 at 06:53 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 12, 2012 at 08:08 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 16, 2012 at 09:43 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 06, 2012 at 04:38 AM

    Thanks grzceg, problem solved

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.