cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple concat

EdgarTabar
Participant
0 Kudos

Hi ,

I have the requirement to concat all the input fields (over 50) into one output field.

How can I do that whitout the graphical tool?

I don't like a UDF whith 50 parameters 😉

I use SAP PO 7.5 in a single stack environment.

Regards

Edgar

Accepted Solutions (1)

Accepted Solutions (1)

former_member190293
Active Contributor

Hi Edgar!

If you want to concatenate values of all subnodes within given node you could use UDF like this:

Regards, Evgeniy.

EdgarTabar
Participant
0 Kudos

Hi Evgeniy;

I get the error message

     "Premature end of file.] in class com.sap.xi.tf._TEST_MM_ method concatSubNodes["

Regards

Edgar

former_member190293
Active Contributor
0 Kudos

Hi Edgar!

Woudn't you please provide your mapping screenshot?

Did you set "Return as XML" for your source element?

Regards, Evgeniy.

EdgarTabar
Participant
0 Kudos

Hi Evgeniy,

now it works.

I forgot to set "Return as XML" for the source element

Regards,
Edgar

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Edgar

if you wish to go for Graphical mapping here is a simple UDF which will concatenate n values in a context.

public void nConcatenate(String[] input, ResultList result, Container container){

String stringConcatenated = "";

for (int i =0;i<input.length;i++)

{

stringConcatenated += input[i];

}

  result.addValue(stringConcatenated);

}


Hope this helps you

Regards

Anitha

former_member190293
Active Contributor
0 Kudos

Hi Anitha!

Your UDF is helpful but, if I understand it right, it concatenates values of the same element for all its occurances, but this will not work for concatenating all subelements values of any element.

Regards, Evgeniy.

iaki_vila
Active Contributor
0 Kudos

Hi Edagar,

Have you though to use XSLT mapping?, depending the name of your nodes this example could be useful for you Concatenate values of multiple xml elements into single element using xslt - Stack Overflow

Regards.