Skip Headers
Oracle® Application Server Adapter for SAP R/3 User's Guide
10g Release 2 (10.1.2)
B14061-02
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

5 BPEL Process Manager Integration Examples

This chapter contains the following examples:

The event and service scenarios demonstrated in this chapter require the following prerequisites and configuration steps:

Prerequisites


See Also:

Oracle Application Server Adapters Installation Guide

Configuration Steps

The examples present all the configuration steps necessary for demonstrating service and event integration with SAP. See the following for more information:

  1. Configure SAP for outbound processing. See Appendix A, "Configuring SAP for Inbound and Outbound Processing" for more information.

  2. Create a J2CA configuration, as BPEL PM is only compatible with the J2CA Connector. See "Creating a Configuration for J2CA" for more information.

  3. Configure OracleAS Adapter for SAP for services and events. See Chapter 2, "Configuring OracleAS Adapter for SAP" for more information.

SAP Event Integration

This topic illustrates how OracleAS Adapter for SAP integrates with SAP to receive event data. The procedures describe design time and runtime. The example demonstrates how OracleAS Adapter for SAP integrates with SAP to receive event data. In this example, an SAP event occurs when a customer record is added to an SAP system.

The design time and runtime procedures are outlined in the following sections.

Design Time

Creating a Channel

You must create a separate channel for every inbound J2CA service and select that channel when you generate WSDL for inbound interaction using Application Explorer.


Note:

If more than one inbound service share the same channel, event messages will not be delivered to the right BPEL process.

To create a channel:

  1. Start Application Explorer and connect to a J2CA configuration.

  2. In the left pane, expand the Events node.

  3. Expand the SAP node.

    The Ports and Channels nodes appear in the left pane.

    add channel
    Description of the illustration addchannel.gif

  4. Right-click Channels and select Add Channel.

    The Add Channel dialog box is displayed.

    Add Channel dialog box
    Description of the illustration addchanneldialog.gif

    Perform the following steps:

    1. Enter a name for the channel, for example, SAP_Channel.

    2. Enter a brief description (optional).

    3. From the Protocol list, select SAP Channel--App Server.

  5. Click Next.

    The Application Server dialog box is displayed.

    Application Server dialog box
    Description of the illustration channelsystemtab.gif

    The following tabs are available:

    • System (Required)

    • User (Required)

    • Advanced

  6. In the System tab, enter the appropriate information for your SAP channel, based on the information in the following table.

    Table 5-1 System Tab Parameters

    Target Parameter Description

    Gateway host

    A host name for the SAP Gateway.

    Gateway service

    A service for the SAP Gateway.

    Program ID of the server

    An SAP program ID you want to use for this channel.

    Application Server

    A host name for the application server.

    System number

    A system number for SAP.


  7. Click the User tab.

    user tab
    Description of the illustration channelusertab.gif

  8. For the User tab, enter the appropriate information for your SAP channel, based on the information in the following table.

    Table 5-2 User Tab Parameters

    Target Parameter Description

    Client

    The client number defined for the SAP application for client communications.

    User

    A valid user ID for the SAP application.

    Password

    A valid password for the SAP application.

    Language

    A language key. EN (English) is the default.

    Code page

    A character code page value.


  9. For the Advanced tab (optional), enter the appropriate information for your SAP channel, based on the information in the following table.

    Table 5-3 Advanced Tab Parameters

    Target Parameter Description

    IDoc Format

    Select an IDoc enter from the list.

    User Defined Function Modules

    Enter the path to the user-defined function module you created.

    SAP trace

    Select this check box if you want to enable SAP traces for troubleshooting purposes.

    Unicode

    Select this check box if you are expecting your response in Unicode format.

    Synchronous Processing

    Select the type of synchronous processing from the list.


  10. Click OK.

    The channel appears under the channels node in the left pane. An X over the icon indicates that the channel is currently disconnected.


    Note:

    Do not start the channel, as it is managed by BPEL PM Server. If you start the channel for testing and debugging purposes, stop it before runtime.

