Jeff Seagard's Blog

Development notes on Windows Azure, Windows Phone, and all around .NET goodness

Learnings with the BizTalk Adapter Pack and SAP

Learnings with the BizTalk Adapter Pack and SAP

  • Comments 3

Recently I had the opportunity to get some hands on experience using the BizTalk Adapter Pack 1.0 (BAP) and I thought I'd dust off my blog and share some of my takeaways.

If you are unfamiliar with the BAP, it consists of a set of WCF-based LOB Adapters/Bindings for:

  • mySAP Business Suite
  • Siebel eBusiness Applications
  • Oracle Database

While the BAP falls under the BizTalk brand (and is included with recent purchases of BizTalk Server 2006 R2 or Software Assurance), the BAP is also available as a separate stand-alone product. This is cool because as these adapters are packaged as WCF bindings you can leverage them as a part of your "vanilla" .NET 3.0 projects.

Just install the BAP and the rest of its software requisites and you're ready to code. Open your project in Visual Studio and launch the Add Adapter Service Reference Visual Studio Plug-In (via either the Project menu or right clicking on the project file in the solution explorer window). The Plug-In has a wizard which lets you choose the appropriate BAP adapter/binding for the system you want to connect to, specify your connection credentials and parameters, and then connect to the system to browse/search/select the methods you're interested in invoking. Once you've selected this set of methods you're interested in working with, click the OK button and the Plug-In will generate a client proxy file and stick appropriate WCF elements in your app.config file. For more details on generating and working with the client proxy be sure to check out articles in the online help on MSDN such as Invoking BAPIs by Using the WCF Service Model.

On a side note, the purpose in the project for leveraging the BAP was to pull complex data from potentially multiple SAP BAPI calls to multiple SAP systems (ECC and CRM) and return the resulting data to BDC and custom web parts in a MOSS 2007 site. This worked out really well. For more information on this approach, check out the scenario ideas on the BizTalk Adapter Pack - Office Developer Program page.

With that all said, here are my technical tips and tricks:

  • The BAP and the Add Adapter Service Reference Visual Studio Plug-In are currently only supported on Visual Studio 2005 (with VS 2008 support coming with BizTalk 2006 R2 SP1)
  • If you're using the sapBinding and your SAP connection information includes a SAProuterstring, you will need to do a couple of things:
    1. In the Add Adapter Service Reference wizard, select the sapBinding and then click on the Configure button. In the Configure Adapter dialog, click on the URI Properties tab and prepend your SAProuterstring value to your Application Server name in the Application Server Host property field.
    2. After you click OK, go into your project's app.config file and find the endpoint element that the Plug-In generated. Locate the SAProuterstring you entered previously in the address atrribute and url encode the SAProuterstring portion like so:
        Before
        address="sap://CLIENT=800;LANG=EN;@A//H/saprouter.testsite.com/H/applicationserver/05?RfcSdkTrace=False&AbapDebug=False"
        After
        address="sap://CLIENT=800;LANG=EN;@A/%2FH%2Fsaprouter.testsite.com%2FH%2Fapplicationserver/05?RfcSdkTrace=False&AbapDebug=False"
  • If you start getting invalid date errors at runtime (like I did), consider setting the EnableSafeTyping binding property to true. Setting this to true will expose SAP DATS, TIMS, and NUMC fields as strings (as opposed to their correlating .NET types) in the client proxy and the adapter will not validate the values you pass in or get back. You will need to set this to true in two places:
    1. When you run the Add Adapter Service Reference wizard, in the EnableSafeTyping property on the Binding Properties tab in the Configure Adapter dialog
    2. In the generated portion of the app.config file, in the enableSafeTyping attribute of the binding element
  • You will most likely only be able to have one generated client proxy file per project. This is due to the fact that in the client proxy file there are a number of common generated classes that will collide with the with the same generated classes in another client proxy file in the same namespace.  You might not have this problem if you're generating proxies using different bindings (ex. one using SAP and one using Siebel) as these generated classes appear to be at least somewhat binding specific.
  • If you want to add (or change) the BAPIs or other method calls you are invoking on your host system, you will have to re-run the Add Adapter Service Reference wizard and reselect all of your BAPIs and then regenerate your client proxy file and app.config. I would recommend deleting the app.config and client proxy files that were previously generated before re-running the wizard.
  • The fun of working with SAP (tongue firmly planted in cheek) is determining which BAPIs to call and determining what parameters (types, arrays, values, etc) you will have to cobble together to pass to said BAPIs to make them work. You definitely need to be working with an SAP expert to help you with this process which will require much trial and error.

     

    If you're getting started using the BAP I hope you find this helpful. Additionally, here are a couple more helpful resource links:

    Download an evaluation copy of the BizTalk Adapter Pack

    Sonu Arora's Blog

Leave a Comment
  • Please add 6 and 4 and type the answer here:
  • Post
  • We could not get it to work with a SAP router string. Tried your example but get the error

    The Application Server Host Name (ASHOST) has not been specified.

  • 話題の小向美奈子ストリップを隠し撮り!入念なボディチェックをすり抜けて超小型カメラで撮影した神動画がアップ中!期間限定配信の衝撃的映像を見逃すな

  • Hi,

    I am caling a BAPI from BTS 2006 R2 using WCF SAP adapter. When I execute the BAPI from SAP GUI with the same parameters, I see the reults in 2 parts - Export params and Tables.

    However when I call the BAPI from BTS, I get only few elements in the XML as the result. I noticed that only those elements which are labelled export parameters (typically HEADER) are returned and those labelled as Table (ITEM details) are not returned. ANy ideas?

Page 1 of 1 (3 items)