Skip to Content
0

mapping logic

Dec 23, 2016 at 12:32 PM

93

avatar image

Hi All,

i have one mapping requirement, from the source we are receiving message as a proxy.

in the message we have one node and under this we have two fields which will repeat multiple times.it is like

<parameter name>

<parameter value>

in this we need few field values as a field names in the receiver structure. client don't want o change the receiver structure.

source xml:

<parameter name> janardhan </parameter name>

<parameter value> 123456</parameter value>

output xml

<janardhan>123456</janardhan>

could you please let me know how can we achieve this requirement.

Regards,

Janardhan

10 |10000 characters needed characters left characters exceeded

hello Team,

any solution for my question.. i tried with below link.. but i am not sure how can we apply in mapping level and under which import functions i have to use?

Regards,

Janardhan

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Evgeniy Kolmakov Dec 26, 2016 at 09:48 AM
0

Hi Janardhan!

Take a look at this blog:

https://blogs.sap.com/2012/11/05/message-mapping-play-around-with-target-structure/

Regards, Evgeniy.

Show 6 Share
10 |10000 characters needed characters left characters exceeded

Hi Evgeniy,

I tried that one, i am not sure how can we apply in mapping level and under which import functions i have to use?

in the UDF i tried but under which import function we need write?

could you please guide me?

Regards,

Janardhan

0

Hi Janardhan!

Since you need to map one of your source elements to target element name and another source element is to be mapped as target element value, you can create UDF, that takes two input parameters: first is target node name and the second - target node value. In your UDF code you change target node name as described in blog given above and return the second parameter's value. Thus you'll get the target element with name taken from the first parameter and value from the second parameter.

Regards, Evgeniy.

0

HI Evegeniy,

please find below steps which i have tried, i am getting errors.. could you please guide me on this

Regards,

Janardhan

step1.png (20.5 kB)
step2.png (15.8 kB)
step3.png (13.7 kB)
step4.png (20.2 kB)
0

Hi Evgeniy,

i have done some mistake, now the code is working fine. in my requirement the value coming with prefix, but the code is not able to handle this..

value will come like tpn:janardhan..

how can i pass this value?

Regards,

Janardhan

0

To set namespace prefix and namespace declaration for target element use setNSDeclarations method as described in the blog.

Regards, Evgeniy.

0

Hi Evgeniy,

Thanks for your solution, but unfortunately my entire requirement got changed. the fields which has to generate dynamically, now i maintained in receiver structure so no need to generate fields dynamically. now in the field name i just need to add tnp.. for example

the input is <janardhan>1234<janardhan>

output should be <tnp:janardhan> 1234 <tnp.janardhan>

it is having single input, so how can i achieve this?

Regards,

janardhan

0