Extract values from IDOC

Hi !

I am receiving an IDOC from a SAP System. I want to “extract” all values and save them in a database.
How can i do this ?

Currently, I am using the “encode” Service to encode to a xmlData-String. With the Service XMLValuesToRecord i sould get a record with all values. But somewhere must be a mistake cause nothing is working.
Does anybody of you see the problem ?


use sap.idoc:transformFlatToHierarchy, and then pub.xml:documentToXMLString and you’ll have a xml file that you can write to your DB

I am using SAP Business Connector 4.7.
I did not find “pub.xml:documentToXMLString”. Where can i find this service ?

ah you may still be using the older services in pub.web, therefore you’ll need pub.web:RecordTodocument - we use IS6.01 [where pub.web has been deprecated]

pub.web:RecordTodocument generates a String “xmlData”.
As i want to save every single value in a DB i need to extract every single xml value.
Is there also a service or do i need to develop a java service ?

When you have the Idoc as string, use it as input for the service “queryDocument”, then start a trace, after this you will be able to take the necessary fields out of it.

In that case you’ll need to loop through the boundNode and make sure you concatenate the data into the way you need to best present into your DB.
Curious why you need to do this in this way, why not save the file to local drive and write location reference to DB logging…?


Sorry, but i don’t know how to trace ? Which Service do you mean ?
I only found the tracePipeline service but it writes all fields to the server log. so not what i need.

Tracing is a functionality of the webmethods Developer(not a service), you can run a programm, trace it, or go through it step by step

but more important is the function queryDocuments, there you have to set which fields he should take from the idoc
for example:


Once you have the IDOC string use the transformFlatToHierrachy,documentToRecord services and map the output to a recordReference(IDOC document structure created from SAP IDOC schema) and so this will hold the extracted data from the IDOC string.

So depends on the IDOC structure loop thru the record and map the individual values to the WmDB service (execSQL)inputs,this will insert to DB.

Use the Search functionality provided in this site,it will help you to resolve the problems fast,since same issue might have covered earlier.