Tuesday, August 11, 2009

Apply WCF BizTalk Adapter Pack to service-enable SAP BAPI/RFC's

One way to expose native SAP BAPI and RFC function modules is by generating a web service within SAP NetWeaver. In some cases this is less appropriate. For starters, you need to have a SAP Developer Key to be allowed to use the SAP web service wizard, and also have the required SAP authorizations. In other cases it may not be allowed by IT operations to make any modification to the SAP environment, even if it's limited to the full-automatic generation and activation of the BAPI webservice(s). Another reason from a system architecture viewpoint, is that the single BAPI and/or RFC calls may be of too low granularity. You actually want to perform a 'business transaction', consisting of multiple method invocations which must be treated as a Logical Unit of Work (LUW). SAP has introduced the concept of SAP Enterprise Services for this, and has delivered a first set of them. This is by far not complete yet, and SAP will augment it the coming years.
The by SAP delivered Enterprise Services will of course be limited to standard SAP functionality. In case of custom functionality you'll need to provide your own 'Enterprise Service' behaviour. This can be done in the SAP environment as a custom BAPI/RFC function module, and then exposed as BAPI webservice. However, another option is to apply the .NET WCF LOB Adapter SDK and the related BizTalk Adapter Pack. The LUW behaviour is then implemented within a .NET class. For transactional update behaviour, the .NET class must invoke BAPI_TRANSACTION_COMMIT at the end in case no problems are encountered, and otherwise BAPI_TRANSACTION_ROLLBACK to rollback all the earlier performed updates in the LUW.
Basic Steps:
  1. complement your local development environment:
    i) install the WCF LOB Adapter SDK 2.0
    ii) install the BizTalk Adapter Pack 2.0
    iii) install the SAP RFC SDK

  2. Generate in VS2005/2008 an 'Adapter Service Reference'; select the SAPbinding, configure the connection to the SAP system and connect, and next select the BAPI's and RFC's function modules that you're going to invoke in your business functionality. Important: if you need to implement a transactional update, also include the BAPI_TRANSACTION_COMMIT and BAPI_TRANSACTION_ROLLBACK function modules.

  3. Design and implement the client context that applies and invokes the SAP adapter binding.

The whitepaper Windows Communication Foundation (WCF) LOB Adapter SDK and the BizTalk Adapter Pack gives the reader a good and thorough insight on the vision and functionality of both. And excellent read for the ones interested in approaches to integrate arbitrair .NET clients (e.g. MOSS) with external Lines of Business application (e.g. SAP HR).
Tags: SAP NetWeaver Microsoft SharePoint integration interoperability WCF LOB Adapter

No comments:

Post a Comment