Adapter for SAP 10.1 | webMethods Adapter for SAP Documentation | webMethods Adapter for SAP Installation and User’s Guide Documentation | Coding Client Applications and Services | Receiving IDocs from an SAP System | Accessing and Modifying Fields in IDocs
 
Accessing and Modifying Fields in IDocs
The following code sample shows how to use the SAP Java IDoc Class Library to convert an IDoc to a structured document with direct access to each field. This allows you to modify an IDoc's contents on the fly. For example, if you want to customize incoming IDocs based on local data format, you can do so.
IDataCursor idc=pipeline.getCursor();
com.sap.conn.idoc.IDocDocumentList iDocList=null;
if (idc.first("iDocList"))
iDocList=(com.sap.conn.idoc.IDocDocumentList) idc.getValue();
under Shared > Imports, include the lines:
com.wm.adapter.sap.idoc.*
com.sap.conn.idoc.*
Note:
To resolve the included Java classes, you must include the WmSAPpackage in the dependency section of your application package.
For more information about using the SAP Java IDoc Class Library, refer to Constructing an IDoc with the SAP Java IDoc Class Library.