Creating an Event

After you create a channel and verify that it is not started, you must create an event using Application Explorer.

To establish a connection to the SAP system and locate DEBMAS05:

  1. Start Application Explorer.

  2. Expand the Adapters node.

    A list of all adapters is displayed.

    Expanded adapter list
    Description of the illustration adapterexpandedpartial.gif

    Perform the following steps:

    1. Expand the SAP node.

      A list of your available targets is displayed.

      Disconnected SAPTarget node
      Description of the illustration connect1.gif

    2. Click a target name under the SAP node, for example, SAPTarget..

    The Connection dialog box displays the saved parameters.

  3. Verify your connection parameters.

  4. Provide the required password.

  5. Right-click the target name and select Connect.

    The x icon disappears, indicating that the node is connected.

    Connected SAP target
    Description of the illustration saptarget2.gif

  6. Expand the ALE(IDOCS) node and select DEBMAS.

    The DEBMAS list is displayed.

    Select DEBMAS05
    Description of the illustration selectdebmas.gif

  7. Right-click DEBMAS05 from the DEBMAS list.

    DEBMAS05 window
    Description of the illustration bpel_38.gif

  8. Select Create Inbound JCA Service (Event).

    The Export WSDL dialog box is displayed.

    Export WSDL dialog box
    Description of the illustration bpel_39.gif

    Perform the following steps:

    1. In the WSDL File Name field, specify a name and location of the WSDL file.

    2. In the Channel field, select the channel you created for this inbound service.


    Note:

    You must create a separate channel for every inbound service. Verify that the channel is stopped before runtime.

  9. Click OK.

Creating a BPEL PM Server Connection

Before you design an inbound BPEL process, you must create a connection to your BPEL Server using JDeveloper. To create a server connection:

  1. Open JDeveloper.

  2. To display the connections, click the Connections tab at the bottom of the upper left pane in JDeveloper.

    The following menu is displayed.

    Create BPEL PM connection
    Description of the illustration bpel_30.gif

  3. Right-click BPEL Process Manager Server and select New BPEL Process Manager Connection.

    The Create BPEL Process Manager Connection - Welcome dialog box is displayed.

    Welcome screen
    Description of the illustration bpel_31.gif

  4. Click Next.

    The Create BPEL Process Manager Connection dialog box is displayed.

    Server Connection Wizard
    Description of the illustration bpel_32.gif

  5. Specify a unique name for your BPEL Server connection and click Next.

  6. Specify a valid host name and port number for the BPEL PM Server you wish to connect to.

  7. Click Finish.

    Your newly created server connection is displayed in the Connections tab under the BPEL Process Manager Server node.

    Process Manager Server node
    Description of the illustration bpel_34.gif

Designing the BPEL Process for the SAP_DEBMAS05 Inbound Service

