Skip to Content
0
Former Member
Jun 10, 2009 at 12:18 AM

File Conversion in Rec File Adapter with subnodes

39 Views

Hi

My XML Structure is like this -->

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

- <ns0:MT_Test xmlns:ns0="urn:TESTconversion">

<MstName>Hello</MstName>

- <Header>

<TableName>1tst</TableName>

<PayDate>0102</PayDate>

<TotalAmt>24.00</TotalAmt>

<Total>000002</Total>

<PaySource>CHK</PaySource>

- <Subheader>

<TableName>1tst</TableName>

<SelectCatgry>test</SelectCatgry>

<CustID>200</CustID>

<PayAmount>11.00</PayAmount>

</Subheader>

- <Subheader>

<TableName>1tst</TableName>

<SelectCatgry>test</SelectCatgry>

<CustID>400</CustID>

<PayAmount>13.00</PayAmount>

</Subheader>

</Header>

- <Header>

<TableName>1tst</TableName>

<PayDate>0103</PayDate>

<TotalAmt>10.00</TotalAmt>

<Total>000001</Total>

<PaySource>ONE</PaySource>

- <Subheader>

<TableName>1tst</TableName>

<SelectCatgry>test</SelectCatgry>

<CustID>100</CustID>

<PayAmount>10.00</PayAmount>

</Subheader>

</Header>

</ns0:MT_Test>

which means

MT_Test is root 1..1

Header is the sub-node of MT_test as 1...*

Subheader is sub-node of Header which is also 1...*

rest of the fields are elements as 1..1

Now I need to convert this into Flat file using Receiver File Adapter, I gave this in my content conversion logic

recordset Structure -


MstHeader,BFKKZK,BFKKZP

MstName.addHeaderLine 0

MstName.fieldFixedLengths 8

MstName.endSeparator 'nl'

Header.addHeaderLine 0

Header.fieldFixedLengths 30,10,15,6,6

Header.endSeparator 'nl'

Subheader.addHeaderLine 0

Subheader.fieldFixedLengths 34,10,35,16

Subheader.endSeparator 'nl'

But with this I am getting exception as -->

Could not process due to error: java.lang.Exception: Exception in XML Parser (format problem?):'java.lang.Exception: Message processing failed in XML parser: 'Conversion configuration error: Unknown structure 'ns0:MT_Test' found in document', probably configuration error in file adapter (XML parser error)'

I know that http://help.sap.com/saphelp_nwpi711/helpdata/en/44/686e687f2a6d12e10000000a1553f6/content.htm says following -->

The expected XML structure contains the structure as nodes filled with any number of elements without additional subnodes.

But does that mean Structure with sub-nodes cannot be converted in flat format.

Pls. suggest the solution for this.

- lalit -