cancel
Showing results for 
Search instead for 
Did you mean: 

Condition in receiver determination

Former Member
0 Kudos

Hi all,

I have a scenario where a source message contains multiple records. In each record there is one field "f1" which can have one of the predetermined values - say "A" or "B". At runtime source message may contain all the records which have f1="A", or it may contain all the records which have f1="B", or it may contain some records having f1="A" and the rest having f1="B".

Further, I have two receiver services - say "Rec1" and "Rec2" in my scenario.

Now I want to give a condition in the receiver determination that if the source message contains at least one record in which f1 has value "A", then the receiver should be "Rec1". Similarly, if there is at least one record having f1 = "B", then receiver should be "Rec2". In the subsequent interface mappings (i.e. message mappings) I am segregating (splitting) the records depending on whether they contain f1="A" or "B", so that the records having f1="A" go to "Rec1" and those having f1="B" go to "Rec2".

I tried several combinations of the condition, but I am getting incorrect results. Can someone pls let me know whether this is possible ? And also what would be the exact condition expression ?

Regards,

Shankar.

Accepted Solutions (1)

Accepted Solutions (1)

Jitendra_Jeswan
Contributor
0 Kudos

Hi No need to go for BPM , in this case.

You can write Enhanced Receiver Determination.

In IR you have to write a Mpping with SAP_BASIS_Receivers and IM which would be able to determine Receivers on the basis of Condition.

In ID in the Receiver Determination you will select Enhanced and choose the Interface Mapping that you created in IR.

got to this link to know hot to use SAP_BASIS_Receivers for determining Receievers in the scenario like you mentioned

/people/venkataramanan.parameswaran/blog/2006/03/17/illustration-of-enhanced-receiver-determination--sp16

Regards.

Jeet.

Dont forget to Reward points

Former Member
0 Kudos

Thanks Mike and Jeet for your responses.

However my requirement is - I need to "bundle" all A-type records and send that single message to Rec1. Similarly, bundle B-type records and send that message to Rec2.

So I want to design a generic solution which will work irrespective of whether the source message contains only A-type records, or only B-type records, or a mix of both.

Jeet, I had thought of enhanced receiver determination using SAP-provided Recievers message type. But I don't think it can help me, because it will assign receivers for "each" record in the source message. So if the source message contains 5 records of type "A", then in the target message, the mapping will generate 5 nodes of Rec1. Further, the records in source message can be interleaved. So they have to be sorted first.

Any clues ?

Reagrds,

Shankar.

justin_santhanam
Active Contributor
0 Kudos

Hey Shankar,

I gave the solution to the same scenario in the other thread. Forum is not allowing me to copy the thread and paste it here. Please do the following selectiong criteria you will find the thread.

In the search criteria

Date range : Last Year

Search Terms : Linsy Scaria

You will get the below thread name in the top of the list

Re: Condition In Receiver Determination Not Working - Open that thread go to the 3 page and see the solution.

Hope it might solve ur scenario.

raj.

Jitendra_Jeswan
Contributor
0 Kudos

Hi shankar..

We have done the same thing in here and usd the approach as suggested by me.. in this thread...

We had used a UDF function to bundle the records that has "A" and other group which is for "B"(if present) and then sent it to the corresponding Receivers...

It wrked fine. If you provide me with your source data , I might help you getting the solution strt away !!

Regards.

Jeet.

Former Member
0 Kudos

Thanks to all for your suggestions. My problem has been solved. Earlier, I didn't use '//' so the scenario was not working. It was just the matter of putting correct XPATH expression in the condition, as mentioned by Raj.

I put the condition as -

(p1:Source_MT/record[//type='A'] EX) ---> Then receiver should be Rec1

And then it worked.

Regards,

- Shankar

Answers (1)

Answers (1)

Former Member
0 Kudos

For simplicity you may consider putting the logic in the Design and not the Config

Design

In the BPM, loop through the data and for each record check the field value of f1.

If f1 = ‘A’ then increment a container variable (eg CtrA).

When all records are checked, use a branch step with a condition that checks the container variable CtrA.

Branch one way if CtrA > 0 and map your data to Message Interface 1.

Branch the other way if CtrA = 0 and map your data to Message Interface 2.

Of course there will be a corresponding Send step

Config

Now you can configure two Receiver Determinations.

Receiver Determination 1 uses Message Interface 1 --> Configured Receiver Rec1.

Receiver Determination 2 uses Message Interface 2 --> Configured Receiver Rec2.

Hope that this helps

Finally, what do you do when your source data contains multiple A and multiple B (you say that this may also occur)?

Send to both receivers?