cancel
Showing results for 
Search instead for 
Did you mean: 

ignoring the file in sap pi

0 Kudos

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

Accepted Solutions (0)

Answers (5)

Answers (5)

michael_hall1
Explorer
0 Kudos

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

bhagya_nayanala
Explorer
0 Kudos

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

former_member182412
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

*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!

Former Member
0 Kudos

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.