Friday, July 16, 2010

Receiving SAP iDocs in Oracle BPEL process

This post is an extension to my earlier post on invoking-sap-bapis-from-oracle-bpel . Here I will be covering detailed steps involved in receiving SAP iDocs into Oracle BPEL process. Unlike Service adapters in case of BAPI we will be dealing with Event adapters incase of SAP iDocs. We can use events generated in SAP system due to some DB activity/application process to trigger a BPEL process. For doing this we need to create a SAP channel in Application explorer and select this channel to create a JCA Inbound WSDL(Event Notification – BPEL receive). Few things to be noted about SAP Channel:
  • It only applies to J2CA configuration
  • You must create channels for every different event object. Also each channel must be associated with a unique SAP R/3 program id.
  • After creating/modifying channels weblogic server must be restarted for the changes to take effect at runtime.

In above screenshot showing Channel creation steps, note the value of Program Id of server (BPEL01). This will be registered in the SAPGUI as a RFC destination. This helps SAP to direct the events to the target system. For detailed steps on how to register Program Id on SAPGUI please check the Appendix section Configuring SAP R/3 Outbound Processing from SAP R/3 User's Guide for Weblogic server

Once the SAP Channel has been created under Events section goto the Adapters section and generate the Inbound WSDL for your iDoc (you will have to use the SAP channel while creating inbound WSDL). This process generates 3 files: *.wsdl, *.jca and *.xsd under the $SOA_HOME/soa/thirdparty/ApplicationAdapters/wsdls directory.

Next copy these files to your local machine and in your Jdeveloper create a BPEL process with a third party adapter service which uses the *.wsdl and *.jca files for configuration. Complete the BPEL process to receive the idoc from the third party adapter service and do further processing.

Restart your Weblogic server and now when a transaction/action is performed on SAP server like generating a sales order that should trigger the BPEL process.