cancel
Showing results for 
Search instead for 
Did you mean: 

Multimapping with Condition

Former Member
0 Kudos

Hi,

Can anyone tell me how to do 1:n multimapping wherein, depending upon one key node of the input file , it has to be posted to different receivers?

Input FILE

<main data>

</main data>

<local data>

<key1>key</key1>

<data1></data1>

<data2></data2>

</localdata>

<local data>

<key2>KEYS</key2>

<data1></data1>

<data2></data2>

</localdata>

OutputFile

<local data>

<key1>key</key1> -


> Receiver1

<data1></data1>

<data2></data2>

</localdata>

And

<local data>

<key2>KEYS</key2>

<data1></data1> -


>Receiver2

<data2></data2>

</localdata>

Please suggest.

Thanks & Regards,

Suishama

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

> depending upon one key node of the input file , it has to be posted to different receivers?

One more question, as you said in the begining that based on key node it has to be posted to different receivers, So do you know how may different keys can be there in your input file? Because as per the blog for each different key you have to create a new mapping.

Now coming to your second question

>Also, the blog 3343 is good for 2 receivers. But, there can be more than 2 receivers. So, i cant put ifelse condition?

>Should i create UDF for that also?

You can modify the same UDF to get multiple receivers like this..

Let's say I need to get 3 receivers based on my key values so you can modify the code as mentioned below..

int i;
int key1=0;
int key2=0;
int key3=0;
for(i=0; i<a.length;i++)
{
       if( a<i>.substring(0,4).equals("key1") && key1==0)
       {
             result.addValue("key1Service");
             key1=1;
      }
      if( a<i>.substring(0,4).equals("key2") && key2==0)
       {
             result.addValue("key2Service");
             key2=1;
      }
  if( a<i>.substring(0,4).equals("key3") && key3==0)
       {
             result.addValue("key3Service");
             key3=1;
      }
}

Regards,

Sarvesh

Edited by: Sarvesh Singh on Dec 30, 2009 2:52 PM

Former Member
0 Kudos

Hi Sarvesh,

This UDF refers to receiver determination::

int i;

for(i=0; i<var1.length;i++){

if( var1<i>.equals("ACHP") )

{

result.addValue( "BS_54_MDM_QAD_RECEIVER");

}

if(var1<i>.equals("HBO"))

{

result.addValue( "BS_54_MDM_QAD_RECEIVER2");

}

}

But, we need to create one more UDF for handling the functionality, i.e checking the condition(by key field)?

Since, the blog talks about only 2 values(mr or ms).

I have slightly modified the UDF, since the substring part I wasn't clear with.

Thanks & Regards,

Sushama

Former Member
0 Kudos

> But, we need to create one more UDF for handling the functionality, i.e checking the condition(by key field)?

Your UDF for determining the receivers looks good.

Now for other mappings (for different keys) you can write an UDF or you can also use std function. (I am not very clear here what exactly you are looking for?)

Former Member
0 Kudos

Hi Sarvesh,

I am talking about the condition check i.e. If keyvalue=X then send value to Local node, else send other value=y to local node.

Similar to the one: if string finds"mr" assign the value to Name else assign "ms" to name.

They have done this using graphical mapping since there are only 2 possibilities: mr or ms. But, here the keyvalue may be of say 10 types in that case we need to mention the condition in udf?

T & R

Sushama

Former Member
0 Kudos

Sushama,

Have you red the line "Similarly mapping for u201CMsu201D is also created." just abvoe point no 5.

Tthis means if you have 10 key fileds then you have to create 10 different mappings.

If you see my previous reply, I asked you "do you know how many key fields can be there in your incoming message?" So first confirm the number of key fields and their values.

Now suppose if you have 10 key fileds then create 10 different mappins and use graphical mapping, no need to create UDF.

I hope I have not misunderstood your question.

Regards,

Sarvesh

Former Member
0 Kudos

Hi Sushama,

