cancel
Showing results for 
Search instead for 
Did you mean: 

Connect to sap using Delphi 2005 and .Net ?

Sigurdur
Participant
0 Kudos

Hi

I it possible to create a .net program in delphi 2005 that connects to sap.

Or is it only possible to use MS Visual studio

Sigurdur

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sigurdur

<b>YES</b>. It is certainly possible to create .net programs in Delphi 2005 that can connect and transact with SAP systems. Language interop is one of the neat features of .net and if you are willing to tread the unbeaten path then way to go man.

You can start off by -->

1. downloading the .Net connector from the SDN/service mkt place. Running the setup would install the required assemblies in the GAC.

2. In Delphi 2005 you can code either using Delphi or C#. The choice is your's, depending on your comfort level with the language syntax.

3. Create a new Project group and add an appropriate project (Refer 2. above)

Add references to the assembly SAP.Connector.dll and SAP.Connector.Rfc to your project.

4. Now <b>the tricky part</b>. MS Visual Studio offers designer support to auto generate SAP connector proxies using a few mouse clicks. In Delphi 2005, you may not enjoy such a luxury.

<b>However,</b> you can use the SAP.Connector.SAPClient and SAP.Connector.SAPTable classes and write a few lines of code which would do the trick for you. Here is a code snippet in C#. (In Delphi 2005 you can also use Delphi to write this code)

/************************************************/

using System;

using SAP.Connector;

namespace WinUI

{

public class CallRFM : SAPClient

{

public CallRFM(string connectionStr) : base(connectionStr)

{

Connection = SAP.Connector.SAPConnection.GetNewConnection(connectionStr.ToString());

}

[RfcMethod(AbapName = "SYSTEM_UUID_CREATE")]

public virtual void System_Uuid_Create ([RfcParameter(AbapName = "UUID",RfcType=RFCTYPE.RFCTYPE_BYTE, Optional = true, Direction = RFCINOUT.OUT, Length = 16, Length2 = 16)] out byte[] Uuid)

{

Connection.Open();

string ret="";

object[]results = null;

results = SAPInvoke("System_Uuid_Create",new object[] {});

Uuid = (byte[]) results[0];

if (Uuid!=null && Uuid.Length>0)

{

for (int i=0; i<Uuid.Length; i++)

{

ret = ret + Uuid<i>.ToString();

}

}

Connection.Close();

System.Windows.Forms.MessageBox.Show(ret.ToString());

}

}

}

/************************************************/

Pass the connection string for your R/3 system to the constructor and call the System_Uuid_Create() method.

It would show u a Unique ID generated by the system.

Does that answers your question? I would be glad to share experiences while using Delphi on the .net platform.

Cheers,

Gaurav

Sigurdur
Participant
0 Kudos

Hi Walia

This certainly answers my question if delphi 2005 can be used to program .net code against SAP

After looking around on the web I could not find any hints about this.

This is a very useful input for my as my company is looking into wether to make our next web platform Java or .net.

Best Regards Sigurdur

Former Member
0 Kudos

Hi Sigurdur,

I noticed you are looking into what can be used for your next web platform...

not meaning to be a "sales" person - have you considered the SAP portal?

Regards,

Ofer

Sigurdur
Participant
0 Kudos

Yes and No

When I said the next web platform then we need a decent WCM (Web Content management system) running on either .net or java.

No matter what platform we choose we need to be able to use it to both develop our own projects connected to sap or not and integrated into the wcm system or not.

The portal may come in the future to more tightly integrate our systems

right now it's about choosing the technology path to go

Regards Sigurdur

Answers (1)

Answers (1)

reiner_hille-doering
Active Contributor
0 Kudos

You need Visual Studio .NET to create a DLL with your SAP Proxy(ies). You can than use the DLL from Delphi.