How to Integrate .net Application with SAP

Aim of this article is to show you how to connect your .NET front-end application with SAP. We will discuss the prerequisites for integration a .net application with SAP. In addition, we will go through step by step guide on how to implement the .net application which connects with SAP back-end. This is an synchronous interface between .net application and SAP.

Example Scenario Overview:

Example scenario is such that SAP will act as the server and .net application as the client. Front end .net application send a requests to SAP Remote Function Call (RFC) ‘MONTH_NAMES_GET‘. Request message from the frond end application contain the language key and RFC should return the names of the months in the language key sent in the request.
.net application and SAP integration example overview
.net application and SAP integration example overview

Steps to Integrate .net Application with SAP back-end:

  1. Firstly, SAP Connector for .net should be installed.
  2. Secondly, activate the remote function capabilities.
  3. Finally, develop the .net application.

Step 1 – SAP.NET connector should be available. You should have the following “.dll” files to proceed.

Make sure the SAP .net connector is installed and enabled. These .dill files should be available to proceeded.

– rscp4n.dll
– sapnco.dll
– sapnco_utils.dll

Step 2 – Activate ‘Remote-Enable Module’ in the Function Module.

For a SAP Function Module to be able to integrate with a third party application, it should be a Remote Enabled Function Module. They are also known as RFCs. The FM we are using for this example, MONTH_NAMES_GET delivered from SAP as a RFC.
But if you are using a custom FM or any other standard SAP FM, make sure the their RFC functionality is enabled.
You can check this using transaction se37. if this option is not enabled, you will not be able to call the BAPI with an RFC call.
Function Module attributes. Remote-Enabled Module activated.
Function Module attributes

Step 3 – Create .net application project and add the references.

If the prerequisites are met, create the .NET application as below.

Select the “.dll” files.
Follow the below coding blocks to use the added libraries to connect to SAP system and access available BAPIs.
Add the libraries
Assign server details
Create RFC destination object
Create the repository object.
Create function object.
Set parameters of the function.
LANGUAGE is the import parameter and MONTH_NAMES is a table parameter that returns names of the months.
“language” is a string variable with “EN” as default value.
Finally invoke the RFC.
You can use the variable “itab” which returns the names to do any other processing.

If you have any questions on integrating SAP and .net client applications, please leave a comment below.

Get the latest tips and tricks on SAP!

2 Comments

Add a Comment

Your email address will not be published. Required fields are marked *

Get the latest tips and tricks on SAP!