cancel
Showing results for 
Search instead for 
Did you mean: 

Map one source elements to two different target elements

Former Member
0 Kudos

Hi Gurus,

In our scenario, we have single source. and we are mapping this single source to two different structures, based on condition in the source records on one field, we are mapping to either X structure or Y structure. in my case i have to generate only one file at a time based on condition.

If condition is true, i have to mapp it for X structure, if its false i have to mapp it for Y structure. but in my case i getting a blank file for another mapping. i should stop this blank file.

any suggestions and solutions will be rewarded. this is an urgent issue, please help me.

Thanks in advance....

Thanks & Regards,

Anuj..

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

As I have understood your problem, you want to transfer source file to receiver end in different message structure depending on some condition on payload entry.

Also, the file has to be sent to same receiver.

Could you try this approach for a test:

1. Treat same receiver as two different Business Systems for two different conditions. This would mean that you will have to create an additional Business System against the same Technical System defined in SLD.

2. Once you have done that, you could use conditional receiver determination using xPath, in which you would define your condition. Say for existance of value A in some field you would transfer message to business system 1 else you would transfer message to business system 2.

3. This option would give you leeway to have two separate mappings for existing conditions, which could solve the problem of having separate structures.

I am actually not sure if this solution has some missed broken link which I may not have considered. However, you could try it out if you think this could be helpful.

Thanks,

Bhavish

    • Award points if comments found useful:-)

Former Member
0 Kudos

Hi Anuj,

For Header Node of your messages use the function CREATEIF, the condition based on you are routing the message if that condition is true then the corresponding message will generate and other message will SUPPRESS.

Hope it will help to u.

Cheers

Veera.

>>>Reward Points,If it is needful.

Former Member
0 Kudos

i have tried to use createif at the header level, but the problem is since i have two header nodes at the target side, i have to use two createif statements.

Now when one of the statements evaluates to true, the other one is false, obviously, and this throws an exception in my mapping. i'm not sure why is this behaving this way.. any suggestions?

Also any other ideas??

Former Member
0 Kudos

Hi Anuj,

u can use <b>ifWithoutElse</b> standard function.

Based upon condition the source will it will route to the structure.

see here how <b>ifWithoutElse</b> is implemented..

/people/stefan.grube/blog/2006/01/09/the-use-of-suppress-in-the-xi-30-graphical-mapping-tool

regards

BILL

Former Member
0 Kudos

thanks for your response..

This is what i am using in my Mapping...

http://www.flickr.com/photos/14210232@N03/1549604967

I think u didn't understand my problem... Suppose we are having two i/p A and B...

If i/p value is A then we want to send it to one o/p stucture.

If i/p value is B then we want to send it to another o/p stucture.

I am able to do that... but thing is that..... when i am giving i/p value as A it is going into one structure with fields. but another structure is also getting created without having any fields which i don't want... i want only 1 o/p structure which is required not both.

Thanks

Anuj Agarwal

Former Member
0 Kudos

Hi Anuj,

I am not very sure about this. But in a muti mapping, every message will be created even if you have put a condition that evaluates to false. This I guess is the expected behabiour. I will try this with a small example from my end and confirm.

On a different note, why dont you use 2 different mappings and use a condition in Interface determination to achieve your requirement? Any reasons for avoiding this approach?

Regards,

Jai Shankar

Former Member
0 Kudos

I have already used an if-then construct and an enhanced ID.Thanks anyway.

Let me explain using a source interface (s1) and target interfaces t1 and t2.

Based on the condition, only one interface(lets say t1) will be selected, target mapping is done for this.

But the problem is that the other interface (t2) also executes(having only the root node) and the end result is i have two files - one with the mapped payload and another empty one with only the root node.

My requirement is to remove this empty file at the mapping stage itself , as -

1) i only need a single file at the receiver.

2) i do not want an extra payload for every record i send, creating unnecessary load on my IE.

Also due to performance issues i do not want to move this to a BPM.

I have attached the o/p screenshot at http://www.flickr.com/photos/14210232@N03/1550768802/

In window 1 i have the correct output .i.e of the interface t1 which was mapped.

In window 2 i have the unwanted output. i.e the interface t2 which is creating another file at the receiver.

<b><b>Ques</b></b>: When using enhanced ID/multi-mapping, under Messages tab, if i set my target message type to 0..1, should it not work? I have tried this but it doesn't.

Do let me know a way out! Thanks.

Anuj.

Former Member
0 Kudos

>>Based on the condition, only one interface(lets say t1) will be selected, target mapping is done for this.

Develop 2 different mappings (one each for target interface say t1 and t2, no condition check required in the mapping).

In interface determination add 2 inbound interfaces t1 and t2. Now a new column condition will appear in the interface determination against both the inbound interfaces. Click on that, it will open up the condition editior where you can put your condition say field1=A for t1 and field1=B for t2.

This will not execute both the mappings, just a single mapping based on the input field and a single file will be generated.

Regards,

Jai Shankar

Former Member
0 Kudos

Hi Jai,

There's a small problem when i tried to work out your solution - the sender interface is an RFC and i'm not able to set the condition in the editor -

I get a warning " Message interface does not exist in any software components installed on this business system" when i choose the condition editor? Can anyone help with this?

Thanks.

Anuj.

Former Member
0 Kudos

Go to SLD, select your sender technical sytem and add your SWCV that you are using and try again.

Regards,

Jai Shankar

Former Member
0 Kudos

Hi Jai,

Tried to do it , but to no avail!.. still gettin the same error, any other way out??

Anuj

Former Member
0 Kudos

Hi,

Have you given a try with the solution I posted before?

Bhavish

Former Member
0 Kudos

>>Tried to do it , but to no avail!.. still gettin the same error, any other way out??

If you make the association properly, then you will not get this error. May be the change is not updated in cache. Try to clear SLD Data cache and try.

@Bhavish,

Using 2 Business service is going to cause the same issue. It is the same as using 2 interfaces.

Regards,

Jai Shankar

Former Member
0 Kudos

Hi Anju,

I have read the above all threads.I have understood your problem.

Hey you can acheive this using the same mapping program itself.

Sender -1-and 2 Receiver structures.

Use a global variable.like ex: boolean field1=true and write a UDF by using the UDF.

Please make sure that the UDF should have logic if boolean is true then pass result.addValue to the first message(you have to map the source field to root node fo the target..of course in your case message-1)

if field=false then you will populate the second message.

Hope I am clear....To implement this you should have some java knowledge.

Please let me know if you have any queris.

But i am sure 100% we can achieve in single message mapping.

Thanks and Regards,

Chandu.

Former Member
0 Kudos

In ur case u wan to dynamically choose the interface as per the condition in source msg,

so in that case u can use the condition editor

chaeck this out

http://help.sap.com/saphelp_nw04/helpdata/en/e9/67a63d7af20450e10000000a114084/content.htm

santhosh_kumarv
Active Contributor
0 Kudos

Hi Anju,

Using the BPM(Switch) u can check the for condition of the source structure by making use of the XPath expression and can determine the mapping to be executed.

Regards

San