cancel
Showing results for 
Search instead for 
Did you mean: 

Rebuild a XML content inside a XI message

Former Member
0 Kudos

Hello all,

we struck following point during our testing of "JDBC->RFC interface".

We have a JDBC adapter which reads records in certain database/table matching the condition. The SQL statement is e.g. like this:

select event, datetime, content from tracetab where status='X'

Understandably it fills a XI document let's say with "document name" = 'DBResultset_MSG' with proper tructure "<row><event /><datetime /><content /></row>.

So far so goot. The whole point is that the column CONTENT in the database record contains a "XML Document"

So when the JDBC adapter sends the "MainDocument" into XI, it looks like this:

---------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<ns:DBResultset_MSG xmlns:ns="http://appg.com/CEZ_PP2SAP">
	<row>
		<EVENT>ZNM.export_row</EVENT>
		<DATETIME>20050729111500</DATETIME>
		<CONTENT>&lt;ZNM&gt;&lt;NESS_MRDTL_V rownum=&quot;1&quot;&gt;&lt;MATERIAL_REQUEST&gt;00201228&lt;/MATERIAL_REQUEST&gt;&lt;CATALOG_ID&gt;0000208130&lt;/CATALOG_ID&gt;&lt;Q_LEVEL&gt;0&lt;/Q_LEVEL&gt;&lt;NON_CATALOG_KEY&gt;         &lt;/NON_CATALOG_KEY&gt;&lt;FACILITY&gt;HS &lt;/FACILITY&gt;&lt;MOVEMENT_TYPE&gt;261&lt;/MOVEMENT_TYPE&gt;&lt;QTY_MTL_RQST&gt;1&lt;/QTY_MTL_RQST&gt;&lt;WORK_ORDER_NBR&gt;4000195&lt;/WORK_ORDER_NBR&gt;&lt;STORAGE&gt;CZ01&lt;/STORAGE&gt;&lt;/NESS_MRDTL_V&gt;&lt;NUM_OF_ROWS&gt;1&lt;/NUM_OF_ROWS&gt;&lt;/ZNM&gt;</CONTENT>
	</row>
</ns:DBResultset_MSG>
---------------------------------------------------------

As you can see, the JDBC adapter converts characters '<i><</i>' and '<i>></i>' ... which is probably ok, otherwise the XI message wouldn't make sence.

Our question is, which procedure would you suggest to "rebuild" the XML message to be mapped afterwards to RFC according to needs.

Our idea is to define same structure as the XML's structure into XI MessageType and remap the "demaged" content into it. The point is how ? We think that Java mapping is the only solution here.

What would you say ???

Thanks all in advance.

Regards Tomas

Accepted Solutions (0)

Answers (1)

Answers (1)

STALANKI
Active Contributor
0 Kudos

You can write a user function and appropriately use the java appropriate string functions and map it to the RFC interface.You can split by the column names.It is relatively easy than going for java mappping.

Ex:If you are mapping to material number of RFC messagetype.

1.Define user function which searches for the <MATERIAL_NUMBER> and reads the value until it encounters </MATERIAL_NUMBER>.

It should return the value inside the material number tag.

Simple java function will be able to achieve this.

2.Once you can acheieve this for one field,replicating it for other fields will be easy.

We can do the functionality using one simple user defined mapping.