To design a BPEL process for inbound interaction:

  1. Click the Applications tab and select a workspace for your project.

    Applications tab
    Description of the illustration bpel_35.gif

  2. Right-click the workspace and select New Project.

    The New Gallery window is displayed.

    New Gallery window
    Description of the illustration bpel_1.gif

  3. From the Items list, select BPEL Process Project and click OK.

    The BPEL Process Project dialog box is displayed.

    BPEL Process dialog box
    Description of the illustration bpel_22a.gif

  4. Perform the following steps:

    1. Specify a name for the process.

      The Namespace field is updated automatically.

    2. From the Template drop-down list, select Empty BPEL Process.

    3. Click OK.

  5. From the Process Activities pane on the right, drag and drop a PartnerLink to the visual editor.

    The Create Partner Link dialog box is displayed.

    Create Partner Link window
    Description of the illustration bpel_4.gif

  6. Click the WSIL browser icon (second icon from the left the WSDL File field).

    The WSDL Chooser dialog box is displayed.

    WSDL Chooser window
    Description of the illustration bpel_5.gif

  7. Expand your BPEL Server connection, then expand adapters, and then applications.

    The WSDL Chooser dialog box is displayed.

    WSDL tree
    Description of the illustration bpel_6.gif

  8. Select DEBMAS05_receive.wsdl and click OK.

    The Create Partner Link dialog box is displayed.

    Create Partner Link dialog box
    Description of the illustration bpel_24a.gif

    The WSDL File field displays the name and location of the selected WSDL file. The Partner Link Type field specifies the PartnerLink defined in the WSDL file.

    Perform the following steps:

    1. From the My Role drop-down list, select the default value DEBMAS05Role.

    2. Leave the Partner Role field unspecified.

  9. Click Apply, and then OK.

    The new SAP PartnerLink appears in the visual editor.

    JDeveloper visual editor
    Description of the illustration bpel_25a.gif

  10. From the Process Activities pane on the right, drag a Receive activity to the visual editor and place it in the designated placeholder labeled Drop Activity Here.

  11. Connect the Receive activity to the SAP PartnerLink.

    The Edit Receive dialog box is displayed.

    Edit Receive dialog box
    Description of the illustration bpel_26a.gif

    Perform the following steps:

    1. Specify a name for the Receive Activity, for example, Receive_DEBMSAS05.

    2. Click the first icon to the right of the Variable field, then click OK in the Create Variable dialog box that is displayed.

    3. Verify that the Create Instance check box is selected.

  12. Click Apply.

    The Receive dialog box should no longer display any warnings or errors.

  13. Click OK.

  14. Select Save from the File menu.

Deploying the BPEL Process for the SAP_DEBMAS05 Inbound Service

  1. Right-click your process flow in the Applications - Navigator pane.

  2. Select Deploy > Your BPEL PM Server connection > Deploy to default domain.

  3. When prompted, enter your BPEL Process Manager password and click OK.

    The deployment process starts automatically after you enter the correct password.

Runtime

Triggering an Event in SAP

The following topic describes how to trigger an event in SAP to verify event integration using OracleAS Adapter for SAP.

To trigger an event in SAP:

  1. Start the SAP Workbench and log in to the SAP system.

    SAP Workbench
    Description of the illustration image032.gif

  2. Execute the bd12 transaction.

    Send Customers
    Description of the illustration image034.gif

    Enter the following information in the Send Customers window:

    1. In the Customer field, enter a customer number with a range from 1 to 3.

    2. In the Output type field, enter DEBMAS.

    3. In the Logical system field, specify the logical system you are using with SAP.

  3. Click the check mark icon in the upper left-hand corner.

    Message Type
    Description of the illustration image036.gif

  4. Ensure DEBMAS appears in the Message type column.

  5. Click the Execute button.

    Customer master data is sent to the logical system specified. If a channel in Application Explorer defined the Program ID with the same value, the channel receives this customer master data from SAP.

Verifying the Results

To verify your results:

  1. Log in to Oracle BPEL Console at

    http://host:port/BPELConsole 
    
    
  2. Enter the password for your BPEL domain.

    The default password is bpel.

  3. Click the Instances tab.

    Recently received runtime events are displayed in the Instances tab.

    Instances tab
    Description of the illustration bpel_36.gif

  4. Click the SAP_DEBMAS05 instance, then click Audit to see the received SAP_DEBMAS05 event message.

    Audit tab
    Description of the illustration bpel_37.gif

SAP Service Integration

This topic illustrates SAP service integration. The procedures describe design time and runtime.

Design Time

Creating a Request-Response J2CA Service in Application Explorer

Before you design a process for SAP service integration, you must generate its respective WSDL file using Application Explorer.

