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.

Encode Message Payload to Base64 on CPI!

How to use Base64 message encoder in SAP Integration Suite.

Subscribe for more

My First Interface on CPI!

Learn how to develop your first iFlow on SAP Integration Suite within 7 minutes!

Subscribe for more

7 thoughts on “How to Integrate .net Application with SAP

  1. Amin says:

    Hi, You said about how to connect from .Net to SAP but i need a solution to call a method form .net DLL on SAP GUI , how can I Do it?

  2. Shahid Khan says:

    In “Create RFC destination object”, there is a problem. “rrf” is not defined.
    Please specify what is rrf here.

  3. Rizwan Khan says:

    Hi,
    Using SAP.Net libraries / dll, we can get data from tables from SAP

    Update/Get data in tables from SAP using .Net SAP Libraries ?

  4. Ashish says:

    Hello, need to connect with you to discuss the possibility of how to connect .Net app to SAP Ariba.
    Can you provide any pointers?

    Gr Ashish

Leave a Reply

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