cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI - Determine the receiver based on Source FileName

pi_consultant1
Participant
0 Kudos

Hi all,

Ive an issue regarding receiver determination based on a Source FileName.

Ive a file to file scenario without any ESR objects. 

The FileNames look like this:

CRM_12345_TimeStamp
CRM_<all Other Values>_TimeStamp

Based on the source FileName I need to send Files containing the value 12345 to Receiver 1 and all Files containing other values except 12345 to Receiver 2

I try this in the Iflow:

(ContextObject.FileName CP "*12345*") --> Reiceiver 1  --> This is working

(ContextObject.FileName != "*12345*") --> Reiceiver 2  --> This is NOT working

Ive red that (Not) Equal to with a Wilcard (*) is not working.

So what is the solution here? How can I achieve this and solve this issue?

Your help is appreciated,

Kind regards

John

Accepted Solutions (0)

Answers (5)

Answers (5)

caner_genis
Explorer
0 Kudos

Hi John,


@pi_consultant1 wrote:

Hi Caner,

I selected the Receiver 2 as a default Receiver and when I test it with 2 receiver it works 🙂

But I didnt think it would matter but there is also another Receiver where all file should go to. 

So when I add this receiver (receiver 3) than the files dont go to default receiver (Receiver 2) anymore. 

Any idea why is that? And how to solve it?

Thank you!


"Default Receiver" selection works as "otherwise". If the iFlow cannot find any receiver, the "Default Receiver" becomes the receiver. In your case "Receiver 2" cannot receive files if it defined as the "Default Receiver" and "Receiver 3" is the receiver where all file should go to.

In this case, it's necessary to define the correct Xpath statement for "Receiver 2".

Good luck.

Caner.

pi_consultant1
Participant
0 Kudos

Yes, I tested that and it didnt work.

Also I tested it with different Xpath statements and it is still not working. The latest Xpath Statement I used and its not working is this:

[not(contains(ContextObject.FileName, '12345'))]

And I use it as this in the editor:

pi_consultant1_0-1713517029437.png

Any suggestions?

 

caner_genis
Explorer
0 Kudos

Hello John,

"Select the Following Receiver" option is located in Integrated Configuration. In iFlow in NWDS, you can use the "Default Receiver" selection under "Routing Behaviour".

RoutingBehaviour.png

Can you try entering the xpath query as shown in the picture?

XpathExpression.png

Caner.

pi_consultant1
Participant
0 Kudos

Hi Caner,

I selected the Receiver 2 as a default Receiver and when I test it with 2 receiver it works 🙂

But I didnt think it would matter but there is also another Receiver where all file should go to. 

So when I add this receiver (receiver 3) than the files dont go to default receiver (Receiver 2) anymore. 

Any idea why is that? And how to solve it?

Thank you!

pi_consultant1
Participant
0 Kudos

Hi Caner,

I tried every possible XPath expression and its not working.
Do you have any other suggestion? 

Any help would be appreciated,

alex_bundschuh
Product and Topic Expert
Product and Topic Expert
0 Kudos

if you can't sort out the xpath, you may only define one condition for the first receiver, the one containing the string, and then use default receiver option for the second receiver if receiver can't be determined

Alex

pi_consultant1
Participant
0 Kudos

Hi Alex,

Thank you for your response...

I selected the Receiver 2 as a default Receiver and when I test it with 2 receiver it works 

But I didnt think it would matter but there is also another Receiver where all file should go to. 

So when I add this receiver (receiver 3) than the files dont go to default receiver (Receiver 2) anymore. 

Any idea why is that? And how to solve it?

Thank you!

RAHEEL_BABAR
Active Contributor
0 Kudos

Hi,

For Receiver 1: Route files with "12345" in the filename to Receiver 1. For Receiver 2: Route files without "12345" in the filename to Receiver 2.

 

Here's how you can adjust your iflow conditions:

  1. For Receiver 1 (Files containing "12345"):

    • Condition: (ContextObject.FileName CP "*12345*")
    • Action: Route to Receiver 1
  2. For Receiver 2 (Files not containing "12345"):

    • Condition: !(ContextObject.FileName CP "*12345*")
    • Action: Route to Receiver 2

Regards

pi_consultant1
Participant
0 Kudos

Hi,

Unfortunately this condition is not working: !(ContextObject.FileName CP "*12345*")

I get the following error:
Lexical error at line 1, column 4. Encountered: "d" (100), after : "Con"

I tried it already with Not and != symbols as well...

caner_genis
Explorer
0 Kudos

Hello John,

For all conditions where the condition is not met, you can use the "Select the Following Receiver" radio button at the bottom.

If Xpath must be used, can you try the query as follows?

not(contains(ContextObject.FileName, '12345')

Good luck.

Caner.

pi_consultant1
Participant
0 Kudos

Hi Caner,

Thank you for your response...

Which "Select the Following Receiver" radio button at the bottom, do you mean? Where can I find this?

And I tried, the XPATH expression you suggested and this is what the expression: ContextObject.FileName expects, so a Comma wont work. 

pi_consultant1_0-1713441280580.png

Thank you,

Regards,

John