Accessing SAP processes from IBM Business Process Manager using Enterprise Services

IBM® Business Process Manager can simplify access to SAP® processes by providing powerful tools to invoke SAP Enterprise Services in BPM process flows. This article demonstrates how to build a process flow to enable seamless and secure integration with SAP over the web services framework.

Share:

Bala Gopalan (b.gopalan@us.ibm.com), BPM Consultant, IBM

Photo of Bala GopalanBala Gopalan is a BPM Consultant with the Business Process Management and Integration Focused Technology Practice of the IBM Application and Integration Middleware (AIM) group. Bala has several years of hands-on experience in SAP and IBM Business Process Manager. He has been with IBM since 2006.



11 December 2013

Also available in Japanese

Introduction

IBM Business Process Manager (IBM BPM) is a comprehensive Business Process Management platform that provides tools and runtime for modeling, design, execution, monitoring and optimization, while at the same time providing powerful integration features to extend process capabilities of existing enterprise systems. SAP is one of the largest enterprise business software in the market. IBM Business Process Manager can simplify access to SAP processes by providing powerful tools to invoke SAP Enterprise Services in BPM process flows. IBM BPM abstracts the technical interface details of SAP without resorting to complex coding.

This article demonstrates a simple scenario where IBM BPM uses SAP Enterprise Services to access a customer's master data in SAP as part of an order entry validation process. With a few steps, you can establish a seamless and secure integration with SAP to build flexible and re-usable process flows.

Pre-requisites

  • Software versions:
    • SAP ECC 6.0 or higher and SAP NetWeaver 7.0 or higher
    • IBM BPM 7.5 Advanced or higher
  • This article assumes that you are familiar with IBM BPM (Advanced version) tooling and possess sufficient skills to create and run a basic business process using IBM Process Designer and IBM Integration Designer tools.
  • It will be helpful if you are familiar with the basic features of SAP ECC system.

SAP Enterprise Services

SAP Enterprise Services are standards-based web service definitions that are based on SAP business objects and processes. They support synchronous and asynchronous transmission styles and can be used to implement transaction or batch integration patterns.

The SAP Enterprise Services Workplace page provides a central repository of available Enterprise Services provided by SAP. The available enterprise services should be evaluated to see how well they address your specific requirements. However, note that the catalog of Enterprise Services delivered out-of-the-box is not comprehensive, and may limit your option in using these services. Where an Enterprise Service is not available, it is possible to build and expose a custom process in SAP as a web service.


IBM BPM Framework for accessing SAP processes

Using IBM BPM's powerful tooling, you can access SAP processes in different ways:

  • Guided Workflow for orchestrating and automating SAP transactions based on the model imported from SAP Solution Manager (IBM BPM V8.x and higher)
  • BPM Integration Services using WebSphere JCA Adapters, which integrate with SAP using proprietary technologies such as BAPI, Remote Function Call (RFC), Application Link Enabling (ALE), and Advanced Event Processing (AEP)
  • BPM Integration Services built using SAP Enterprise Services based on Simple Object Access Protocol (SOAP) and Web Services framework

To enable IBM BPM to use SAP Enterprise Services, Web Services Definition Language (WSDL) files generated from SAP can be manually imported into the IBM Integration Designer tool to automatically generate Service Component Architecture (SCA) components, such as interfaces and business objects. Alternatively, SAP WSDLs can be managed via WebSphere Services Registry and Repository (WSRR) to better manage, automate, and govern the web services (this is the recommended approach). In this article, we will directly import WSDLs into Integration Designer for demonstration purposes.


Use case scenario

To demonstrate invoking SAP Enterprise Services from BPM, we will use a simple use case where, as part of a customer pre-approval process, a customer lookup is performed from the SAP Customer Master record to retrieve customer details. The retrieved data can be used in the process, for example, to identify the customer as a preferred customer to offer incentives.

To implement this use case, we will define a "Customer Pre-approval" process in Process Designer using a BPMN flow, an integration service to look up SAP Customer Master using a web service (SOAP over HTTP) implemented in IBM Integration Designer, and an enterprise service exposed in SAP ECC to retrieve customer details (see Figure 1).

