cancel
Showing results for 
Search instead for 
Did you mean: 

two message types to only one in one mapping

Former Member
0 Kudos

Hi there experts!

just a silly doubt:

I've got a mapping that first maps some message to another one, and then a java function maps the resultant message to a string with some <tags>.

This string, it going to be mapped by another MM to a message with some fields and a fat xml string field that actually holds the information.

My question is:

at the las mapping, now I'm being asked if I could not 'hardcode' as constant some header fields, but grab them from the first message BEFORE the java wrapping.

May I add at the las MM the MT of that message and simply map the fields I need from that message to the header? It would be really complicated to search for that new field at the string resultant from the java wrap.

Am I clear?

thanks a lot in advance!

cheers,

Edu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thing is that if I place two source messages, the message that results is built with some

message

|

|

V

message 1

|

|

V

My_root

that doesn't fit the requisitions of the message needed outside SAP

Cheers,

Edu

Former Member
0 Kudos

Did you try adding the constants in the first MM?

BR

Diptee

Former Member
0 Kudos

Hi Diptee,

the first mapping maps two structures, mainly field by field. But the result is afterwards wrapped by a java section to a string. All the data at first mapping reaches the final one in one string.

cheers,

Edu

Former Member
0 Kudos

Hello Edu,

What I meant to say is, is it possible for you have the header fields populated from the first mapping itself? Or you have to add them only after the last mapping?

BR,

Diptee

Former Member
0 Kudos

Hi diptee,

nope, all the info goes to a message that afterwards is wrapped. Once wrapped, it goes mapped to ONE field of the last message, and I have there other fields to be dinamically fullfilled and no 'harcoded'

cheers,

Edu

Former Member
0 Kudos

Hi Diptee,

I'm going to attach some pictures to see if I can explain myself.

This is the first mapping:

the a java section that wraps the BP message into a string:

and then the last mapping that places the string into the final and outbound message:

the thing is that I need the TIPO field from the first message to be populated at the BPNAME field of the last outgoing message.

How can I achieve this? is there a solution??

cheers,

Edu

nabendu_sen
Active Contributor
0 Kudos

Hi Edu,

Please go through the below blog which has provided the solution exact to your requirement. I don't think there would be anything critical.

Regards,

Nabendu.

Former Member
0 Kudos

Hi Nabendu,

thanks a lot for the blog, it is exactly my problem, but I'm using XI 7.0 and I think I cannot use those tools. Or can I?

cheers,

Edu

nabendu_sen
Active Contributor
0 Kudos

Hi Edu,

In that case, I think Dynamic Configuration would work in PI 7.0 to store and retrieve values between two mappings. Go through the blog and check:

Its an easy implementation and at least give a try.

Regards,

Nabendu.

nabendu_sen
Active Contributor
0 Kudos

Hi Edu,

Did you get any chance to implement this?

Regards,

Nabendu.

Former Member
0 Kudos

Hi Nabendu,

I had another issue and now I'm going to implement this. I assume, as I searched at the SCN and folloed your link, that I have to create a UDF called DynamicConfigPopulate to somehow store my value and other called DynamicConfigRetrieve in order to read my value,
am I right??

cheers,

Edu

nabendu_sen
Active Contributor
0 Kudos

Absolutely Edu.

conf.put() to store and conf.get() to retrieve.

Regards,

Nabendu.

Former Member
0 Kudos

Hi there Nabendu,

Java is not one of my strengths, I'm trying to develope the java code and I have some problems. First I've declared a global variable at the Edit Java Section tab. Then, my code is

but when I try to use the UDF at the mapping I'm forced to map it to some field, and I wanted it to store the value to use it at other step!

Any hint?

cheers,

Edu

nabendu_sen
Active Contributor
0 Kudos

Hi Edu,

You can add this UDF in between any Field Mapping or to a unused field. It will not create a any problem. The screen shot of the UDF is good for Number 1 Mapping.

You have to create another UDF at Mapping 3 and that would be conf.get().

Regards,

Nabendu.

Former Member
0 Kudos

hi Nabendu,

but in my first mapping I populate info to some structure that afterwards is going to be wrapped to a string by a java function, would it populate something in there? I need that structure to be clean of rubbish and be filled ONLY by the info the 3rd Party needs... Am I clear??

Thanks for your help, Nabendu!

cheers,

Edu

nabendu_sen
Active Contributor
0 Kudos

UDF1 in Mapping 1:

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey keyA = DynamicConfigurationKey.create("http:/"+"/DCUsage.com", "keyValue" );

  conf.put(keyA,TIPO);

UDF2 in Mapping 2:

DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey keyA = DynamicConfigurationKey.create("http:/"+"/DCUsage.com","keyValue" );

  String TIPO = conf.get(keyA);

Regards,

Nabendu.

Former Member
0 Kudos

Hi Nabendu,

I'm trying to prove this, not by loading data at the mapping since I know this must be test on runtime. The thing is that I've declare TIPO, and at the second UDF says that TIPO has been already declare and I've declare TIPO2, but the field is not getting populated (BUT the mapping does not fail at runtime and I've got the squared flag at the moni, although the field is empty.

any hint?

cheers,

Edu

Former Member
0 Kudos

Hi Nabendu,

my UDFs

UDF1

UDF2 (with no argument)

I've added the return "" since it was asking me for some return.

But it doesn't work 😞

nabendu_sen
Active Contributor
0 Kudos

Hi Edu,

Change the last line of the 2nd UDF:

return "";

with

return TIPO;


You should now see the value in <BPName> field.

Regards,

Nabendu.

Former Member
0 Kudos

Hi Nabendu,

IT WORKED! Thanxs a lot, you've made my day!

Cheers,

Edu

nabendu_sen
Active Contributor
0 Kudos

Hi Edu,

You are welcome. Happy to hear, it worked.

Regards,

Nabendu.

Former Member
0 Kudos

Hi again Nabendu,

Now I have working this they've asked me to do the same thing with other field. I'm trying to recreate the UDF, changing the GLOBAL VARIABLE to the field I need now (BUKRS instead of TIPO) and changing the code to work with BUKRS instead of TIPO. The problem is that, although is working and populating some info, the value that it is populating is again the TIPO value instead of the BUKRS. Any hint? should I change anything more??

cheers,

Edu

nabendu_sen
Active Contributor
0 Kudos

Hi Edu,

Keep everything same just change below in both the UDFs which you are using for BUKRS (Mapping 1 as well as in Mapping 2):

DynamicConfigurationKey.create("http:/"+"/DCUsage.com", "keyValue2" );


Let me know if that helps.


Regards,

Nabendu.



Former Member
0 Kudos

Hi Nabendu,

it was exactly that, it works perfectly!

thank you again!

cheers,

Edu

Answers (2)

Answers (2)

naveen_chichili
Active Contributor
0 Kudos

hi,

could you please elaborate bit more....

if i understood correctly you can use multimapping and achieve this.

Regards,

Naveen

nabendu_sen
Active Contributor
0 Kudos

Hi Edu,

Please check the correct answer in the below blog:

has provided the code.

Regards,

Nabendu.