cancel
Showing results for 
Search instead for 
Did you mean: 

mapping logic

former_member232455
Participant
0 Kudos

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

former_member232455
Participant
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member190293
Active Contributor
0 Kudos

Hi Janardhan!

Take a look at this blog:

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

Regards, Evgeniy.

former_member232455
Participant
0 Kudos

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

former_member190293
Active Contributor
0 Kudos

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.

former_member232455
Participant
0 Kudos

HI Evegeniy,

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

Regards,

Janardhan

former_member232455
Participant
0 Kudos

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

former_member190293
Active Contributor
0 Kudos

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

Regards, Evgeniy.

former_member232455
Participant
0 Kudos

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