cancel
Showing results for 
Search instead for 
Did you mean: 

Convert XML to flat file with File adapter

Former Member
0 Kudos

Hi all.

Trying to configure a file adapter according to the following link.

http://help.sap.com/erp2005_ehp_04/helpdata/EN/d2/bab440c97f3716e10000000a155106/frameset.htm

What i want it to do is the following.

I have the following incoming message:

<header>
	<h_field1></h_field1>
	<h_field2></h_field2>
</header>
<data>
	<d_field1></d_field1>
	<d_field2></d_field2>
	<infotext>
		<i_field1></i_field1>
		<i_field2></i_field2>
	</infotext>
</data>

I want this to become a flat file that looks as follow.

h_field1¤h_field2

d_filed1¤d_field2

i_field1¤i_filed2

Every field in each segment should be concatenated with the ¤ char as separator.

I've done the following:

Content Conversions Parameters

Record Structure: header,data,infotext

header.fieldSeparator ¤

data.fieldSeparator ¤

infotext.fieldSeparator ¤

The adapter just gets into wait mode.

Does anybody know why?

BR

Kalle

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

your msg structure cannot be converted to flat file using File Content Conversion ........because infotext node is inside data node............if your infotext node was outside data node, means infotext node was at the same level of header and data node, then you can use FCC to convert this XML file to flat file...............

Regards,

Rajeev Gupta

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Try this, I'm sure it works

But your structure should like this:

>>

Record Structure: header,1,data,1,infotext,1

header.fieldSeparator ¤

header.endSeparator :'nl'

data.fieldSeparator ¤

data.endSeparator :'nl'

infotext.fieldSeparator ¤

infotext.endSeparator :'nl'

Sameer

Edited by: sameer Khanna on Apr 27, 2009 10:26 AM

Former Member
0 Kudos

Thansk all.

Will try that structure and change the adapter.

Let you all know about the result afterwards.

BR

Kalle

Former Member
0 Kudos

Hi,

Instead of thanks to all, better you rewards the points accordingly

Sameer!

Former Member
0 Kudos

But I still have one problem.

I can get a structure according to the message bellow.

<header> 
<h_field1/> 
<h_field2/> 
</header> 
<data> 
<d_field1/> 
<d_field2/> 
</data>
<infotext> 
<i_field1/> 
<i_field2/> 
< /infotext> 
<infotext> 
<i_field1/> 
<i_field2/> 
< /infotext>

infortext can come more the one time for each data segment and the data segment can come more then one time for the header segment. The header segment can only come one time for each message. How do I solve that?

BR

Kalle.

former_member581827
Participant
0 Kudos

Hi,

Content Conversions Parameters

Record Structure: header,1,data,,infotext,

header.fieldSeparator ¤

header.endSeparator 'nl'

data.fieldSeparator ¤

data.endSeparator 'nl'

infotext.fieldSeparator ¤

infotext.endSeparator 'nl'

Regards,

Chandra

Edited by: Chandra on Apr 27, 2009 1:11 PM

Former Member
0 Kudos

Hi,

in FCC, you can have in RecordSet structure: header,1, data,, infotext,

specify asterisk after data and infotext in above..........

also specify the column names and thier lengths also......

then your XML file will be converted to flat file.

Regards,

Rajeev Gupta

Edited by: RAJEEV GUPTA on Apr 27, 2009 1:10 PM

Former Member
0 Kudos

I have the following configuration.

header,1, data,, infotext,

The message lokks as the one bellow when I reciev it.

<header>
<data1>HD01</data1>
<data2>CheckHeader</data2>
</header>
<data>
<data1>AC01</data1>
<data2>CheckData</data2>
</accountdata>
<infotext>
<data1>ACT01</data1>
<data2>CheckInfoText</data2>
</infotext>
<infotext>
<data1>ACT01</data1>
<data2>CheckTInfoext2</data2>
</infotext>
<data>
<data1>AC01</data1>
<data2>CheckData2</data2>
</data>
<infotext>
<data1>ACT01</data1>
<data2>CheckInfoText</data2>
</infotext>
<infotext>
<data1>ACT01</data1>
<data2>CheckInfoText2</data2>
</infotext>

Get the following result.

HD01¤CheckHeader
AC01¤CheckData
ACT01¤CheckInfoText

Do not understand why?

BR

Kalle

former_member581827
Participant
0 Kudos

Hi,

try like this header,1, data,, infotext,

Regards,

Chandra

former_member581827
Participant
0 Kudos

Hi,

try like this header,1, data,KEEP STAR, infotext,KEEP STAR

former_member581827
Participant
0 Kudos

hi,

Have you checked the occurence of data and info text its 1 ......unounded right?

have you checked in mapping whether its executing correcttly?

Regards,

Chandra.

prasannakrishna_mynam
Contributor
0 Kudos

Hello kalle,

As per your source structure, if you perform FCC on it you should have 2 level hierarchie, Your RecordSet will be your root node.

and the RecordSetStructure is : header,1,data,1,

Since the node infotext is in the data, you can not refer this node and is not appropriate.

<header> 
    <h_field1/> 
<h_field2/> 
             </header> 
            <data> 
  <d_field1/> 
   <d_field2/> 
    <infotext> 
<i_field1/> 
<i_field2/> 
<  /infotext> 
          </data>

Change The above strucutre to like this



<header> 
    <h_field1/> 
     <h_field2/> 
  </header> 
   <data> 
      <d_field1/> 
      <d_field2/> 
    </data>
      <infotext> 
            <i_field1/> 
           <i_field2/> 
       < /infotext> 

Your RecordSet will be your root node.

and the RecordSetStructure is : header,1,data,1,infotext,1

This resolves your issue..

Regards,

Prasanna

Former Member
0 Kudos


Record Structure: header,data,infotext

header.fieldSeparator ¤
data.fieldSeparator ¤
infotext.fieldSeparator ¤

change to this



Record Structure: header,data,infotext

header.fieldSeparator ¤
header.endSeparator :'nl'
data.fieldSeparator ¤
data.endSeparator :'nl'
infotext.fieldSeparator ¤
infotext.endSeparator :'nl'

Former Member
0 Kudos
<header>
> 	<h_field1/>
> 	<h_field2/>
> </header>
> <data>
> 	<d_field1/>
> 	<d_field2/>
> 	<infotext>
> 		<i_field1/>
> 		<i_field2/>
> 	</infotext>
> </data>

Modify the structure of infotext heirachcy move the elements to data node level

<data>

> <d_field1/>

> <d_field2/>

</data>

> <infotext>

> <i_field1/>

> <i_field2/>

> </infotext>

>

Rajesh