Overview
What is an IDoc?
IDoc or Intermediate Document is an SAP document format for business transaction data transfers.
This blog describes the detailed steps to be followed for setting up and sending an IDoc from an SAP R3 system to SAP BPM via SAP PI in a Process Orchestration setup.
An IDoc cannot be directly imported into SAP BPM. The WSDL generated from an imported IDoc in ESR is not WS-I compliant – hence you may face runtime issues when BPM tries to consume the service interface created of IDoc type.
Let us see how we can overcome this constraint and have the scenario run successfully.
Creation of Design objects
Creation of wsdls
The IDoc we import from an SAP R/3 system will be used on the sender side but we cannot use this on the receiver side (BPM) because it is not WS-I compliant as mentioned earlier in the "Problem Statement". We need to modify certain tags before using it on the receiver side. (Note:1414292)
- Import the IDoc from corresponding R/3 system in ESR.
- Open ESR, right click on Imported objects, provide R3 system details and import IDoc (A)
This will be used in the sender interface – let us denote this as 'A'.
- Open ESR, right click on Imported objects, provide R3 system details and import IDoc (A)
- After the import is successful, open the IDoc, switch to the WSDL tab and Export the WSDL into a file
- Make a copy of the WSDL and edit it to reflect the following changes:
- Set the targetNamespace attribute to "urn:sap-com:document:sap:idoc:messages" and xmlns attribute to "urn:sap-com:document:sap:idoc:messages" for the xsd:schema
- Set the xmlns attribute to "urn:sap-com:document:sap:idoc:messages" for the <WSDL:definition> element
Refer to the image below for an example. - Import the modified WSDL as an external definition. (B)
This will be used in the receiver interface – let us denote this as 'B'. - Save and Activate all the changes.
Note : To set a relevant type for a data object in BPM for an element, there needs to be a name associated with the complex type.
For example.. Below is the structure of the exported idoc in ESR
<xsd:element name="HRCC1UPTEVEN01"><xsd:complexType><xsd:sequence><xsd:element name="IDOC" type="HRCC1UPTEVEN.HRCC1UPTEVEN01"/></xsd:sequence></xsd:complexType>
We need to have an associated name to the complex type as shown below.
<xsd:element name="HRCC1UPTEVEN01" type=”named_example_complex_type”><xsd:complexType name=”named_example_complex_type”><xsd:sequence><xsd:element name="IDOC" type="HRCC1UPTEVEN.HRCC1UPTEVEN01"/></xsd:sequence></xsd:complexType>
Creation of Service Interfaces
- Create these Interfaces with the listed attributes.
Field | Sender Interface (SI_A) | Receiver Interface (SI_B) |
---|---|---|
Category | Abstract | Abstract |
Interface pattern | Stateless XI 3.0 Compatible | Stateless XI 3.0 Compatible |
Mode | Asynchronous | Asynchronous |
Request Type | Idoc | External Definition (3.d in Creation of wsdl section) |
2. Save and Activate all the changes.
Creation of Mappings
- Create a Message Mapping with source as IDoc (A) and target as External Definition (B)
Note : This is required as the sender and receiver do not use the same schema. - Perform the mapping with the corresponding field
- Create an Operation Mapping with source as Sender Interface (SI_A) and Target as Receiver Inteface (SI_B)
- Assign the message mapping to this operation mapping
Save and Activate all the changes
Creation of Integration Flows
- Create an Iflow with following attributes
Field Sender Receiver Interface SI_A SI_B Adapter Idoc_AAE SOAP, XI 3.0, JPR URL - Assign the operation Mapping created to this integration Flow.
- Save , Activate and deploy all the changes
Modelling BPM Process
- Create a new Process Composer Development Project
- Import the SI_B from ESR under service Interfaces tab.
- The data types should be created under a namespace "urn:sap-com:document:sap:idoc:messages"
- Assign this to the SE of the BPM Process
- Create a data object and map in Output Mapping
- Build and Deploy the processes
Note : The WSDL might have errors as "s4s-att-invalid-value: Invalid attribute value for 'maxOccurs' in element 'element'.
Recorded reason: cvc-datatype-valid.1.2.1: '9999999999' is not a valid value for 'nonNegativeInteger'."
This can be ignored.
Sending IDoc from R/3 System
- Trigger the IDoc from the R/3 system.
- Monitor the messages using the Message Monitor page in NWA. Verify that they have been delivered.
- The BPM Process should be started and the context data should be updated in the corresponding sent fields. This can be monitored in Manage Processes Page in NWA.