If you want to consume SAP data through non SPA application then this is a very useful document for you. It gives you a step by step, easy guide to build it yourself. We can, using SAP Web Services, read and write SAP data using non SAP applications. This option has been available for a long time now. Please do remember with the advent of UI5 and Fiori there are now more ways to utilise SAP data externally.
The example here shows how to read the data but can be enhanced to write back to SAP as well. Please check if you have the relevant SAP license.
This example was done on:
1) Microsoft Visual Studio 12
2) SAP ECC 6.0
I am writing down the steps which if followed properly will help you do it yourself.
The example here is to demonstrate how we can read vendors in SAP and pass it on to a .Net Application.
The prerequisites are:
1) Basic knowledge of SAP ABAP, especially RFC
3) Basic knowledge of Visual Basic/C#
Here is a list of, high level, steps on how to do it:
1) Create an RFC Enabled Function Module in SAP
a) In our example, we will create an RFC which accepts a country code and returns all the vendors for that country from an SAP server
2) Create a Web Service for the function module so that it can be consumed by other service based applications
3) Setup the Web Service
4) Create a small Visual Basic Project to show how the country selection be passed to the Web Service and utilise the list of vendors returned from SAP
We will start with a list of activities to be carried out in SAP first.
- Creating an RFC Enabled Function in SAP
- Next step is to convert this into a Web Service so that it can be called from outside SAP
- Setup Web Service Step I- Run Transaction – SOAMANAGER – Select Web Service Configuration. Search the newly created Webservice. Click on the search result-> Click on Create Service (The below lines will be created once you have finished creating the service. You may want to look at the next screenshots for details on what to select. Authentication is the main one, we can leave all the rest to default.
- Setup Web Service – Step II - Properties setting to be used while creating the service. Click on Open Binding WSDL generation to get the Web Service Link. Copy the WSDL URL for Binding – This will be used in other non SAP application to link to SAP
- Consume it in .Net (Visual Basic Application ) - Step I -Start a new project of type WebSite. Add Web Form by right clicking on the Project. Drag a text box, button and labels as show below. We will use the text box to enter country code. The button will trigger the call to SAP function and return the vendors for that country.
- Consume it in .Net (Visual Basic Application ) - Step II - Add a Service reference – Most critical part. Click on advanced. Click on Add Web Reference. Put the URL from Web Service screen above and click on go – You might be asked to login to SAP here. In the end the web service will show on the screen. You may change how it should be called in VB Project. Final Output once the FM is added in our example. Click on Add Reference
- Consume it in .Net (Visual Basic Application ) - Step III - Code Snippet
- Consume it in .Net (Visual Basic Application ) - Step IV - Output - You can then run the VB application, press the submit button and the result would be fetched from SAP.
- The output is not being shown here purposely.