Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parsing an IDoc in XML format using SAP Java IDoc Class Library

Tags:

java

sap

idoc

In a system not connected with SAP I am receiving an IDoc in XML format (if of any importance a Customer Master - DEBMAS07).

1. Is it possible to read this XML document using the Java IDoc Class Library (sapidoc3.jar) WITHOUT a connection to the SAP system?

2. Is it possible to generate an IDoc in XML format using Java IDoc Class Library (sapidoc3.jar) WITHOUT a connection to the SAP system?

I haven't found any clear examples on how to do this, how to work this this clases, and the examples I've found are using classes that require a connection to SAP.

like image 983
Valentin Despa Avatar asked Nov 17 '13 18:11

Valentin Despa


People also ask

How do I convert IDoc to XML?

To export an IDoc as an XML, you will first need to open transaction SE37. Enter the element IDOC_XML_TRANSFORM in the function block and execute it by clicking on F8. As you can see on the picture below, the IDoc is now shown as an XML data.

What is the difference between IDoc and XML?

While XML allows having some metadata about the document itself, an IDoc is obliged to have information at its header like its creator, creation time etc. While XML has a tag-like tree structure containing data and meta-data, IDocs use a table with the data and meta-data.

Can we download the IDoc in SAP?

To Download the IDoc Description File From SAP. Log into the SAPGUI, and close the system messages. The SAP Easy Access window appears. If the SAP Easy Access window does not display, click Exit.


1 Answers

Without the respective IDoc meta data you cannot interpret the XML data as an SAP IDoc. Without having this IDoc meta data, the IDoc-XML document is just some hierarchically structured bunch of strings.

And the only way for the SAP Java IDoc Class Library to get the IDoc meta data is to query it from some SAP System - at least this is valid for the current version 3.0.12 of the JIDocLib. So the answer to both of your questions is unfortunately: NO.

Of course, you can parse the IDoc-XML with a standard XML parser like any other arbitrary XML document.

like image 90
Trixx Avatar answered Sep 29 '22 11:09

Trixx