cancel
Showing results for 
Search instead for 
Did you mean: 

message mapping. How to read nested xml?

former_member373665
Participant
0 Kudos

i have a problem and i d'ont konw how to solve.

In message mapping, I have :

1. A message type origin with next structure:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:CRSC_MT_Fichero xmlns:ns0="http://cccc/wwww">

<Record>

<Row>row1</Row>

</Record>

<Record>

<Row>row2</Row>

</Record>

</ns0:CRSC_MT_Fichero>

2. A message type target with next structure:

<?xml version="1.0" encoding="UTF-8"?>

<ns1:EnviarFicheroBandeja xmlns:ns1="http:/xxxxx/">

<ns1:cifOrigen>Origen</ns1:cifOrigen>

<ns1:fichero>row1</ns1:fichero>

</ns1:EnviarFicheroBandeja>

we want it is that in field fichero ( xsd:base64Binary) has the content of every Rows together.

So in the below example we would like as result:

<?xml version="1.0" encoding="UTF-8"?>

<ns1:EnviarFicheroBandeja xmlns:ns1="http:/xxxxx/">

<ns1:cifOrigen>Origen</ns1:cifOrigen>

<ns1:fichero>row1

row2

</ns1:fichero>

</ns1:EnviarFicheroBandeja>

thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

aashish_sinha
Active Contributor
0 Kudos

Use concat Standard function in message mapping graphical editor. You can find it under Text.

use like this

Row 1

concat -


Row1Row2.

Row 2

use concat !!

Thanks

Aashish Sinha

former_member373665
Participant
0 Kudos

Use concat Standard function in message mapping graphical editor. You can find it under Text.

use like this

Row 1

concat

----


Row1Row2.

Row 2

use concat !!

Thanks

Aashish Sinha

former_member373665
Participant
0 Kudos

how can i use concat??

i have two diferents rows:

<Record>

<Row>row1</Row>

</Record>

<Record>

<Row>row2</Row>

</Record>

and i want

<ns1:fichero>row1

row2

</ns1:fichero>

aashish_sinha
Active Contributor
0 Kudos

above reply got weired.. Sorry for that..

Just use concat function and provide source and target.

do it like this

Source1 Source2

|----


Concat -


>Outputtag

Concat tag contains 2 input and 1 output.

so give both tag as input to concat and 1 output to your desired field.

Regards

Aashish Sinha

Edited by: Aashish Sinha on Feb 16, 2011 11:28 AM

aashish_sinha
Active Contributor
0 Kudos

something weired is happening..

Look this out

concat

R = linking of strings X and Y (without blanks).

Example: X = u201CMrs.u201D; Y = u201CMilleru201D; R = u201CMrs.Milleru201D. Use the dialog for the function properties to insert a separator in the string

link :http://help.sap.com/saphelp_erp2004/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm

former_member373665
Participant
0 Kudos

i have 'n' rows for _ONE field_, for example:

<name>Paco<\name>

<name>Manolo<\name>

<name>Rosa <\name>

<name> Michael<\name>

and the result i want is:

<Result>PacoManoloRosa Michael<\Result>

thanks.

aashish_sinha
Active Contributor
0 Kudos

Use n concat function as

Name & name ->concat -> output to some constant and the constant as 1 input to concat function and other name is another input to concat function and repeate first step until you get what you want.

it will be like :

name1 & name2 -> concat func -> Output & name3 -> concat -> output & name 4 and so on..

regards

Aashish

former_member373665
Participant
0 Kudos

i think you understand me,

i thinks 'concat' is not the correct function. I have only ONE field and this field has any values.

<Record>

<Row>row1</Row>

</Record>

<Record>

<Row>row2</Row>

</Record>

thanks

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

You can try using the UDF I provided

Regards,

Mark

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

This is not possible without the use of UDF. You can use this mapping:


Row --> removeContext --> UDF --> fichero

UDF is of queue type

Argument: input


StringBuffer sb = new StringBuffer("");
for(int a=0;a<input.length;a++){
 sb = sb.append(input[a]+" ");
}
result.addValue(sb.toString());

Hope this helps,

Mark