cancel
Showing results for 
Search instead for 
Did you mean: 

File content conversion : Deep Structure

Former Member
0 Kudos

Hi,

I have to do a file conversion(receiver file adapter) of an xml file which has a structure

<root>

<header>

<recordtype>H</recordtype>

</header>

<company>

<recordtype>C</recordtype>

<companycode>001</companycode>

<detail>

<recordtype>D</recordtype>

<customer>c1</customer>

</detail>

<detail>

<recordtype>D</recordtype>

<customer>c2</customer>

</detail>

</company>

<company>

<recordtype>C</recordtype>

<companycode>002</companycode>

<detail>

<recordtype>D</recordtype>

<customer>c3</customer>

</detail>

<detail>

<recordtype>D</recordtype>

<customer>c4</customer>

</detail>

</company>

<trailer>

<recordtype>T</recordtype>

</trailer>

</root>

I would like to convert it into

H

C001

DC1

DC2

C002

DC3

DC4

T

This is what i put in the

content conversion parameters..

HEADER,COMPANY,DETAIL,TRAILER

HEADER.fieldFixedLengths 1

COMPANY.fieldFixedLengths 1,3

DETAIL.fieldFixedLengths 1,2

TRAILER.fieldFixedLengths 1

the file adapter failed during conversion.

I am just wondering if it is to do with the deep structures

ANY THOUGTHS....

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

You mean to say that there can be only one level after the root element in the target mapped structure.the final structure is a flat notepad stuff...

THnks

moorthy
Active Contributor
0 Kudos

Yes,You are right. If you want all the fields in one line , you can go with as I mentioned i.e flat structure.

Regards,

Moorthy

Former Member
0 Kudos

Hi,

if you see the target structure it has detail element in the company . So i am not sure if it is causing a problem.and it is possible that the detail can get repeated.i want the company record to be in one line

and the detail in a different line.

the error i am getting is...

- 2006-07-03 10:31:01 CDT: Error: Message processing failed: Exception: Exception in XML Parser (format problem?):'java.lang.Exception: Message processing failed in XML parser: 'java.lang.Exception: Column value 'CUSTOMER01' too long (>6 for 4. column) - must stop', probably configuration error in file adapter (XML parser error)'

CUSTOMER01 is 10 character and that is what i have given in the content conversion

ANY Thoughts..

moorthy
Active Contributor
0 Kudos

Go with flat structure. It will resolve the issue.

If you want all in one line, Create one segment in the target strucrure and all fields are under that. It will give you desired result.

Regards,

Moorthy

kkram
Contributor
0 Kudos

Chinna Karuppan-

You error is because of deep structure. Unfortunately, receiver file adatper can accept only flat structure which according to me is strange when sender file adapter can accept nested structures. For the fact that sender file adapter can accept nested means such files do exist!

Anyway, coming back to your problem, I solved it using a generic ABAP mapping. We have many interfaces where complex structures need to be converted to flat and we do it by doing two step mappping ( you could call more than one mapping program to convert a source message to target message in interface mapping). The first step is message mapping which does the most of the mapping and the second step is the generic ABAP mapping which converts the deep structure to flat.

You could also also use XSLT or Java mapping for this.

Let me know if you need more information.

KK

stefan_grube
Active Contributor
0 Kudos

Tag names are case sensitiv. So you have to change your config to:

header,company,...

check the adapter monitor for error details:

"http://<host>:<J2EE-port>/mdt/amtServlet"

Regards

Stefan

Former Member
0 Kudos

what do you mean by target structure.the mapped structure or the final file that is written to the FTP Folder.

the mapped structure is a treee

<root>

<header>

<recordtype>H</recordtype>

</header>

<company>

<recordtype>C</recordtype>

<companycode>001</companycode>

<detail>

<recordtype>D</recordtype>

<customer>c1</customer>

</detail>

<detail>

<recordtype>D</recordtype>

<customer>c2</customer>

</detail>

</company>

<company>

<recordtype>C</recordtype>

<companycode>002</companycode>

<detail>

<recordtype>D</recordtype>

<customer>c3</customer>

</detail>

<detail>

<recordtype>D</recordtype>

<customer>c4</customer>

</detail>

</company>

<trailer>

<recordtype>T</recordtype>

</trailer>

</root>

with the company 1 to unbounded

under which there can be multiple details...

moorthy
Active Contributor
0 Kudos

Ultimately file structure is Flat Structure? So you need to have your Target Message type structure should be flat. ( Target File Strcuture (Message Type)

For more-

http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm

/people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion

Regards,

moorthy

moorthy
Active Contributor
0 Kudos

Hi,

First of you make sure that your target structure is a Flat Structure. It should be flat.

First check your output xml i.e after mapping in the SXMB_MONI. If all the fields are coming in the xml, then it should work provided the data lengths are matching with the structure.

BTW what is the Error in the Adapter /Message monitoring?

Regards,

moorthy