Example: Processing an outbound BOD
The example provided in this topic illustrates the practice of using non-transactional
replication to generate a Business Object Document (BOD) and send it to a target site. This
example is based on the procedure presented in the topic Processing outbound BODs.
- A user runs a Purchase Order Report in a Mongoose-based application. As a part of the logic executed, a remote method
call is made to the stored procedure TriggerPurchaseOrderSyncSp, which triggers BOD
generation replication logic. This remote method call specifies two parameters in this
case, one for the purchase order number and the other for the action that is to be taken.
This code snippet shows the two parameters that are passed by the remote method call to the TriggerPurchaseOrderSyncSp stored procedure:
EXEC @Severity = dbo.RemoteMethodForReplicationTargetsSp @IdoName = 'SL.ESBSLPos' , @MethodName = 'TriggerPurchaseOrderSyncSp' , @Infobar = @Infobar OUTPUT , @Parm1Value = @PoPoNum , @Parm2Value = @ActionExpression
Note: The @MethodName attribute refers to a core stored procedure that has been defined and designated on the Replication Document Outbound Cross References form. It uses this "pseudo" stored procedure name. The stored procedure itself is listed as part of the replication category being used. - The system checks to see if a rule exists for the replication category ( ) where this stored procedure is specified.
- After verifying that the replication rule exists and is active, the system builds the
replication document (BOD). The Replication Queue Listener service looks for a replication
cross-reference for PurchaseOrder.Sync where the Applies
To method is TriggerPurchaseOrderSyncSp. Note: In this example, the MSMQ is not used, because no data has changed in a table; therefore, no table triggers were fired.
- When that cross-reference is found, the Replication Queue Listener service retrieves the
PurchaseOrder replication document template and builds the XML-formatted BOD document,
using the noun and verb from the Replication Document Outbound
Cross Reference form, plus element and attribute information defined on the
Replication Documents form and the Replication Document Elements form.
When building the BOD, the purchase order number is passed as the first parameter (Parm1). The replication document uses this information in a filter
(PoNum=FP(Parm1))
so that the generated BOD contains data only for the specified purchase order. - The Replication Queue Listener service places the BOD into the Replication Outbox for further processing, at which time the remote method call is invoked and the TriggerPurchaseOrderSyncSp stored procedure on the target site also generates the report.