Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 

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 in the earlier section.  We need to modify certain tags before using it on the receiver side. (Note:1414292)

  1. Import the IDoc from corresponding R/3 system in ESR.
    1. 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'.
  2. After the import is successful, open the IDoc, switch to the WSDL tab and Export the WSDL into a file
  3. Make a copy of the WSDL and edit it to reflect the following changes:
    1. 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
    2. 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.
    3. Import the modified WSDL as an external definition. (B)
      This will be used in the receiver interface – let us denote this as 'B'.
    4. 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

  1. Create these Interfaces with the listed attributes.
FieldSender Interface (SI_A)Receiver Interface (SI_B)
CategoryAbstractAbstract
Interface patternStateless XI 3.0 CompatibleStateless XI 3.0 Compatible
ModeAsynchronousAsynchronous
Request TypeIdocExternal Definition (3.d in Creation of wsdl section)

  2. Save and Activate all the changes.

Creation of Mappings

  1. 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.
  2. Perform the mapping with the corresponding field
  3. Create an Operation Mapping with source as Sender Interface (SI_A) and Target as Receiver Inteface (SI_B)
  4. Assign the message mapping to this operation mapping
    Save and Activate all the changes

Creation of Integration Flows

  1. Create an Iflow with following attributes
    FieldSenderReceiver
    InterfaceSI_ASI_B
    AdapterIdoc_AAESOAP, XI 3.0, JPR URL
  2. Assign the operation Mapping created to this integration Flow.
  3. Save , Activate and deploy all the changes

Modelling BPM Process

  1. Create a new Process Composer Development Project
  2. Import the SI_B from ESR under service Interfaces tab.
  3. The data types should be created under a namespace "urn:sap-com:document:sap:idoc:messages"
  4. Assign this to the SE of the BPM Process
  5. Create a data object and map in Output Mapping
  6. 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

  1. Trigger the IDoc from the R/3 system.
  2. Monitor the messages using the Message Monitor page in NWA. Verify that they have been delivered.
  3. 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.



7 Comments