I think you got confused with interface mapping for receiver determination and the interface mapping for creating target message.

1st interface mapping is used to determine receivers only.

2nd interfaces mappings will be used for target message creation. you have to create as mappings related to each receiver and while configuring just use the related mappings with each interface determination.

Please update with the status.

Regards,

Nutan

Former Member
0 Kudos

Hi All,

Thanks for the inputs. Anywaz i got the error receiver determination. Modifiying the scenario and testing it.

Regards,

Sushama

Former Member
0 Kudos

Hi,

I have created 2 interface mappings. But still its failing for receiver determination.

Also, while testing the rec det mapping in IR, I am not getting any values in Service

Please suggest.

T & R

Sushama

Former Member
0 Kudos

> Also, while testing the rec det mapping in IR, I am not getting any values in Service

This means your UDF is not working properly. Right click on UDF and press Display Queue then see the results. There shouldn't be context change for multiple receivers.

Former Member
0 Kudos

Hi Sarvesh,

No value is coming to the UDF..

int i;

for(i=0; i<var1.length;i++){

if( var1<i>.equals("ACHPD") )

{

result.addValue( "BS_54_MDM_QAD_RECEIVER");

}

if(var1<i>.equals("HBO"))

{

result.addValue( "BS_54_MDM_QAD_RECEIVER2");

}

}

Please suggest.

T& R

Sushama

Former Member
0 Kudos
int i;
 
 for(i=0; i<var1.length;i++){
 
        if( var1<i>.equals("ACHPD") )
        {
           
       	result.addValue( "BS_54_MDM_QAD_RECEIVER");
             
       }
      if(var1<i>.equals("HBO"))
        {
     	  result.addValue( "BS_54_MDM_QAD_RECEIVER2");
             
       }
 }

I have tested the above udf and it is working fine. Make sure you are passing the ACHPD & HBO in same case as you mentioned in UDF becaue it is case sensitive.

Former Member
0 Kudos

Hi,

Are you getting the values at Service??

Those are in correct case only..

Please suggest.

T& R

Sushama

Former Member
0 Kudos

Hi,

I am getting same file posted to two differnt receivers.

I have made one receiver det--> with mapping for rec det called

one sender agreement

two receiver agreements

two interface determinations-->2 mappings called.

Please suggest

Former Member
0 Kudos

Hi All,

Thanks for the support.

Problem solved

Regards,

Sushama

Answers (5)

Answers (5)

Former Member
0 Kudos

If you have same structure for both the receivers then it can be done without multimapping

You can specify a condition in receiver determination and route it to appropriate receiver

If condition 1 then receiver1

If condition 2 then receiver 2

Former Member
0 Kudos

Hi,

We dont need the same file(as that of source file) format at the receiver end.

The source file has to split in 2 differnt files based on the value and have to be posted to different receivers.

Please suggest.

Thanks

Sushama

Former Member
0 Kudos

Hi Sushama,

I am able to understand that you want to split the input message as per the value of Key field and at the same time you need to determine receievers also on based of those key field values.

Please follow the extended receiver determination. First problem is to determine receiver and after that interfaces related to that receiver.So, if all the receivers interfaces are having different structure then kindly create different mappings for all those receivers related interfaces.

Check this out.

Regards,

Nutan

Former Member
0 Kudos

Have you gone through the blog 3343. I think it is pretty similar to your requirement.

Former Member
0 Kudos

Hi,

The requirement is similar. But, the Udf is throwing error:Some class or interface expected, stream transformation error.

Also, do we need to specify the actual receiver service or a parameter?

Please suggest.

T& R

Sushama

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi,

You need specify the actual Receiver Service name.

copy paste the error what your are getting.

Regards,

Raj

Former Member
0 Kudos

> The requirement is similar. But, the Udf is throwing error:Some class or interface expected, stream transformation error.

Make suer you have selected cache as QUEUE while creating the UDF. I mean you have to create an advanced UDF.

