In Connect SAP R/3 4.6C and SharePoint 2003 – Part I: Prepare Environment, I described how to set up the testing/development environment for connecting SAP 4.6c and SharePoint Portal Server 2003 in order to meet the business needs of displaying SAP data on SharePoint sites.
The case study’s objective to create two web parts. One web part retrieves and displays the customer list staring with some characters from SAP IDES database via RFC interface. The second web part displays the order list of a customer from IDES via BAPI interface. These two web parts can be connected. When user selects a customer on the first web part, the second web part will display the order list accordingly.
The key starting point of accessing SAP data is to define a SAPProxy, which is “generated from a standard Web Service Description Language (WSDL) file, a WSDL file included in an SAP interface repository (IFR), or from an SAP server. At run time, the SAP .NET Connector uses these classes to perform and manage communication between the .NET application and the SAP server.” In our first web part, we will invoke one of RFC functions the SAP proxy class provides to get the customer data like below figure shows.
So far we have a Sharepoint testing server installed with SAP .net connector 2.0.1 and JRE 1.4 and I have a SAP IDES(say, IP: xxx.xx.xx.xx, Client number:800, System number:0) with a developer-right user name and password. (IDES stands for Internet Demonstration and Evaluation System, which is a demo system of SAP, so for testing and studying, we start to use IDES as our back end SAP system.) Now we can go to this testing server and open VS 2003 to implement below steps.
1. Create a New WebPart Library Project named “SAPCustomerWebParts”
2. Solution Explorer, right click solution “SAPCustomerWebParts” and Add New Item
3. Select SAPConenctor icon, add a new SAP proxy named “SAPProxy1”
4. Click Server Explorer on design view window of SAPProxy1, a node SAP will appear on server explorer tree with other server data source nodes. If this SAP icon does not appear, just right click server explorer and click refresh. If you have installed SAP .net connector, SAP node should be there.
5. Under SAP node, there is a child node called “Application Servers” , right click it and Add new SAP Application Server
6. A window popped up like below Define DestinationType as Custom Logon Settings, input SAP user name such as “tedteng” (you must request your SAP admin add a developer user for you), set the client number in my case is “800” (if you do not know, ask your SAP admin. at this point, I made a mistake because I had little knowledge of SAP on this configuration), set AppServerHost as the ip address like my case’ SAP IDES server ip or its servername like seccoides in my company, and then define SystemNumber as 0.
7.Then a node “10.20.130.29” (AppServerHost’s value) will appear on under node of “Application Servers”. Under this new node, there are two children nodes: BOR and Functions. In SAP, BOR stands for Business Object Repository and Functions for RFC / BAPI functions. RFC stands for Remote Function Calls and BAPI for Business Application Programming Interface.
8. Right click Functions node, Add function filter with “RFC_CUS*” as the value of filter. Then there are four SAP RFC functions starting with “RFC_CUS” will appear under the Functions node.
9. Right click a node named “RFC_Customer_Get” (this SAP RFC function is to get a list of customers), then click Add to Designer, a retrieving data window pops up. This retrieving function need the Java Run Environment.
10. Then the SAPProxy1 designer window will be like below:
11. Initial SAPProxy1 use below codes:
SAPProxy proxy = new SAPProxy1();
SAPDestination dest =
new SAPDestination("your sap server ip or name", youSapClientNumber,systemNumber,"yourSAPUserName","yourSAPPassword");
//here just for demo, we use fix SAP user account, in real world, we may choose SharePoint Single Sign On function to replace above code;
SAPCustomerWebParts.BRFCKNA1Table customer_T = new BRFCKNA1Table();
= new SAP.Connector.SAPConnection(dest);
catch (Exception ex)
BRFCKNA1Table customer_T is SAP table but it can be transferred to ADO DataTable. So you will easily to use it as you use .net data tables.
Next we will come back to .net world to create web parts. I will describe in next tip.