Skip to Content

Scenario:</p><p>For the output file being created, the filename should have a sequence number as part of it. For example, the file name is to be</p><p>1. <outputFile>_<XXX>.txt, where XXX is a sequence number 000-999</p><p>(or)</p><p>2. <output>_<XX>_<file>.txt, where XX is a sequence number from 00-99</p><p>I gather the above is a very common requirement, but is there a standard way to achieve this in PI?</p><p> </p><p>My assumption is that there exists no standard option for such a common requirement but only work arounds.</p><p>Some of those workarounds I can think of is;</p><p>1. Maintain a table in SAP. Use/Code a RFC call to lookup the sequence number from this table, incrementing the value after it is read. The result is then used in a dynamic configuration code, and the file name can be generated at that point.</p><p>2. Use the similar approach but with a JDBC lookup and the data stored in a JDBC table. The same concept of dynamic configuration can be used once the value is retrieved to generate the file name.</p><p>3. Use an OS script that will do the job for us – How easy can that be?</p><p>4. Using a global container to capture the sequence – Doesnt help us since the variable will be flushed at the end of the mapping execution</p><p>5. Counter option in the adapter – Only helps if you are using the NFS protocol and also only if the counter is needed at the end of the file name (before the file name extension)</p><p> </p><p>So basically, arent we missing out a standard feature? I agree there are workarounds, but still such an option should be part of the standard configuration, either in the integration engine or the adapter engine. That is my say, what do you guys feel?</p><p> </p><p>1. Is it helpful to have this as a standard feature?

2. What are other workarounds you guys can think of for such a case scenario?

3. Any other thoughts around this topic of discussion?

Hope to see your comments on the above!!

 

To report this post you need to login first.

13 Comments

You must be Logged on to comment or reply to a post.

        1. Shabarish Vijayakumar Post author
          and surprisingly most real time requirements come based on ftp calls 🙂 anyway its upto the developer to have his comfort level around a script or a lookup call..

          Thanks for your comments Santhosh !!

          (0) 
  1. Robert Warde
    Shabarish,
    These are the sort of things people should  be blogging about. Thanks for the contribution.

    I’ve going down the RFC route. Although the server side script may be easier I prefer to keep everything inside PI. It makes it easier to monitor.

    It would be good if SAP could find some time to address this.

    Rob

    (0) 
    1. Shabarish Vijayakumar Post author
      Rob,
      Thanks for your comment.
      What drove me to blog this is the fact that many middlewares/service bus actually have this as a default feature. With PI maturing over the years, I guess common requirement such as these should be released as standard features. Have spend almost my entire career on XI/PI, things have improved a lot in the product but there is still a lot of room for more features that SAP should add

      Shabz

      (0) 
  2. Paul Medaille
    Why ot just use the built in counter for the file name?  In the receiver File communication channel, Processing tab, set the file construction mode to Add Counter, and then set the counter parameters accordingly.  This is a standard feature and requires no workaround…
    (0) 
    1. Shabarish Vijayakumar Post author
      the limitations of that would be my point 5;
      >>>>>>
      5. Counter option in the adapter – Only helps if you are using the NFS protocol and also only if the counter is needed at the end of the file name (before the file name extension)
      (0) 
  3. Michael Nicholls
    While I can understand why this looks like a useful idea, my feeling is that it will lead to more problems than it solves.
    If you want to make sure the names are unique and generated in a correct sequence, then you can use the filestamp feature. This handles issues with multiple file adpaters writing to the same directory, which could not be easily handled by building a counter into the adapter.
    In a perfect world the recipient of the messages should not be assuming that a file missing from a sequence is a problem. That feature should be handled by a control message of some sort.
    Playing with sequential numbers is always a hassle and I’d rather not make the file adpater responsible.
    (0) 
    1. Shabarish Vijayakumar Post author
      i agree and disagree 🙂
      but real time there has been many customers who have wanted to have this specific requirement and some very particular about it since their legacy/supplier/customer demands so
      (0) 
  4. Gautam Purohit
    Hi Shabarish,
    We have the same requirement where in client wants PI to maintain the counter sequence and also the counter is being passed as a field in file header. Hence standard counter feature of file adapter is ruled out.
    Quite a lot of systems are involved here and nearly 5-6 legacy systems need this feature.
    Still trying to check the best option.
    Please let me know if you have any suggestions
    (0) 

Leave a Reply