> Also, do we need to specify the actual receiver service or a parameter?

YES, so just be careful here coz if you hardcode the receiver service in UDF then it will create a problem when you tranasport it to QA or Production. Try to pass the receiver service names to UDF in a generic way.

Regards,

Sarvesh

Former Member
0 Kudos

Hi Sarvesh,

How to get the service in a generic way?.

Also, the blog 3343 is good for 2 receivers. But, there can be more than 2 receivers. So, i cant put ifelse condition?

Should i create UDF for that also?

Please suggest.

Regards,

Sushama

Former Member
0 Kudos

> How to get the service in a generic way?.

Create an UDF for this as mentioned below.

Note: Do not declare any argument while creating the UDF i.e. this UDF will not take any input, so just delete the default argument "a" while creating the udf.

String SystemID = null;

SystemID = System.getProperty("SAPSYSTEMNAME");

return SystemID;

Probably you can do like this..

UDF --->FixedValue table ---> Target node.

Note: In FixedValue table you can hardcode the service name e.g.

Key           Value
======       =======
DEV            BS_Dev
QA             BS_QA
PRD            BS_PRD

P.S. Above solution is just an hint. It is not necessary that you use FixedValue table. Based on your exact requirement use your own logic.

Regards,

Sarvesh

Former Member
0 Kudos

Hi Sushama,

As per your query, I believe at runtime if you have to decide the receivers then kindly use extended receiver determination.

Steps:

1.> Define Message Mapping between Outbound Message Type and Standard Message Type u201CReceiversu201D which is as Inbound message type and which is in the SAP BASIS --> http://sap.com/xi/XI/System

2.> Define Interface Mapping:Assign the message mapping or mapping program to the interface mapping

3.>Receiver Determination: While defining receiver determination, chose the u201Cextendedu201D option button. Now select the Interface Mapping created in Integration repository.

Then do the other common steps.

Regards,

Nutan

Former Member
0 Kudos

Hi Nutan,

Thanks for the inputs. But, If I map the source and target datatypes, their structures are entirely different.

Also, input message has to split to n no of files.

Please suggest.

Regards,

Sushma

Former Member
0 Kudos

> Can anyone tell me how to do 1:n multimapping wherein, depending upon one key node of the input file , it has to be posted to different receivers?

Go through this blog..

/people/sudharshan.aravamudan/blog/2005/12/01/illustration-of-multi-mapping-and-message-split-using-bpm-in-sap-exchange-infrastructure

Former Member
0 Kudos

Hi Sarvesh,

Thanks for the inputs. But, the functionality is a bit differnt. We dont know how many files will be there at receiver side. it's purely decided by runtime. Depending upon the sender file, the file has to be split into n no of files.

Please suggest.

Thanks & Regards,

Sushama

Former Member
0 Kudos

Actually this is not a case of multi mapping as per my understanding.. see similar approach in this blog..

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

Regards,

Sarvesh

Former Member
0 Kudos

Hello,

Please check main idea for your scenario in your Integration Repository SAP Basis-> SAP Basis <release number> -> namespace http://sap.com/xi/XI/System/Patterns next integration processes BpmPatternMulticastSequential and BpmPatternMulticastParallel.

You also have to add transformation step with Message Mapping from one input message to many output. In Message Mapping on Message Tab change occurancy for output message type from 1 to 0..unbounded.

Additional info http://help.sap.com/saphelp_nwpi71/helpdata/EN/11/13283fd0ca8443e10000000a114084/frameset.htm.

BR,

Dzmitry

madanmohan_agrawal
Contributor
0 Kudos

>>Can anyone tell me how to do 1:n multimapping wherein, depending upon one key node of the input file , it has to be posted to different receivers?

Hi Suishama,

In Message mapping, go to "Messages" tab and change the occurance as "o..Unbounded". Map the key to both node <local data> and <key> so that the output will be generated based on key value. This will solve your problem and will create multiple messages on target side.

Regards,

Madan Agrawal