Figure 1. Customer pre-approval process
Customer pre-approval process

Preparing the SAP environment

Many standard SAP transactions are exposed as web services. SAP ES Workplace provides a list of exposed services in your SAP installation. In this article, we will work with an exposed enterprise service that is implemented in the ABAP back-end out-of-the-box in SAP.

The following simple steps enable SAP to accept requests over the web service interface:

  • Activate the pre-built enterprise service in the SAP Internet Connection Framework (SICF) page.
  • Create a binding for the activated enterprise service using the SAP SOAMANAGER tool.
  • Export the generated WSDL file.

Activate the Enterprise Service

First, locate the SAP enterprise service for which you want to build the integration service:

  1. Go to the SAP Enterprise Services Workplace site and search for customer master related enterprise services by entering "read customer basic data" in the Search field.
  2. From the search results, locate the "Read Customer Basic Data_V2" service and click to open it. Here, you can see the details of this out-of-the-box service under Technical Data. It shows relevant details of interest about this service, such as the version of SAP it supports, direction (inbound or outbound), mode (synchronous or asynchronous), and the WSDL for the service. Make a note of the "Related Web Service Definition" value for this service (ECC_CUSTBASICDATABYIDQR_V2). You will use this definition name to look for it under the SICF transaction code (Figure 2).
    Figure 2. Read Customer Basic Data_V2 service in SAP ES Workplace
    Read Customer Basic Data_V2 service in SAP ES Workplace
  3. Click on the WSDL link to download it. You will upload this WSDL into Integration Designer to build the web service call.

    Next, activate the web service that you identified in the SAP system. Note that activating an enterprise service is client specific. You have to activate the service in each SAP client that you connect to.

  4. Log on to the SAP system with valid credentials and invoke the SICF transaction. This transaction is part of the SAP Internet Connection Framework (ICF). In the Maintain Services screen, enter SERVICE as the criteria for Hierarchy Type and DEFAULT_HOST for the Virtual Host as shown in Figure 3. Click Execute.
    Figure 3. Maintain Services query screen in SICF
    Maintain Services query screen in SICF
  5. In the Maintain service results screen, under the Virtual Hosts/Services section, expand the default_host node and go all the way to default_host > sap > bc > srt > xip > sap sub-node. srt stands for the soap runtime, xip is the XI interface, and sap is the namespace.
  6. All the enterprise services available in this version of SAP are listed here. Scroll down and locate the service with the name of ECC_CUSTBASICDATABYIDQR_V2. Recall that this is the enterprise service definition name you noted down from the ES Workplace portal earlier (Tip: Use the Find button to search for the definition name). This service is grayed out as it has not been activated yet. Right-click on this service and select Activate Service from the context menu as shown in Figure 4. Click Yes in the pop-up with the question "Do you want to activate service…". Now this service is active for consumption.
    Figure 4. Activate enterprise service in SICF
    Activate enterprise service in SICF

Create binding

The next step is to create a binding for this web service so that it can be invoked from the BPM flow. Binding is the step where the protocol with which the web service will be invoked is assigned, along with the web service security setting, among other things. To create the binding, we use the SOAMANAGER interface, which was introduced in SAP NetWeaver V7.0 SP14.

  1. In the command window, enter /nSOAMANAGER to open up the SOA Manager portal in a Web Dynpro session.
  2. Click the Log On button and enter your SAP user ID and password one more time to enter the SOA Manager portal. In the portal, switch to the Service Administration tab and click to open the Single Service Configuration page. Enter ECC_CUSTBASICDATABYIDQR_V2 in the Search Pattern field. Select Both Names as the Field value and click Go. The Search Results table shows the external and internal names of your service, along with its namespace. Select the row to highlight it and press the Apply Selection button (Figure 5).
    Figure 5. Enterprise service search in SOAMANAGER page
    Enterprise service search in SOAMANAGER page
  3. This opens a section called "Details of Service Definition" below. Switch to the Configuration tab and click on Create Endpoint. A pop-up opens showing the service name, the description, and the new binding name. Change the New Binding Name value to ECC_CUSTBASICDATABYIDQR_V2_Binding and click Apply Settings to generate the binding details (Figure 6).
    Figure 6. Generate binding for enterprise service in SOAMANAGER
    Generate binding for enterprise service in SOAMANAGER

    Click to see larger image

    Figure 6. Generate binding for enterprise service in SOAMANAGER

    Generate binding for enterprise service in SOAMANAGER
  4. Scroll down to Configuration of Web Service End Point section of the screen and under the Provider Security tab. Leave the Transport Guarantee with the default values (None (HTTP) – we will use a plain HTTP connection for this demo). Under Authentication Settings > Authentication Method, select the User ID/Password option. This automatically selects sapsp: HTTPBasic as the Authentication Method. Click the Save button to save the configuration settings. Now the binding for your enterprise web service is successfully generated (Figure 7).
    Figure 7. Generated binding with HTTP basic authentication setting
    Generated binding with HTTP basic authentication setting