To generate WSDL in Application Explorer:

  1. Start Application Explorer and connect to a defined SAP target or create a new target.

    See Connecting to SAP for more information.

  2. Expand the SAP target to which you are connected.

  3. Expand Remote Function Modules > Financial Accounting > 0002 -- Company Code Business Object > BAPI_COMPANYCODE_GETDETAIL.

    The following image shows a connected and expanded target.

    Application Explorer
    Description of the illustration app_exp_conn_target.gif

  4. Right-click the BAPI_COMPANYCODE_GETDETAIL node.

    The following menu is displayed:

    BAPI_COMPANYCODE_GETDETAIL node
    Description of the illustration bpel_40.gif

  5. Click Create Outbound JCA Service (Request/Response).

    The Export WSDL dialog box is displayed.

    Export WSDL dialog box
    Description of the illustration bpel_41.gif

  6. Click OK.

You are ready to design a BPEL process in JDeveloper.

Creating a BPEL PM Server Connection

Before you design an outbound BPEL process, you must create a connection to your BPEL Server using JDeveloper. See Creating a BPEL PM Server Connection for details on how to create the connection.

Creating a BPEL Project for a Synchronous BPEL Process

To create a BPEL Project for a synchronous BPEL process:

  1. At the bottom of the upper left pane, click the Applications tab and select a workspace for your project.

    JDeveloper Applications tab
    Description of the illustration bpel_35.gif

  2. Right-click the workspace and select New Project.

    The New Gallery window is displayed.

    New Gallery window
    Description of the illustration bpel_1.gif

  3. From the Items list, select BPEL Process Project and click OK.

    The BPEL Process Project dialog box is displayed.

    Process Project dialog box
    Description of the illustration bpel_2a.gif

  4. Perform the following steps:

    1. Specify a name for the BPEL process, for example, SAP_GetCCDetail.

      The Namespace field is updated automatically.

    2. From the Template drop-down list, select Synchronous BPEL Process.

  5. Click OK.

Designing the BPEL Process for the BAPI_COMPANYCODE_GETDETAIL Outbound Service

To design the BPEL Process:

  1. From the Process Activities pane on the right, drag and drop a PartnerLink to the visual editor.

    The Create Partner Link dialog box is displayed.

    Create Partner Link window
    Description of the illustration bpel_4.gif

  2. Click the WSIL browser icon (second icon from the left the WSDL File field).

    The WSDL Chooser dialog box is displayed.

    WSDL Chooser window
    Description of the illustration bpel_5.gif

  3. Expand your new server connection, then expand adapters, and then applications.

    The WSDL Chooser dialog box is displayed.

    WSDL tree
    Description of the illustration bpel_6.gif

  4. Select BAPI_COMPANYCODE_GETDETAIL_invoke.wsdl and click OK.

    The WSDL File field in the Create Partner Link dialog box displays the name and location of the selected WSDL file. The Partner Link Type field specifies the PartnerLink defined in the WSDL file.

    Create Partner Link
    Description of the illustration bpel_7.gif

    Perform the following steps:

    1. Leave the My Role field unspecified. The role of the PartnerLink is null, as it will be synchronously invoked from the BPEL process.

    2. From the Partner Role drop-down list, select the default value BAPI_COMPANYCODE_GETDETAILRole. This is the role of the BPEL process.

  5. Click OK.

    The new PartnerLink appears in the visual editor.

  6. Select Save from the File menu.

  7. From the Process Activities pane on the right, drag an Invoke activity to the visual editor and place it between the Receive activity (receiveInput) and the Reply activity (replyOutput).

    The Invoke process activity is shown in the diagram view.

    JDeveloper -diagram
    Description of the illustration bpel_42.gif

  8. Drag the blue arrow from Invoke_1 and connect it to the SAP PartnerLink.

    The Edit Invoke dialog box is displayed.

    Edit Invoke dialog box
    Description of the illustration bpel_43.gif

    Perform the following steps:

    1. In the Name field, enter Get_CCDetail.

    2. Click the first icon to the right of the Input Variable field, then click OK in the Create Variable window that is displayed.

    3. Repeat the previous step to create a default variable for Output Variable.

  9. Click OK.

  10. Drag an Assign process activity and drop it between receiveInput and Get_CCDetail.

    The following image shows the new Assign activity in JDeveloper visual editor.

    JDeveloper diagram view
    Description of the illustration bpel_44.gif

  11. Double-click the Assign activity icon.

    The Assign dialog box is displayed.

    Assign dialog box
    Description of the illustration bpel_14.gif

  12. In the Copy Rules tab, click Create.

    The Create Copy Rule dialog box is displayed.

    1. In the From pane, expand Variables, then inputVariable, and then highlight payload.

    2. In the To pane, expand Variables, then GetCompanyDetail_BAPI_COMPANYCODE_GETDETAIL_InputVariable, and then highlight input_BAPI_COMPANYCODE_GETDETAIL.

    Your Create Copy Rule dialog box should look as follows:

    Create Copy Rule dialog box
    Description of the illustration bpel_10a.gif

  13. To close the Create Copy Rule dialog box and the Assign dialog box, click OK.

  14. From the Process Activities pane on the right, drag another Assign activity to the visual editor and place it between the Invoke activity (SAP_GetCCDetail) and the Reply activity (replyOutput).

  15. Double-click the Assign activity icon and click Create.

  16. Map Get_CCDetail_BAPI_COMPANYCODE_GETDETAIL_OutputVariable > output_BAPI_COPMANYCODE_GETDETAIL to outputVariable > payload.

    Verify that you have mapped all variables as follows:

    Create Copy Rule dialog box
    Description of the illustration bpel_10b.gif

  17. Click OK, then click OK again.

  18. Select Save from the File menu.

