cancel
Showing results for 
Search instead for 
Did you mean: 

Error in Flat File to XML conversion

Former Member
0 Kudos

Hi all,

I am trying to convert a flat file to XML using the Sender File Adapter and I am getting the following error message.

--

2006-01-23 17:23:00 EST: Error: Conversion of complete file content to XML format failed around position 0: Exception: ERROR converting document line no. 2 according to structure 'GL_FileUpload_SAPECC_Header_DT1':java.lang.Exception: ERROR in configuration: more elements in file csv structure than field names specified!

---

My flat file looks like this,

--Start

GL,GLI,1,RefTest,4011,Test,1234567890,12032005,12032005,GL,RK

GL,GLI,4011,3011,,,,,,AU,600,7000,8000,9000,5000,RK,,,,,,,,,,,,,,,,,,,,

---End

The adapter configuration is like this:

Document Name: GL_FileUpload_SAPECC_Item_MT1

Document Namespace: urn:corptech.qld.gov.au:sss_std_offering:gl

RecordSet Name: GL_FileUpload_SAPECC_Record_DT1

RecordSet Namespace: urn:corptech.qld.gov.au:sss_std_offering:gl

RecordSet Structure: GL_FileUpload_SAPECC_Header_DT1,1,GL_FileUpload_SAPECC_Item_DT1,*

RecordSet Sequence: Ascending

Key FieldName: TransType

On the Adapter Properties, I have got:

--Start

GL_FileUpload_SAPECC_Header_DT1.fieldNames: TransType,RowType,SequenceNo,ReferenceKey,SenderSystem,HeaderText,CompanyCode,DocumentDate,PostingDate,DocumentType,ReferenceNo

GL_FileUpload_SAPECC_Header_DT1.fieldSeparator: ,

GL_FileUpload_SAPECC_Item_DT1.fieldNames: TransType,RowType,SequenceNo,GLAccount,CostCentre,ProfitCentre,InternalOrder,WBSElement,TaxCode,Currency,GLAmount,VendorAmount,CustomerAmount,AssetAmount,DRCR,ItemText,VendorNo,CustomerNo,Name,Street,City,PostCode,PoBox,State,Country,BankKey,BankAccount,BankCountry,CalcTax,PaymentTerms,BaseDate,PaymentBlock,PaymentMethod,Assignment,AssetNo,AssetSubNo,AssetTransaction

GL_FileUpload_SAPECC_Item_DT1.fieldSeparator: ,

ignoreRecordsetName: true

GL_FileUpload_SAPECC_Header_DT1.keyFieldValue: GL

GL_FileUpload_SAPECC_Item_DT1.keyFieldValue: GL

---End

The structure defined on the data type looks like this,

--Start

GL_FileUpload_SAPECC_Record_DT1 Complex Type

GL_FileUpload_SAPECC_Header_DT1 Element

TransType Element

RowType Element

Sequence Number Element

---

---

GL_FileUpload_SAPECC_Item_DT1 Element

TransType Element

RowType Element

Sequence Number Element

GLAccount Element

---

---

---End

Any help or suggestion please.

Thank you.

Warm Regards,

Ranjan

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi, Ranjan.

First of all, let's look at the meaning of the error.

> ...Exception: ERROR converting document line no. 2 according to

> structure 'GL_FileUpload_SAPECC_Header_DT1':java.lang.Exception:

> ERROR in configuration: more elements in file csv structure than

> field names specified!

It seems that XI interpreted 2nd line as

Header_DT1 not as Item_DT1 that you meant.

> GL,GLI,4011,3011,,,,,,AU,600,7000,8000,9000,5000,RK,,,,,,,,,,,,,,,,,,,,

That's why it says this line has more elements than the structure

defined(Header_DT1)

And the reason why XI misinterpreted the above as Header is that

you used keyFieldValue with the same value.

> ...Header_DT1.keyFieldValue: GL

> ...Item_DT1.keyFieldValue: GL

According to the following help,

http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm

it says like the following.

-


Key Field Name

If you specified a variable number of substructures for Recordset

Structure, in other words, at least one substructure has the value

‘*’, then the substructures must be identified by the parser from

their content. This means that a key field must be set with different

constants for the substructures. In this case, you must specify a key

field and the field name must occur in all substructures.

-


How about using different constants for header and item if possible?

Good luck.

Former Member
0 Kudos

Hello Ranjan,

Make sure that the file encoding (UTF-8 ??) you configured in the adapter matches the encoding of the file you poll using the FTP adapter.

Maybe you have to switch to other nncoding iso-8859-1 (??).

Cheers,

Emile