Export the WSDL and perform a quick test

Now export the WSDL with the specified binding so that it can be imported into the Integration Designer workspace.

  1. Scroll up to the Details of Service Definition section, switch to the Overview tab and click on the second link, Open WSDL document for selected binding or service, to open the WSDL with the generated binding.
  2. Save the file into your desktop with a name of ECC_CUSTBASICDATABYIDQR_V2.wsdl. Now the WSDL is ready to be imported into Integration Designer.

Now let us do a quick test of the new web service to verify that it works with HTTP basic authentication as expected.

  1. While still under the Overview tab, click on the Open Web Service navigator for the selected binding link to open the service test client in a new browser window. Enter the user ID and password to authenticate to the navigator.
  2. Now you can enter a customer number in the search criteria and test the service. (Figure 8).
    Figure 8. Testing the enterprise service
    Testing the enterprise service

    Click to see larger image

    Figure 8. Testing the enterprise service

    Testing the enterprise service
  3. To verify the binding, go back to SICF and verify that the newly generated binding is displayed (Figure 9).
    Figure 9. Generated binding in SICF
    Generated binding in SICF

This completes the SAP setup for invoking this web service.


Setting up IBM BPM to access SAP Enterprise Services

The BPM example process consists of a simple flow where a Coach UI is used to enter customer number, and a Customer Lookup button in the coach invokes an Advanced Integration Service (AIS) to retrieve customer record from SAP and displays it on the screen. A real-life process typically consists of additional steps, such as assigning customer priority, applying special promotions and such, but we will focus on the first step.

The implemented solution consists of two parts:

  • A Business Process Definition (BPD) called "Customer Pre-approval" in Process Designer. This process contains the Customer Lookup AIS.
  • A Business Process Execution Language (BPEL) based flow in Integration Designer that implements the AIS. This process invokes the SAP Enterprise Service that we set up in the Preparing the SAP environment section.

Create the business process

  1. Log on to the Process Designer and create a process application called "Customer Pre-approval PA" with an abbreviation of "CUSTSAP". Create a new Business Process Definition (BPD) under the Processes library called "Customer Pre-approval". Create the process flow as shown in Figure 10. The flow contains two steps:
    1. Enter Customer HT human activity
    2. Assign Customer Priority GS service.

    You will implement the Enter Customer activity as a Human Service in this demonstration.

    Fig 10. Customer Pre-approval process diagram
    Customer Pre-approval process diagram
  2. Create the business objects to be used in the flow. For our example, you will create just one business object called "Customer". In real life, the complete process in real-life may contain more data objects. Click the + sign next to Data to create the Customer data object. The data object contains the following structure:
    • customerID
    • customerName
    • description
    • industry
    • category
    • tier
    • salesOrganization
    • address
    • contactInfo
  3. Create a new Private variable in the process under the Variables tab called customer of type "Customer".
  4. Create a new Human Interface called "Enter Customer HS" by clicking the New button in the Implementation tab of the Enter Customer activity. Create an input and output variable with the same name called "customer" of data type Customer. This is passed into the human service from the Customer Pre-approval BPD.
  5. Drag and drop a Coach object in the canvas and create the coach with the following layout using the customer variable. Except for the Customer ID field, make all other fields read only. Add three buttons called Customer Lookup, Submit, and Cancel (see Figure 11). For brevity, we will provide the steps needed to create the coach layout. See the attached CustomerPreapproval.zip file for the implemented solution.
    Figure 11. Coach layout for Customer Entry
    Coach layout for Customer Entry

