cancel
Showing results for 
Search instead for 
Did you mean: 

Getting IDoc structure out of SAP with JCo

Former Member
0 Kudos

Hi everybody,

I have the problem that I somehow need to get the structure of an IDoc out as XML.

In the JCoIDoc Sample application that comes with the idoc.jar and jcoidoc.jar, I always have to provide the type of IDoc from which I want to get the structure (e.g. "MATMAS02"). That means I have to KNOW which IDoc types in the SAP system exist. And even if i knew the type, there's another problem:


IDoc.Repository idocRep = JCoIDoc.createRepository("MyIDocRepository", "MyPool");

JCO.Client client = JCO.getClient("MyPool");

String strIDocName = "MATMAS02";
IDoc.Document doc = JCoIDoc.createDocument(idocRep, strIDocName);

String xmlString = doc.toXML();

Unfortunately, the returned XML only gives me the header part of the IDoc, but not, which elements below are possible:

<?xml version="1.0" encoding="windows-1252"?>
<MATMAS02>
    <IDOC BEGIN="1">
        <EDI_DC40 SEGMENT="1">
            <TABNAM>EDI_DC40</TABNAM>
            <MANDT/>
            <DOCNUM/>
            <DOCREL/>
            <STATUS/>
            <DIRECT/>
            <OUTMOD/>
            <EXPRSS/>
            <TEST/>
            <IDOCTYP>MATMAS02</IDOCTYP>
            <CIMTYP/>
            <MESTYP/>
            <MESCOD/>
            <MESFCT/>
            <STD/>
            <STDVRS/>
            <STDMES/>
            <SNDPOR/>
            <SNDPRT/>
            <SNDPFC/>
            <SNDPRN/>
            <SNDSAD/>
            <SNDLAD/>
            <RCVPOR/>
            <RCVPRT/>
            <RCVPFC/>
            <RCVPRN/>
            <RCVSAD/>
            <RCVLAD/>
            <CREDAT>20050427</CREDAT>
            <CRETIM>102001</CRETIM>
            <REFINT/>
            <REFGRP/>
            <REFMES/>
            <ARCKEY/>
            <SERIAL/>
        </EDI_DC40>
    </IDOC>
</MATMAS02>

Is it possible to get the other segments as well?

And another question:

Now with BAPIS, there exist RPY_BOR_TREE_INIT and RPY_OBJECTTYPE_READ, with which I can create my own Busines Object Repository ("BAPI-Browser").

Is there something similar for IDocs ("IDoc-Browser")?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Andreas,

Did you work this one out? I am running into the same issue. I am sure that there is an easy explanation, but wondered if you could save me some time?

Many thanks,

Chris