cancel
Showing results for 
Search instead for 
Did you mean: 

How to read XI Data type in Java code and populate as array list, using UDF

Former Member
0 Kudos

Hi,

How to read XI Data type in Java code and populate as array list, using UDF?

Is there any API using which the XI data types can be read?

Kindly reply.

Richa

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks for the prompt reply,

Could anyone please tell me about the source code for how do I achieve this.

For example how do I read the input value , as explained in the previous reply, and place in the an Array/Hashmap?

bhavesh_kantilal
Active Contributor
0 Kudos

Did you search like I had asked?

Meanwhile the blogs I was talking about,

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii

Regards

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

Not sure I follow the question.

You create the datatype using a datatype editor or you import the datatype as a WSDL, or XSD or DTD.

Can you give more details as to what you are trying to achieve and why?

Regards

Bhavesh

Former Member
0 Kudos

Hi,

I am not very well versed in XI.I work on EP(java)

Actually this question is more Java specific.

My questtion is,

1) input data types are already created using the the editor (left hand side input mappings).The requirement is to write a user defined function to read the input data type structure of XI using java code.

2) Once it is read , this needs to be populated as output structure as arrayList (which is normally done using editor only in XI).

I hope I was able to explain what I need.

Thanks,

Richa

bhavesh_kantilal
Active Contributor
0 Kudos

Okie, got it.

You wnat to read the entire XML message and so are looking to write a UDF to handle this.

Well , unfortunately you cannot handle this using Graphical mapping.

Use Java Mapping and the Java Mapping gives the input XML as an InputStream and now convert this Input Stream in your mapping prgogram into a String and you have the entire XML as a string. Now, you can add this to your target element by creating the target strcuture.

Just search on SDN for "Java Mapping" + blogs and you will find a series by Prasad Ullagappan and you can use that to understand the approach.

Regards

Bhavesh

Former Member
0 Kudos

Richa,

Can you give the expected source and target XML structures? Your requirement is still not very clear.

Regards,

Jai Shankar

Former Member
0 Kudos

Input Structure:

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

<ns0:CustomerCreateResp xmlns:ns0="urn:bp:xi:up:re:cust_mdm:cmdm:pr5:100">

<CUSTOMER>

<item>

<CUSTOMERNO/>

<MDMCUSTOMER/>

<CREATE_DATE/>

<RETURN>

<TYPE/>

<MESSAGE/>

</RETURN>

<PT_CONTPART_RETURN>

<item>

<MDM_CONTACT/>

<CONTACT/>

</item>

</PT_CONTPART_RETURN>

<PARTNERS>

<item>

<CUSTOMERNO/>

<PARTNER_FUNCTION/>

<PARTNER_NUMBER/>

<DEFAULT_PARTNER/>

</item>

</PARTNERS>

</item>

</CUSTOMER>

</ns0:CustomerCreateResp>

Output structure

(Sample output structure.This actually needs to be mapped and generated using UDF)

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

<ns1:updateCustomer xmlns:ns1="urn:xiSericeVi"><ns1:customer><ns2:ArrayList xmlns:ns2="java:sap/standard">[]</ns2:ArrayList></ns1:customer><ns1:name>2344566</ns1:name></ns1:updateCustomer>