Now create an AIS to perform the customer lookup:

  1. Create an Advanced Integration Service under Implementation with a name of "Customer Lookup AIS". The AIS accepts customerId (of type String) as the input variable.
  2. Create an output variable called customer of type "Customer". The AIS returns the customer details in this object. Create a fault variable called "invokeFault of type String" to capture any exception messages returned from SAP. In real life, the fault object will perhaps be a structure containing a more complete fault message structure. Save the AIS.
  3. Back in the Process tab of the Enter Customer HS service, select Customer Lookup AIS from Implementation and drag it into the canvas. Wire the Customer Entry Coach to the Customer Lookup AIS with the Lookup Customer button as the boundary event. Under Data Mapping, assign tw.loca.customer.customerID as the input variable map and tw.local.customer as the output variable map. The flow looks like Figure 12.
    Figure 12. Customer HS service flow
    Customer HS service flow
  4. To complete the flow, go back to the Customer Pre-approval process and assign a customer variable as the output variable. The Enter Customer human service returns the complete customer data object to the process.

Implement the Advanced Integration Service

The following steps assume that your Integration Designer environment is already connected to your Process Center:

  1. Launch Integration Designer and accept the default workspace (or you may change to your preferred workspace).
  2. If it challenges you to enter the Process Center URL and user ID and password, enter the relevant values for your environment to connect to your Process Center.
  3. Switch to Process Center perspective. In the Process Center view, under Process Applications, locate the Customer Pre-approval PA (CUSTSAP) created earlier and click Open in the workspace.
  4. Integration Designer automatically generates the AIS related artifacts. The AIS, implementation module, and the associated library are created under the Customer Pre-approval PA Main container project.
  5. The Customer Lookup AIS shows up as "Unimplemented". Right-click on it and choose Implement. Choose Microflow as the type and enter CustomerLookup_BP as the name.

The process is now created in the Assembly diagram as shown in Figure 13.

Figure 13. Customer Lookup assembly diagram
Customer Lookup assembly diagram

To invoke the SAP Enterprise Service for the customer master, import the SAP WSDL generated in Export the WSDL and perform a quick test for the Customer Pre-approval project.

Note: As of BPM V8.x, there is a known issue when importing the SAP-generated WSDL due to the WSDL missing the soapAction attribute for the SOAP 1.2 binding.

This has to be manually fixed after importing the WSDL as explained below.

  1. In Integration Designer, right-click the Customer Pre-approval PA Main project, click Import, choose WSDL and XSD as the type, select Customer_Pre-approval_PA_Implementation as the target module, and import the ECC_CUSTBASICDATABYIDQR_V2.wsdl from your desktop (check the Import dependent resources box). The interfaces and business objects for invoking this enterprise service are generated automatically.
  2. Integration Designer flags the following error under the Problems tab: "WSDL: The soapAction attribute is missing. It is required when soapActionRequired is set to or defaults to true".

    To fix this error, right-click on the error and select Quick Fix. In the Quick Fix window, select the first fix, Add the missing value for SOAPAction attribute, as shown in Figure 14 and click Finish.

    Figure 14. SOAPAction attribute fix
    SOAPAction attribute fix

The error under the Problems tab should now disappear.

Create the BPEL flow