You have completed the design of your BPEL process.

Deploying the BPEL Process for the BAPI_COMPANYCODE_GETDETAIL Outbound Service

JDeveloper deploys the outbound BPEL process for BAPI_COMPANYCODE_GETDETAIL directly to Oracle BPEL Console.

To deploy your BPEL process in JDeveloper:

  1. Right-click your process flow in the Applications - Navigator pane.

  2. Select Deploy > Your BPEL PM Server connection > Deploy to default domain.

    The Password Prompt dialog box is displayed.

  3. Enter your BPEL Process Manager password in the Password Prompt dialog box.

    The deployment process starts automatically after you enter the correct password.

  4. Observe the Messages log on the bottom of the window.

    The Messages log displays the deployment status. In this example, it shows a successful deployment message for the process.

    Messages log
    Description of the illustration bpel_45.gif

    If deployment was not successful, click the Compiler tab to view all error and warning messages generated during the deployment process.

Runtime

To invoke the BAPI_COMPANYCODE_GETDETAIL process from Oracle BPEL Console:

  1. Start the Oracle BPEL Console by entering the following URL in a browser:

    http://host:port/BPELConsole
    
    
  2. Select a domain and provide a valid password.

    The Oracle BPEL Console main page is displayed.

  3. Click the BPEL Processes tab.

  4. Click the SAP process link, BAPI_COMPANYCODE_GETDETAIL.

  5. Click Initiate.

    The Initiate tab enables you to test your BPEL process.

    Oracle BPEL Console Initiate window
    Description of the illustration bpel_20.gif

    Perform the following steps:

    1. From the Initiating a test instance drop-down menu, select XML Source.

    2. Enter the following code in the text area provided for XML input:

      <?xml version="1.0" encoding="UTF-8"?>
      <CompanyCode.GetDetail SERVICENAME="CompanyCodeGetDetail" METHODNAME="BAPI_COMPANYCODE_GETDETAIL" LICENSE="test" CompanyCodeId="1000"/>
      
      
  6. Click Post XML Message.

    The response received from the SAP system is displayed in the Initiate window.