MASHUP: SharePoint 2010 BCS + WCF + SAP

Recently went through the process of pulling data from SAP into SharePoint 2010 via BCS and WCF.  Very powerful stuff but ooooh, the pain, THE PAIN!  So I thought I’d share my experience to mitigate the unpleasantries you may experience.  To sum up the basic steps and design:

  • Develop the .NET-to-BAPI RFC using the SAP Connector 2.0 in VS 2003/XP VM
  • Migrate the entire project to VS 2010 in Windows Server 2008 R2
  • Add logic (DataTable) and wrap in WCF Service
  • Deploy WCF to IIS 7.0
  • In SharePoint Designer 2010, configure an External Content Type to consume the WCF service
  • Configure content type in a SharePoint 2010 BCS List

Admittingly, the SAP process was the most difficult (and sinister!)  Lots of help was available in the SharePoint community however.  Enjoy!

1.  Setup the XP VM

  • Required because VS2003 installs failed in Windows Server 2008
  • Install VS 2003
  • Install SAP .NET Connector 2.0 – this is the real culprit.  This connector provides the BAPI explorer ONLY in VS2003.  SAP is FINALLY working on the 3.0 connector which will hopefully integrate into a VS2010. 

By the way, you can opt to use the BizTalk Adapter Pack and forgo the VS2003/XP steps.  The adapter pack is designed to be used with WCF.  However, at the time of this writing, Microsoft recommends a suggested retail price of $5000+ per CPU.  Another cheaper alternative is ERPConnect by Theobald Software.  ERPConnect integrates at the assembly level – therefore it can be integrated into any .NET platform – ASP.NET, WinForms and not just WCF.

2.  Setup VS2003 – follow this example for developing a BAPI interface.  Stuff you’ll need from your SAP gurus.

  • System Number 
  • SystemID 
  • Client
  • App Server host  
  • Username
  • Pass

3.  VS 2010 Setup (Separate VM)

  1. Recommend NOT using XP 32bit for VS2010.  Problems with GUI in MY VM.
  2. After setting up the BAPI function calls in VS2003, copy the entire project to VS2010.
  3. If in a separate VM, install SAP GUI to ensure dlls are available for the connector.
  4. Create a VS2010 WCF Library Project – Choose .NET 3.5!!
  5. Import the VS2003 project as an existing project.  Perform the upgrade conversion.
  6. Add a reference to the WCF Library project for the:
  • SAP.Connector.dll
  • SAP.Connector.Rfc.dll
  • Your custom developed SAP dll from the new converted VS2003 project.
  • System.Web.Services 

7.  Follow this blog for setting up/developing/deploying your WCF to IIS.

  • Using Process Explorer, I determined librfc32.dll needs to be in the environment variable PATH.  You can get this from SAP GUI or if you’re brave, the SAP Market Place (developer purgatory).  I only mention it because I’m sure you don’t want to install SAP GUI on a production server.  Also, for development in 64bit environments, you should install the 64bit librfc32.dll in the Windows\System32 folder and the 32bit librfc32.dll in the Windows\SysWow64 folder.  Here’s a good link on finding the librfc32.dll in SAP Market Place.
  • Install SAP.Connector.dll and SAP.Connector.Rfc.dll in the GAC.
  • Enable 32 bit Web App compatibility on the WCF App Pool (located under Advanced Settings).
  • Ensure the 32 bit Web App compatibility is DISABLED for ALL SharePoint 2010 web apps
  • Ensure the .NET 4.0 ISAPI filter is removed from all of your existing SharePoint 2010 web apps.  

8.  Follow this blog for setting up and connecting to your BCS via an External Content Type in SharePoint Designer 2010.

  • PAY ATTENTION to your base address in your web.config.  It needs to match the URL you use in when connecting via SD.
  • PAY ATTENTION to connection option of using METADATA EXCHANGE.  Remember the “/mex” and to choose “Metadata Exchange” for the Metadata Connection Mode.  
  • URL WEIRDNESS:  Did I already mention to pay attention to your base address??  In the web.config on my PRODUCTION server, I specified http://myservername:8888 for the base address.  However, SharePoint Designer could not find the end point until I used a fully qualified domain name:  http://myservername.mydomain.com:8888.  Note that I did NOT have to use the FQDN in my local VM for testing!
  • Also, I noticed the BCS Data List does have paging built in.  HOWEVER, it does a full pull from the source for each page.  That could get EXPENSIVE if you have a lot of data.

WCF Considerations

1.  Read article comparing WCF to old way of doing Web Services.

  • It’s DataContractSerializer is 10% faster using the XMLSerializer
  • Versioning tolerance (DataContractSerializer only)
                 – Missing members (deserializes defaults – null, 0 and etc)
                 – Adding fields does not break interface
  • Seemless support for other bindings:  MSMQ, TCP, Named Pipes, Dual HTTP and etc
  • Asynchronous call (or callback) support
  • Takes advantage of Windows Activation Services

2.  Microsoft provides a great tutorial here.
 
3.  Use VS2010 “WCF Library” projects to enable portability
 
4.  Use a separate App Pool for WCF Services
 
5.  Use a separate virtual directory OUTSIDE of SharePoint
              – web.config modifications
              – patching of SharePoint

6.  Also a good article on deployment best practices

7.  WCF supports WS-I Basic Profile 1.1 via the BasicHttpBinding class.

About these ads

~ by spninjablog on January 22, 2010.

3 Responses to “MASHUP: SharePoint 2010 BCS + WCF + SAP”

  1. spninja – did you consider using the BizTalk Adapter Pack 2.0?
    Has you up and running talking to SAP via IDOCs, BAPIs, RFC etc in a matter of hours – seriously!

    It exposes a WCF Service that you can consume through BCS (or external content type/lists) etc.

    Cheers,

    Mick.

    • Oh yes, that’s definitely the way to go if your client has the dollars. As I indicated in my post, BizTalk Adapter Pack ain’t free however. Starts at $5k per cpu. However, I thought the fact that it worked with Visual Studio 2003 was interesting and “blog-worthy” :)

  2. Here another way to connect SAP and BCS:

    How To Integrate SAP Business Data Into SharePoint 2010 Using Business Connectivity Services And LINQ to SAP
    http://jbaurle.wordpress.com/2010/08/16/how-to-integrate-sap-business-data-into-sharepoint-2010-using-business-connectivity-services-and-linq-to-sap/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: