11    Applying Advanced SAP BPM Concepts and Extensions

I do the very best I know how, the very best I can, and I mean to keep on doing so until the end.
                                                                                              —Abraham Lincoln

In the previous chapter, we explored different aspects of implementing an SAP Business Process Management (SAP BPM) process: modeling, configuring, compiling, and deploying. Now that the process has been deployed in the SAP Process Orchestration (SAP PO) server, you might be tempted to think that we can proceed with running and testing the process. That’s not entirely the case!

At this point, you know how to build SAP BPM processes from the ground up and deploy them to SAP NetWeaver AS Java, so we’ll move on to the next step and explore how to configure the deployed processes using the service-oriented architecture (SOA) configuration functionality available in SAP NetWeaver Administrator. The SOA configuration will enable you to indicate the actual endpoint of the services to be consumed by your SAP BPM process.

Notions of SAP BPM custom Enterprise Java Bean (EJB) functions and aspects covering the testing and debugging of a running process will also be explored in this chapter, and we’ll look at advanced concepts, such as how to consume and leverage SAP BPM internal functionalities from an external application using the provided SAP BPM application programming interface (API) and OData. The chapter also provides some recommendations and best practices to take into consideration during the process of designing and implementing a process using SAP BPM.

11.1    Service-Oriented Architecture Configuration

Depending on the flow objects used in the Business Process Model and Notation (BPMN) model of the process, you may need to perform some extra configuration steps. These extra configurations are mostly needed for flow objects that facilitate the exchange of messages (send or receive) with other systems, such as the Advanced Adapter Engine Extended (AEX). The flow objects in question include the following:

We’ll explore the different configuration settings for each one of these flow objects in the following sections.

11.1.1    Configuration for an Automated Activity

During design time, you need to configure a service reference in the settings of the automated activity. A service reference is created for the outbound service interface that has been assigned to the automated activity. At this point, there are no references to the actual endpoint of the service.

The service reference can then be configured at runtime to point to the desired system, providing the service or the service endpoint. This is especially useful because the same SAP BPM process will need to be transported through the landscape: development, test, acceptance, and production. The endpoint that the SAP BPM process will need to call for those different environments won’t be the same. Therefore, you need to reconfigure this setting at runtime to point to the relevant environment-specific endpoint.

As Figure 11.1 depicts, SAP BPM can use web services (WS), XI 3.0 message protocol, or Remote Function Calls (RFCs) to communicate with other systems. Different configuration approaches apply depending on whether the service reference used for the automated activity uses RFC, XI 3.0, or the WS as message protocol. The next sections will explore those approaches.

Communication Options between SAP BPM and Other Systems

Figure 11.1    Communication Options between SAP BPM and Other Systems

Configuration for Web Services

If the service reference setting of the automated activity is set to WS (Figure 11.2), this implies that the service will be consumed as a web service. The WS message protocol is used in the following scenarios:

Setting the SAP BPM Service Reference to Call the Appropriate Service as WS

Figure 11.2    Setting the SAP BPM Service Reference to Call the Appropriate Service as WS

Sender Communication Channel Settings When SAP BPM Communicates with the AEX via WS

Figure 11.3    Sender Communication Channel Settings When SAP BPM Communicates with the AEX via WS

To configure the service reference, follow these steps:

  1. After the SAP BPM process has been deployed, log in to SAP NetWeaver Administrator.
  2. Navigate to the SOA tab and then to Application and Scenario Communication.
  3. Click on the Application Communication link (Figure 11.4). Alternatively, go to http://<hostname>:<port>/nwa/appcommunication. From this page, you can configure the inbound and outbound communication of an SAP BPM development component (DC).
  4. You’re redirected to another screen, which contains a list of all applications or DCs. From the list, select the name of your DC.
    Application and Scenario Communication in the SOA Tab of SAP NetWeaver Administrator

    Figure 11.4    Application and Scenario Communication in the SOA Tab of SAP NetWeaver Administrator

  5. A screen is populated at the bottom with two tabs:
    • Consumed Service Groups
      This tab includes all the services that SAP BPM consumes. All service interfaces used in an automated activity will be configurable from this page.
    • Provided Services
      This tab includes the list of services that the process provides. This includes the message triggers used for start events and intermediary events.

Because we’re interested in configuring the services that the process calls or consumes, select the Consumed Service Groups tab.

Figure 11.5 shows an example of what a process looks like that has been newly deployed and not yet configured. The figure shows that the service group called SG_CurrencyWS has the WS connectivity type and the provider system pointing to the local system. Furthermore, the processing state is currently red (Failed).

Status of Nonconfigured Service Group for Process DC

Figure 11.5    Status of Nonconfigured Service Group for Process DC