Proceed to implement the BPEL flow to retrieve the customer details from SAP.

  1. In the project's Assembly diagram, create an import with the WS binding with SOAP 1.1 version and assign the interface generated from SAP WSDL named "CustomerERPBasicDataByIDQueryResponse_In_V2". Set the import name as SAP_EntSvc_IMP_WS.
  2. Wire the CustomerLookup_BP module to the import. It automatically creates a reference to the import (Figure 15).
    Figure 15. Import component for SAP enterprise service
    Import component for SAP enterprise service
  3. Right-click CustomerLookup_BP and click the Generate implementation to generate a skeleton BPEL implementation. In the BPEL editor, create a flow that looks like Figure 16.
    Figure 16. CustomerLookup_BP flow
    CustomerLookup_BP flow
  4. The following steps create the flow:
    1. A Receive step with the AIS interface is automatically generated. Assign a variable to receive the input by clicking New. Accept the default variable name of "customerID".
    2. Create two new variables called customerSAP of type CustERPBscDataByIDQuMsg_s_V2 and customerSAPResult of type CustERPBasDataByIDRpMsg_s_V2 (both these types are generated from the SAP WSDL).
    3. Drag and drop a Java snippet that writes an informational message in the log. Code the snippet in the visual editor as shown in Listing 1.
      Listing 1. Snippet to write entry log
      System.out.println(">>>> Entering Customer Look up process with customer id " + customerID);
    4. Drag and drop a Data map that maps input message from the business process to the SAP object. Choose the XML map as the type and MapX_Customer_CustomerSAP as the name. Assign customerID as the input variable and customerSAP as the output variable.
    5. The Business object map editor opens. Map the fields as shown in Figure 17. Map the customer ID to LowerBoundaryCustomerID and assign 1 to IntervalBoundaryTypeCode. Click Save and close it.
      Figure 17. Customer to CustomerSAP mapping
      Customer to CustomerSAP mapping
    6. Create an invoke step below the Data map that invokes the SAP Enterprise Service operation, CustomerERPBasicDataByIDQueryResponse_In_V2. This is a synchronous invoke and gets the Customer details as a response from SAP. Assign the customerSAP variable as input and customerSAPResult variable as output to the invoke step.
    7. Drop another Java snippet below the invoke step that writes a message in the log related to the returned result. Code the snippet as shown in Listing 2.
      Listing 2. Snippet to write an SAP invoke result
          String customerID = "";
      	String searchTerm = "";
      	ListIterator list =             customerSAPResult.getList("Customer").listIterator();
      	if (list.hasNext()) {
      		DataObject customer = (DataObject) list.next();
      		customerID = customer.getString("ID");
      		searchTerm = customer.getDataObject("Common").getString("KeyWordsText");
      		}
      	System.out.println("<<<< Customer lookup returned customer ID " +  
      		customerID + ", " + searchTerm);
    8. Create another business object map called "Map_CustomerSAP_Customer" that maps the SAP's returned object to the Customer object. Map the customer and address fields from the SAP object to the customer process object as shown in Figure 18. This is a simple one-to-one move style map.
    9. The Reply step returns the mapped SAP result to the calling Customer Pre-approval business process.
      Figure 18. Map SAP Result to Customer object
      Map SAP Result to Customer object
    10. This completes the BPEL flow. Save and close the editor. There should not be any errors listed under the Problems tab. If there are errors listed, review the steps to make sure the errors are resolved.

Enable authentication

The last step is to enable the user name based authentication to the invocation and to authenticate BPM client to SAP. As you recall from the Create binding section, we enabled HTTP basic authentication.

  1. Log on to WebSphere Admin console as an administrative user. Under Services > Policy sets, click the Application policy to open it. Click New to create a new policy set.
  2. Enter the name as BPMHTTPOnlyBasicAuth as shown in Figure 19. Optionally, enter a description. Click the Add button and select HTTP Transport to add it. Click Save to save the policy.
    Figure 19. Policy set for HTTP transport
    Policy set for HTTP transport
  3. Next, you need to create a client binding using this policy to assign the user name and password. Click General client policy set bindings under Services > Policy sets to open it.
  4. Click New to create a new client binding. Enter the Binding configuration name as SAPRSABasicAuthBinding and optionally enter a description. Click Add and select HTTP Transport (see Figure 20).
  5. In the HTTP transport screen, under Basic authentication for outbound transport requests section, enter your SAP user name and password.
  6. Click OK then Save to save your changes.
    Figure 20. Client policy set binding
    Client policy set binding

