cancel
Showing results for 
Search instead for 
Did you mean: 

Splitting file based on field

former_member188791
Participant
0 Kudos

Hi Group,

we have requirement to split the incoming file based on one field (PSGID) value chanage,can any body help how to achieve this:

Incoming Source:

------------------

<Record>
<DPZ>
<field1>201000</field1>
</DPZ>
<TDR>
<field11>20</field11>
</TDR>
<SUP>
  <id>BEEN</id>
<\SUP>

<PSG>
  <PSGID>A </PSGID>
<\PSG>
<DA>
  <DAID>ex1</DAID>
</DA>
<PSG>
  <PSGID>B </PSGID>
<\PSG>
<DA>
  <DAID>ex2</DAID>
</DA>
<PSG>
  <PSGID>C </PSGID>
<\PSG>
<DA>
  <DAID>ex3</DAID>
</DA>
</Record>

Target
------

File1
----------
<Record>
<DPZ>
<field1>201000</field1>
</DPZ>
<TDR>
<field11>20</field11>
</TDR>
<SUP>
  <id>BEEN</id>
<\SUP>
<PSG>
  <PSGID>A </PSGID>
<\PSG>
<DA>
  <DAID>ex1</DAID>
</DA>
</Record>

File 2
--------
<Record>
<DPZ>
<field1>201000</field1>
</DPZ>
<TDR>
<field11>20</field11>
</TDR>
<SUP>
  <id>BEEN</id>
<\SUP>
<PSG>
  <PSGID>B </PSGID>
<\PSG>
<DA>
  <DAID>ex2</DAID>
</DA>
</Record>

File 3
--------

<Record>
<DPZ>
<field1>201000</field1>
</DPZ>
<TDR>
<field11>20</field11>
</TDR>
<SUP>
  <id>BEEN</id>
<\SUP>
<PSG>
  <PSGID>C</PSGID>
<\PSG>
<DA>
  <DAID>ex3</DAID>
</DA>
</Record>

Accepted Solutions (0)

Answers (3)

Answers (3)

rajasekhar_reddy14
Active Contributor
0 Kudos

Below logic works in your case

Source field---->remove context---->splitby value(value change)---->collapse context---->target.

But how you are going to collect multiple files in to sinfle file, you need BOM for this.

Regards,

Raj

iaki_vila
Active Contributor
0 Kudos

Hi Rajiv,

You could use multi.mapping for this issue http://scn.sap.com/people/ranga.rajan2/blog/2010/03/17/multi-mapping-with-a-simple-scenario--fledgli...

(Also, don't forget to "like" or rate (or both) the blog in case you find it useful.)

You use the function pointed by Zammer in order to create different messages.

Regards.

zameerf
Contributor
0 Kudos

You can try using SplitByValue(ValueChange) function so that all PSGID value A goes into one, B goes into another and so on. would be good if you can share the screenshot of mapping with source and target structure.