Your next steps will be as follows:

  1. Click on the Edit button in the Consumed Service Groups tab.
  2. Select the service group that you want to configure, and open the Provider System column dropdown menu.
  3. If the correct system provider already exists, then you can select it from the dropdown. In this case, you need to create a new one, so select the <create...> option (Figure 11.6).
    Editing the Service Group and Choosing to Create a New Provider System

    Figure 11.6    Editing the Service Group and Choosing to Create a New Provider System

  4. You’re forwarded to a new screen to create a new provider system. Fill in the details by providing a meaningful name and a description. Don’t forget to choose Other as the System Type. Then, click on Next (Figure 11.7 1).
  5. On the next screen, fill in the URL of the Web Service Description Language (WSDL) of the web service to be called 2. Provide a user name and password if the service requires authentication. Click on Next to move to the next screen.
    First Steps of Creating a New Provider System

    Figure 11.7    First Steps of Creating a New Provider System

  6. On the next screen, the web service is automatically tested using the WSDL and authentication details that you provided. If all goes well, you’ll see a message indicating success. If it fails, then you’ll need to go back to the previous steps and make the required corrections.
  7. Click on Finish. You’re forwarded back to the original screen. Make sure that the newly created provider system is selected (Figure 11.8).
  8. Click on the Save button to store your configuration.
  9. Click on the Refresh button on the right side of the screen to get the updated status of the service group with the new provider system. You should now see an Error, Warning, or Successful status. In our example, the configuration ended in a warning (in yellow), as shown in Figure 11.8.
Pointing the Service Group to the Newly Created Provider System

Figure 11.8    Pointing the Service Group to the Newly Created Provider System

Congratulations! You’ve successfully configured the service group to point to the runtime web service.

Note that this ability to configure different endpoints after deployment is a very useful feature that provides flexibility. If the service provider moves or changes its URL, you only need to reconfigure the service provider, and then you’re ready to go. You don’t need to change or redeploy the SAP BPM DC.

Note

If you get an error or warning in the service group, you can see more details about the problem by clicking on the Show Log button (Figure 11.8). A new screen will pop up with log details from the SAP NetWeaver Log Viewer.

If your Services Registry is configured with your SAP PO installation, then you can let the system automatically discover the provider system by clicking on the Auto Assign button. The system automatically looks up and discovers the provider system via the Service Registry. You can remove this assignment at any point by selecting the <none> option in the Provider System dropdown.

Configuration for XI 3.0

The XI 3.0 message protocol is an SAP-proprietary message protocol based on SOAP and enhanced with extra information, such as routing and monitoring. Most importantly, the XI 3.0 message protocol supports reliable messaging.

The XI 3.0 message protocol is used in the following scenarios:

If the SAP BPM process is calling the AEX, then the sender communication channel should have the Message Protocol field set to XI 3.0 (Figure 11.9).

Sender Communication Channel with XI 3.0 Message Protocol Sender

Figure 11.9    Sender Communication Channel with XI 3.0 Message Protocol Sender

When dealing with the XI 3.0 message protocol as a medium of communication between SAP BPM and the AEX, the SAP BPM process needs to be represented in AEX as a communication component of type business component. This communication component is used in the integrated configuration (ICO) for sending or receiving messages from SAP BPM. Figure 11.10 shows an ICO example that receives a call from an SAP BPM process.

ICO Using the Sender Communication Channel with an XI 3.0 Protocol

Figure 11.10    ICO Using the Sender Communication Channel with an XI 3.0 Protocol

Note that the ICO uses BC_DemoBPM as the sender communication component. This information will be handy when setting up the service group configuration in SAP NetWeaver Administrator.

In SAP NetWeaver Developer Studio, when importing the service interface and service group, you’ll need to configure the service reference, as shown in Figure 11.11.

You’ll also notice in Figure 11.11 that the Type field is set to XI and that the Sender Component field is set to BC_DemoBPM, thus matching the sender communication component used in the ICO. This is the mechanism by which SAP BPM can send the message directly to the correct ICO. If this setup is correctly performed, then there is no need to make extra configurations in SAP NetWeaver Administrator. After the SAP BPM process has been deployed to the server, it’s also possible to change the details of the sender component from within SAP NetWeaver Administrator.

Configuration of the Service Reference

Figure 11.11    Configuration of the Service Reference

To configure the service reference in SAP NetWeaver Administrator for an XI 3.0-based communication, follow these steps:

  1. After the process has been deployed, go to http://<hostname>:<port>/nwa/appcommunication. You might need to log in.
  2. You’re redirected to a screen showing a list of all applications or DCs. From the list, select the name of your DC.
  3. The bottom screen is then populated with details of the selected DC. In the Consumed Service Groups tab, select the XI-based service group (Figure 11.12 1).
  4. Click on the Edit button.
  5. You’ll see a list of service references, which is part of the service group that you selected in the previous step.
  6. Select the desired service references, and click on Show Details (Figure 11.12 2 and 3).
  7. In the screen populated at the bottom, select the Configuration tab.
  8. From the new tab, it’s then possible to select the General tab.
  9. Change the Sender Component field 4.
  10. Click on Save to store your configuration.
    Configuration of a Service Reference for an XI-Based Communication in SAP NetWeaver Administrator

    Figure 11.12    Configuration of a Service Reference for an XI-Based Communication in SAP NetWeaver Administrator

