You must set the Transaction mode property appropriately on an SAPRequest node when you are processing by using separate message flows.
This scenario is one of two examples that illustrate the concepts that are described in SAP BAPI transaction commit; see also Scenario 1: Business partner and relationship processing in a single flow.
BAPI_SALESORDER_CREATEFROMDAT2
BAPI_SALESORDER_GETSTATUS
For example, a user queries an
order after a purchase has been made by using a Web-based application.
The result of the query is closely linked to the asynchronous or
synchronous behavior of the order creation steps carried out by the
external SAP server. In the following asynchronous example (the default behavior), the query might fail and the user receives a negative acknowledgment for the order that has been created.
BAPI Create Order message flow | ||||
---|---|---|---|---|
A1. | An application triggers the transactional message flow that creates a sales order. | |||
A2. | The SAPRequest node submits an order creation and returns the order registration number. The commit happens when the message flow completes because the node participates in a message flow level transaction. | |||
A3. | The MQReply node puts an MQ message on the output queue pending transactional commit. | |||
A4. | The message flow completes and the broker begins to commit all the resources involved in that flow, including SAP and the MQReply node call. The order number is available to the user application. | |||
The following two processes occur simultaneously, and effectively race each other to complete. | ||||
SAP Commits processing asynchronously | BAPI Get Order Status message flow | |||
B1. | The SAP commit begins. | C1. | A request for an order status query is made. | |
B2. | The SAP commit completes. | C2. | The SAPRequest node requests the order. |
In the following synchronous example, the query is successful and the user receives a positive acknowledgment for the order that has been created.
BAPI Create Order message flow | |
---|---|
1. | An application triggers the transactional message flow that creates the sales order. |
2. | The SAPRequest node submits an order creation and returns the order registration number. The commit happens when the message flow completes because the node participates in the a message flow level transaction. |
3. | The MQReply node puts an MQ message on the output queue pending transactional commit. |
4. | The message flow completes and the broker begins to commit all the resources involved in that flow, including SAP. |
SAP Commits processing synchronously | |
5. | The SAP commit begins. |
6. | The SAP commit completes. |
7. | The adapter hands control back to the broker. |
8. | The MQReply node call is committed, therefore the order number is available to the user application. |
BAPI Get Order Status message flow | |
9. | A request for an order status query is made. |
10. | The SAPRequest node requests the order. |
SAP has completed the order commit; therefore, the order query is successful.