on 12-02-2009 6:25 PM
I'm using the JCo API in conjunction with the IDoc Class Library and am trying to find out how to get a textual flat file representation of an IDocDocument instance. It's easy produce an XML representation using the IDocXMLProcessor, e.g.:
public String getIDocAsText( IDocDocument doc )
{
return JCoIDoc.getIDocFactory().getIDocXMLProcessor().render( doc );
}
I also need to be able to parse the textual representation of an IDoc back into an IDocDocument. Again, this is simple to do with the XML representation. e.g.:
public IDocDocument getIDocFromText( IDocRepository repo, String idocXML )
throws IDocParseException
{
return JCoIDoc.getIDocFactory().getIDocXMLProcessor().parse(
repo, idocXML ).get( 0 );
}
However, I need to this with the tradtional (i.e. non-XML) representation; can anyone give me some pointers as to how this can be acheived?
The most promising lead I've found is this How-To:
However, I need to do this purely in Java.
Kind regards and thanks in advance for yout time,
Jon
Hi Jon,
When you talk about the textual flat file representation of an IDoc I assume you mean the file format that inbound processing program RSEINB00 uses. If this is not what you're looking for, ignore my answer, because it won't be applicable...
The flat file representation of an IDoc is pretty simple. Basically you have lines with fixed record structures giving first one line for the IDoc control record and then one or more lines of data segments (obviously as many as you have data segments). There's two basic choices for the record structure that should be used. For SAP version 4.x and higher you should use EDI_DC40 for the control record and EDI_DD40 for the data record; if you're on a lower SAP version, use EDI_DC and EDI_DD instead.
The TABNAME field in the control record has to be filled with the String "EDI_DC40" or "EDI_DC" depending which version you've chosen. The rest of the fields are straightforward, since they should represent the same field names that you have already.
The data segments are a bit more tricky, because with the XML IDoc you should have all data fields individually. However, in the text file (and other functions using IDocs like IDOC_INBOUND_ASYNCHRONOUS) the segment contents is stored in a field called SDATA. This is basically a fixed record layout using the structure of the segment, so you need the meta data of each segment (you can retrieve that via method getStructureDefinition() from the repository using the segment name).
Cheers, harald
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.