cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Message Mapping Scenario - Split Issue

smansari32
Explorer
0 Likes
2,143

Hi All,

I have similar following requirement could anyone tell me whether this is achievable in SCPI. If yes, Pls help?

Input Xml

<Input>
   <value>1,2,3,4,5</value>

<Input>

Output Xml

<Output>
  <value>1</value>
  <value>2</value>
  <value>3</value>
  <value>4</value>
  <value>5</value>
</Output>

Please let me know the possibilities

Thanks

Ansari

View Entire Topic
MortenWittrock
SAP Mentor
SAP Mentor

Hi Ansari

A user-defined function will solve that for you. Add the following function:

import com.sap.it.api.mapping.*

def void splitByComma(String[] s, Output o, MappingContext c) {
    s[0].split(',').each { v -> o.addValue(v) }
}

Then wire it up as follows:

Simulating with your input data, I get the following result:

Regards,

Morten

engswee
Active Contributor

Nice to see you giving Message Mapping some love! 😉

MortenWittrock
SAP Mentor
SAP Mentor
0 Likes

Well, the OP did ask specifically about it... 😄

smansari32
Explorer
0 Likes

Hi,

Thanks for your answer. But it is not working with my case.. 😞