Configuration for Remote Function Call

If your BPM process will be calling an SAP function module, then you need to use the RFC protocol. This means that SAP BPM will directly call the SAP backend system. During design time (in SAP NetWeaver Developer Studio), one of the first steps will be to import the RFC function structures (input and output). During the import, you’ll need to specify the service group for the connection to the backend. The service reference associated with the service group is automatically assigned the RFC type (Figure 11.13).

Setting of the SAP BPM Service Reference to Call an RFC Function Module

Figure 11.13    Setting of the SAP BPM Service Reference to Call an RFC Function Module

After the process has been deployed to the SAP PO server, it’s time to configure the service group from SAP NetWeaver Administrator by following these steps:

  1. After the process has been deployed, log in to SAP NetWeaver Administrator.
  2. Navigate to the SOA, and then to Application and Scenario Communication.
  3. Click on the Application Communication link. Alternatively, go to http://<hostname>:<port>/nwa/appcommunication. From this page, you can configure the endpoints of the services used in an SAP BPM DC.
  4. You’re redirected to a screen showing a list of all applications or DCs. From the list, select the name of your DC.
  5. A screen is populated at the bottom with two tabs: Consumed Service Groups and Provided Services. Because you’re interested in configuring the services that the process calls, select the Consumed Service Groups tab. Configure the service reference as shown in Figure 11.14, in which you can see that the service group called SG_BAPI_USER_GET_DETAIL has the RFC connectivity type and a provider system not configured.
  6. Click on the Edit button in the Consumed Service Groups tab to configure it.
  7. Select the service group, and open the Provider System dropdown.
  8. If the correct provider system already exists, then it can be selected from the dropdown. In this case, you need to create it. Proceed by selecting the <create...> option (Figure 11.14).
    Creating a Provider System for the RFC Service Group

    Figure 11.14    Creating a Provider System for the RFC Service Group

  9. You’re forwarded to a new screen to create a new provider system. Fill in the details by providing the name (System ID) of the backend system, a Client, and a System Type. Note that System Type should always be ABAP. Click on Next to proceed with the wizard (Figure 11.15 1).
  10. On the next screen, fill in all RFC connectivity details, such as the Target Host, System Number, and login credentials (User Name and Password2.
  11. Click the Next button to proceed to the next screen of the wizard. Keep all the default values.
  12. Click the Finish button.
Steps to Configure the RFC Provider System

Figure 11.15    Steps to Configure the RFC Provider System

11.1.2    Configuration for a Start Event or Intermediary Event

Both start events and intermediary events are used by SAP BPM to receive messages from an external system. The start event receives a message and starts a new instance of a process, whereas the intermediary event receives a message in the middle of the process, when the process is idle and waiting. When a matching message is received, the process resumes.

Although used for slightly different purposes in SAP BPM, the configuration of these two flow objects are the same. They both handle messages going toward SAP BPM. These two types of inbound connectivity toward SAP BPM are automatically configured to provide both XI and WS message protocols. It’s up to the system calling the SAP BPM process to decide which one of these message protocols is more suitable to use. SAP PO automatically configures XI and WS for you, so you don’t need to perform additional configurations. However, you can configure or assign a communication profile to a connection of the WS type. A communication profile groups a set of policies that the connection between the consumer and SAP BPM needs to adhere to. In a communication profile, settings of what authentication method to use can be configured. This includes elements such as user name and password (basic), X.509 Client Certificate, SAP Logon Tickets, Security Assertion Markup Language (SAML) Assertion, and so on.

Create a Communication Profile

A communication profile can be created via the following steps:

  1. After the SAP BPM process has been deployed, log in to SAP NetWeaver Administrator.
  2. Navigate to the SOA tab, and then select the Technical Configuration subtab.
  3. On the subsequent screen, click on the System Connections link.
  4. On the following screen, select the Communication Profile tab.
  5. Click on the New button to start the wizard to create a new communication profile.
  6. Specify the name and description of your communication profile—for example, “BASIC_AUTH_LOCALHOST”. Then, click on Next to move to the next screen.
  7. Specify the desired connection type and authentication settings.
  8. Click on the Finish button.
Note

Communication profiles only apply to connections of the WS type. A service provided by an SAP BPM process with a connection type of XI can’t be configured or modified after deployment. Therefore, you can’t assign a communication profile to a configuration for a connection of type XI.

Assign a Communication Profile

As previously mentioned, a configuration of the start event or intermediary event is restricted to assigning a communication profile to the connections of the WS type. Follow these steps to assign a communication profile:

  1. After the SAP BPM process has been deployed, log in to SAP NetWeaver Administrator.
  2. Navigate to the SOA tab, and then go to Application and Scenario Communication.
  3. You’re redirected to a screen showing a list of all applications or DCs. From the list, select the name of your DC.
  4. A screen is populated at the bottom; click on the Provided Services tab.
  5. Select the service interface that the SAP BPM process provides or exposes, and click on the Edit button.
  6. Click on the Assign Profile button to select the desired communication profile.
  7. Click on the Save button to activate the change.