on 01-24-2007 6:19 PM
Hi,
I have been trying to insert some records from a flat file into a sybase database using the FILE adapter (with file content conversion) as a sender and the JDBC adapter as a reciever, but I keep getting mapping errors like:
RuntimeException during appliction Java mapping com/sap/xi/tf/_mm_hh_file__hh_sybase_nombres_</Trace>
<Trace level="1" type="T">com.sap.aii.utilxi.misc.api.BaseRuntimeException: RuntimeException in Message-Mapping transformation: Cannot produce target element /ns0:mt_hh_sybase_nombres/STATEMENTNAME. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd at com.sap.aii.mappingtool.tf3.AMappingProgram.start
I have read through some blogs and I still can't figure out what is wrong.
Flat pipe separated file:
Hans|Robert|Hahn|Gallegos
Karina|Maria|Cordoba|Gutierrez
Datatype for this file looks like this:
Record 1
Row 1...Unbounded
Nombre 1
SegundoNombre 1
ApPaterno 1
ApMaterno 1
Because the FILE adapter uses Content conversion, the file translates to:
<?xml version="1.0" encoding="utf-8" ?>
<ns:hh_test xmlns:ns="http://me.com">
<Record>
<Row>
<Nombre>Hans</Nombre>
<SegundoNombre>Robert</SegundoNombre>
<ApPaterno>Hahn</ApPaterno>
<ApMaterno>Gallegos</ApMaterno>
</Row>
<Row>
<Nombre>Karina</Nombre>
<SegundoNombre>Maria</SegundoNombre>
<ApPaterno>Cordoba</ApPaterno>
<ApMaterno>Gutierrez</ApMaterno>
</Row>
</Record>
</ns:hh_test>
My database table looks like this:
Nombres
ApPaterno
ApMaterno
Datatype for this table looks like this:
STATEMENTNAME 1..Unbounded
nombres 1
action optional
TABLE 1
access 1
Nombres 1
ApPaterno 1
ApMaterno 1
MAPPINGS as follows:
Record ------> no mapping
Row ------> STATEMENTNAME
Constant ------> action
Constant ------> TABLE
Nombre + SegundoNombre ------> Nombres
ApPaterno ----> ApPaterno
ApMaterno ----> ApMaterno
How do I do the mapping ? I've been through a lot of blogs and threads but I haven't found an example like this, a flat pipe separeted multiline file with records to be inserted in a database.
Message was edited by:
Hans Hahn
Hans,
The error shows you have an error in mapping. Also you have mapped constant for ACTION and TABLE. Here you have to hardcode the value INSERT or UPDATE etc for ACTION and the name of the table for TABLE.
Check this weblog where he has mentioned everything what you are looking for:
/people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30
Also once when you are done with mapping try to execute it in the test tab of mapping editor.
---Satish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Satish,
thank you for your quick reply. Indeed, in the mapping section I used a constant with the value of the action (in this case INSERT) and a constant with the value of the table (in this case "nombres") and have mapped them to TABLE and ACTION. Or do you mean I have to change the name of element TABLE to the table name?
I followed the instructions of the blog you sent, actually my senario is based on it. I also tested the mapping in the mapping editor and it runs successfuly there! that's why I don't understand what is wrong.
Any ideas ?
Hans,
Please check whether you have given any value for "XML namespace" field in Message Type? If there is a XML namespace (not target name space) defined in MT, then you need to specify the document name space in the File Content Conversion of File adapter. Please make sure that you specified these things and let me know how it goes.
--Archana
Hi Archana,
thanks for your reply, I checked the namespace you told me and both are specified and are the same. I think there is something wrong with the mapping itself I have looked at
http://help.sap.com/saphelp_erp2005/helpdata/en/2e/96fd3f2d14e869e10000000a155106/frameset.htm
but, this document does not specify HOW to do the mapping, is the mapping I did correct ? is it correct to map ROW to STATEMENTNAME ? having both an occurence of 1..Unbounded ?
Ok now try to run the interface once again. If you get the runtime exception check your mapping once again. But now you take the payload from the source xml message. Check this weblog on how to do this:
/people/michal.krawczyk2/blog/2005/09/16/xi-how-to-test-your-mapping-in-real-life-scenarios
---Satish
Thanks a lot guys, it finally worked ! There was a problem with the Document name in the file conversion parameters, it didn match the message type name in the mapping section.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have a look at
http://help.sap.com/saphelp_erp2005/helpdata/en/2e/96fd3f2d14e869e10000000a155106/frameset.htm
thanks,
pooja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.