SAP is the third largest independent software vendor with over 12 million users. Computer weekly also quotes that SAP has over 121,000 installations and is one of the prominent players in the ERP space. As of July 2019, .NET is ranked at number 6 in the TIOBE index. It ranks various programming languages as per their global popularity. The index is updated every month.

Having understood the popularity of both the platforms, it is not uncommon to come across a situation where an integration needs to be done between a .NET application with SAP. Given that many business-critical applications can be developed on .NET and SAP itself is supposed to be the core information system for the entire enterprise.

SAP Integration Services by Veon Contact Banner


Ways to integrate .NET with SAP

Let us look at various ways to integrate the solutions. However, before we do that, it must be known to the audience that there are many editions of SAP in the market. Though, integrating SAP is dependent on which version is under consideration, in this article we are going to talk about the most popular edition in the market called SAP ECC. Read the SAP integration best practices and various SAP editions out here.

Method #1. Integrating .NET and SAP using RFC calls

One of the most popular ways to integrate a .NET application with SAP is by RFC call. Following are the step by step information to integrate using this method.

Step #1. Download the SAP NCO library you would need to import certain SAP libraries called SAP .NET Connector also labelled as SAP NCO. These files are freely available to any SAP customer and can be downloaded from this link https://support.sap.com/en/product/connectors/msnet.html. SAP NCO has two dll files namely, sapnco.dll and sapnco_utils.dll.

Once you implement the libraries in your Visual Studio project, it should look something like this.

Screenshot of SAP NCO library

Step#2. Gather SAP credentials – It is important to gather correct credentials. The important aspects are user name, password, SAP application server IP, client and system number. If anyone around you is working on SAP and has configured access via SAP GUI (shown below), he must know most of these values already. Kindly note that you may have to ensure that SAP user has enough authorization to execute the RFC call. It would take SAP Basis / admin team to confirm / adjust privileges within a minute or two.

Screenshot of configured access via SAP GUI

 

Step #3. Identify the BAPI you need to call – SAP offers many function modules called BAPIs. The interesting thing about BAPIs are that they can be called remotely. For example, one BAPI could return all the company codes defined within the SAP instance. Another could create Sales Order. As you may have guessed, it is important to identify the correct BAPI so that you can prepare your request structure.

 

SAP Remote enabled function module

 

Step #4. Get started with the .NET Code – You are all set. Follow this tutorial to get a working example on reading a table within SAP and displaying the results in your .NET console. Get started here with SAP .NCO example here.


Method #2. Integrating .NET with SAP using IDOCs

IDOCs are formatted XML packages which send inbound and outbound data to SAP for specific purpose. An example of IDOC is Delivery Advice which can be triggered automatically to a third-party application to indicate the key aspects of shipment being sent out of SAP. In this case, obviously its an outbound IDOC. An inbound IDOC could be sales orders sent by customers in EDIFACT format.

As you could have already understood, while RFCs are synchronous calls to SAP, IDOCs help in communicating information in asynchronous mode which ensures that SAP is not bombarded with loads of information. Another advantage of IDOCs is that it can serve as push notification from SAP once certain event is triggered.

For integrating .NET application using IDOCs, you need to prepare a listener class. You can find an example of how a listener class is defined out here. In this case when the IDOC is posted, you would need to parse relevant information and use that for further processing. Following is how an IDOC looks when posted.

Screenshot of  Integrating .NET with SAP using IDOCs

Method 3. Hybrid approach

Now that you know both the approaches to integrating with SAP, you may want to mix and match them. For example, if you are designing an interface which needs real time validation or transaction within SAP, you can use the RFC approach. However, for some other integration between the same applications, you may use the IDOC method.

Read how we integrated CRM for a medical devices company to help them connect with SAP ECC infrastructure right from the field.


Conclusions

No one platform can serve the entire need of an enterprise. Integration are needed often specially between popular technologies like .NET and SAP. With the above insight, you are now placed in a much better position to define your integration strategy. However, understanding SAP’s basic architecture and the right BAPIs and IDOCs are needed to reach a position where you can command the integration and design optimal solution.


About us and what we do

We are passionate about seamlessly connecting SAP with other applications in your landscape. Our consultants are not only expert in SAP integration, but can also enable you to write an SAP adapter for your application and help your application talk to a SAP system.

Contact us for a free assessment