cancel
Showing results for 
Search instead for 
Did you mean: 

XML attachment

Former Member
0 Kudos

Hi Experts,

I'm working with a JDBC Receiver and the Receiver database is expecting the ControlRecord fields as usual in each column but the rest of the message in a CLOB. Which means that they want the whole XML file, with the tags and everything in the last field which is the CLOB. How can I do this? I'm managing to put in the controlrecords correctly but don't know how to put the whole XML file into the last field (If it's even possible?).

Any suggestions?

Accepted Solutions (1)

Accepted Solutions (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>>I'm managing to put in the controlrecords correctly but don't know how to put the whole XML file into the last field (If it's even possible?).

Yes, it is possible. Use simple java mapping to collect your input payload and map it to a target last field element.

Former Member
0 Kudos

Hi,

Do you mean an UDF? Will it take all the input payload incl. the xml tags?

How would the code for such action look like?

Regards

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Yes, you could write UDF too.. pick entire payload and return the payload as string and map it to target last field.

Former Member
0 Kudos

Great! But I'm no good at Java. are there any blogs for this solution? Or could you perhaps type the code here if you are able to?

Appreciate the help!

baskar_gopalakrishnan2
Active Contributor
0 Kudos

I would use java mapping ... and since you dont have java experience. Take help from javaguy to do this..

sample java mapping link

https://wiki.sdn.sap.com/wiki/display/XI/SampleJAVAMappingcodeusingPI7.1+API

Former Member
0 Kudos

Thanks for the reply!

But shouldn't be easier to only do an UDF since it's only the last field of the target structure that is affected?

Former Member
0 Kudos

Do you want to "serialize" the whole XML content as one unique string stored in a CLOB db field ? Or do you need it as a binary representation in the corresponding XML field ?

Chris

Former Member
0 Kudos

HI,

I want to "serialize" the whole XML content as one unique string stored in a CLOB db field. And I want the stored string to be surounded by the complete XML tags.

Target structure:

Param1 <value1>

Param2 <value2>

CLOB <?xml version="1.0" encoding="UTF-8" ?> <XXX> <IDOC BEGIN="1"> <EDI_DC40 SEGMENT="1"> <TABNAM>EDI_DC40</TABNAM> <MANDT>100</MANDT> <DOCNUM>0000000010297271</DOCNUM></IDOC>

</XXX>

Former Member
0 Kudos

Sonny,

Maybe these 2 blogs could help you :

/people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping

/people/jyothi.anagani/blog/2010/06/17/convert-the-input-xml-to-string-in-pi-71-using-standard-graphical-mapping

Chris

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Yes, I would go with christopher's second link.. If your PI is 7.1

Use the source message root node , select return as xml and use trim function & map it to clob field.

That's is the easiest solution.

Former Member
0 Kudos

Thanks!! the second link solved the issue.

didn't know about the new feature in PI 7.1.

Best regards

Answers (1)

Answers (1)

former_member181985
Active Contributor
0 Kudos

check my blog: [SAP XI/PI: Storing BINARIES (Images, PDFs etc.) in the Database (BLOBs) Using JDBC Adapter|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/18494] [original link is broken] [original link is broken] [original link is broken];