Export the new client policy binding as a zip file so that it can be imported into Integration Designer.

  1. Click Services > Policy sets > Application policy sets to open it. Click the checkbox next to the BPMHTTPOnlyBasicAuth policy set that you created and click Export.
  2. The console generates a zip file called "BPMSAPBasicAuth.zip". Click to download the zip file to your workstation.
  3. Click Services > Policy sets > General client policy bindings to open it. Click the checkbox to select the new SAPRSABasicAuthBinding binding and click Export.
  4. The console generates a zip file called "BPMSAP Client.zip". Click to download it into your workstation.
  5. Log off from the console.

Assign the new policy set and binding to the SAP Import component in the Integration Designer Assembly diagram for the project.

  1. Right-click on the Customer Pre-approval PA Library and select Import. Select Web services > WebSphere Policy Sets as the import source wizard.
  2. Locate and select the BPMHTTPOnlyBasicAuth.zip that you exported in the previous step and click Finish.
  3. To import the client binding, right-click on the Customer Pre-approval PA Library and select Import. Select Web services > WebSphere General Bindings as the import source wizard and import BPMRSABasicAuthBinding.zip binding zip file.
  4. Open the Customer Pre-approval Assembly diagram and click on the SAP_EntSvc_IMP_WS import component to select it.
  5. Under the Properties tab, click on the Policy Sets tab under Binding. In the Default policy set selection list, the "BPMHTTPOnlyBasicAuth" policy now appears as a selection (see Figure 21). Select it to assign it.
  6. In the Binding selection list, the "BPMRSABasicAuthBinding" binding appears. Select it to assign it.
    Figure 21. Assign policy set and client binding to SAP Import
    Assign policy set and client binding to SAP Import
  7. Save the changes.

The last step is to publish the new module to Process Center. Right-click the Customer Pre-approval Process project and click Refresh and Publish. The "changed" status disappears and the module status should say "Synchronized". This completes the build for the SCA component of the solution.

To summarize, we created a simple Business Process Definition called "Customer Pre-approval Process" that accepts the customer ID as input from the business user in a Coach, and looks up customer detail from the SAP system. The look up is done using an Advanced Integration Service, which is implemented as a BPEL that invokes the SAP Enterprise Service to retrieve customer details from SAP. The returned result is mapped back to the BPM business object and displayed in the Coach. Security is implemented using the HTTP basic authentication mechanism.


Testing the flow

You can test the flow by using the playback function of Process Designer. Alternatively, the business process can be exposed to and run from the Portal.

  1. Log on back the Process Designer and open the Customer Pre-approval process in Designer. Click the Playback button.
  2. In the Customer Pre-approval Coach, enter a valid Customer ID that exists in the SAP system that you are connected to. In this example, we entered "3556" as the customer ID.
  3. Click the Customer Lookup button. The Customer Lookup AIS invokes the Customer Pre-approval SCA component, which invokes SAP over the web services interface, using HTTP basic authentication to authenticate with SAP with a user ID and password. Customer details are retrieved from SAP for the entered customer and displayed in the Coach.
    Figure 22. Customer Entry Coach displaying results
    Customer Entry Coach displaying results
  4. Open Integration Designer and click the Console tab. If the Console tab does not show, click Window > Show View > Console to display it. The server logs display the messages that you entered in the Java snippets in the BPEL flow.

Conclusion

This article demonstrated the ease of consuming SAP Enterprise Services from IBM Business Process Manager over the standard SOAP protocol. It described the steps to prepare the SAP system to accept enterprise service requests, create a business process that included an integration service to call the SAP enterprise service to look up business data, and implement a basic security mechanism to implement the integration securely.


Download

DescriptionNameSize
Code samplecode_samples.zip1066KB

Resources

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into Business process management on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Business process management
ArticleID=956808
ArticleTitle=Accessing SAP processes from IBM Business Process Manager using Enterprise Services
publish-date=12112013