Skip to Content
0

ignoring the file in sap pi

Oct 27, 2016 at 05:48 PM

246

avatar image

Dear Experts,

I have a file to file scenario. Requirement is based on the value in the file,PI needs to ignore the file from either end.

Please let me know is it possible to ignore the file based on the content in the file?

Thanks,

SAI

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

avatar image
Former Member Oct 27, 2016 at 10:40 PM
0

I think it may not be possible to ignore them on the sender side if you cant differentiate them with a naming convention/ masking. You will be able to ignore it so that it wont reach receiver side, if you can get to write a condition in receiver determination. Chose ignore option when you configure receiver determination when no receiver was found.

Tricky part is to get your condition from the file content.

If your file is XML you might be able to write XPATH condition. If not you may have to write a module which parses the file content and places the result of your criteria into one of the context variables ,say File Type, if you are not using it for anything else and use it in the condition expression for receiver determination.

You can always add archive option to not lose the sender side files after they are ignored at the routing step.

Better approach would be to filter them at the source to have different naming or write a script which separates the files into different folders at OS level based on your criterion.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Oct 28, 2016 at 02:13 AM
0

*sigh* my original reply was rejected by the website due to a 'malicious attack' error... and i cant retype all the detail. Long story short;

You can do this with message mapping.

  • Sender communication channel on File Content Conversion
  • Content conversion parameters filled (scn blogs have examples if required)
  • Create a message type that is an XML version of your file and assign it to your service interfaces.
  • Create a message mapping to map the message type (assuming target and source types are the same).
  • In the message mapping, use a createif on your root element, using your specific field you want to check for your value / your logic for ignoring or not.
  • Important to remember that cardinality of message type elements is important. It will need to be 0:1 or 0:n in order for there not to be a mapping error when the mapping decides to suppress the root element.
  • Receiver communication channel on File Content Conversion
  • Content conversion back to your original format (scn blogs have examples if required)

Alternatively i'd suggest a cronjob/shell script (linux) or a batch script (windows) to read your file and then either delete or rename it depending on your needs. I'd rename it and add a suffix that your sender communication channel could then look for.

Good luck!

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Oct 28, 2016 at 02:59 AM
0

Hi Sai,

If you wan to pass the file as it is without any transformation then use enhanced receiver determination with operation mapping option and write java mapping to determine the receiver, In the java mapping you will get the payload as string then you can find your string which you want validate, if you find the string then don't set the receiver and if you don't find the string then set the receiver and in the receiver determination select the option ignore when no receiver could be determined then file will be ignored when the receiver could not be determined.

Regards,

Praveen.

Share
10 |10000 characters needed characters left characters exceeded
Bhagya Nayanala Oct 28, 2016 at 07:25 AM
0

Hi Sai

You can do this at mapping level but it would show as Mapping Error. To avoid this, you can use Xpath expression in Receiver determination condition like below.

Provide the condition.

Choose Ignore when Receiver not found.

This would not show as error in Monitor.

Regards

Bhagya


2pj0s.png (35.9 kB)
Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 12, 2017 at 08:32 PM
0

I have a similar requirement but cannot get the "ignore if no receiver is found" to work. In this instance, there is a file that matches first condition and another that does not. In fact, even with the 'ignore' box checked, the sender comm channel shows an error (below) for the bad file and does not do anything with the good file. Could there be some global configuration that is hindering this option?? Our solution is to write out all unnecessary files elsewhere and then delete at a later time.

Application attempting to send an XI message asynchronously using connection Error Returning to application. Exception: com.sap.aii.adapter.xi.routing.RoutingException: InterfaceDetermination did not yield any actual interface

Share
10 |10000 characters needed characters left characters exceeded