SAP Writing

RFC_IDOC_INBOUND_ASYNCHRONOUS_1.getIDOC_INBOUND_ASYNCHRONOUS().unmarshal( IDOC.marshal() );

RFC_IDOC_INBOUND_ASYNCHRONOUS_1.getIDOC_INBOUND_ASYNCHRONOUS().executeAsynchron ous( "GUIID" );

The byte array marshalled from the IDOC 947 bytes long. The StringIndexOutOfBoundsException occurs at position 1063 on the first line shown above. Their is no error in the marshalling, only that the marshalling is producing a byte array that is too short for the IDOC to be written. So when the RFC_IDOC_INBOUND_ASYNCHRONOUS_1 (BAPI) tries to unmarshal the IDOC it fails because it is too small (i.e 947 bytes and not 1063)

What could make the IDOC marshal method produce a byte array that is too short? This is puzzling since if I don't set all of the IDOC properties (both for the control record and for the message itself) then I get another error. So in theory, the IDOC should be fully populated.

[915 byte] By [SeeBeyond_deva] at [2007-11-26 16:20:28]
# 1

There can be different reasons for this error and it might be easier to see if you print the marshalled byte array to the log file to inspect the result of the marshal operation. One reason could be that the iDoc otd was created as an v3 iDoc instead of a v4 iDoc. The older releases have a smaller control record and will cause unmarshal exceptions when unmarshalling them into IDOC_INBOUND_ASYNCHRONOUS as that function is for v4 iDocs only. V4 iDocs always start with the string EDI_DC40 so if you look at the marshal result you can tell if this is the problem you are facing.

Frederik@NLa at 2007-7-8 22:44:04 > top of Java-index,Java Enterprise System,Java Composite Application Platform Suite -- General Discussion...
# 2

Hi,

I have looked at another developer's code and included the EDI_DC40 value for the first field in the control record (Table Name). This was what he did and his code writes to SAP successfully. Interestingly enough this caused the exception to look at index 1587 instead of index 1063 :-)

The IDOC and marshalled byte array length are still equal in size, namely 947 bytes. The content of both is also the same. I use the marshalled bytes to create a new String to compare the original IDOC with the bytes generated from the marshal method.

SeeBeyond-deva at 2007-7-8 22:44:04 > top of Java-index,Java Enterprise System,Java Composite Application Platform Suite -- General Discussion...