cancel
Showing results for 
Search instead for 
Did you mean: 

SAP through classic ASP via .NET proxy

Former Member
0 Kudos

Has anyone had success trying to read SAP data through classic ASP using a .NET proxy exposed via COM.

It seemed simple enough; create a .NET class that manages all the connections via the SAP .NET Connector 2.0. Then expose this class to COM by creating a strong name and registering the assembly.

The trouble is, whenever we try and create the COM object in classic ASP we get the same error "can't create object" .... not particularly useful.

We have traced the issue to one line in the .NET code.

<b> SAP.Connector.SAPConnection connection = new SAP.Connector.SAPConnection((IDestination)destination);</b>

This works fine if you are creating the object from another .NET app, but not when run via a classic ASP call. Very strange.

I've seen the odd person run into the same problem but never any solutions.

Has anyone found a solution or even an explanation as to why it would error?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sheldon,

Have you registered the .NET DLL for COM using regasm utility ?

Firstly, you will have to strongly named (using sn.exe) the .NET assembly and install it in GAC (gacutil.exe). Then register is using regasm.exe for COM.

Now, try Server.Createobject("AssemblyName.ClassName") in your ASP code and hopefully you would be able to.

Regards.

Message was edited by:

Jitesh Kumar Sinha

Former Member
0 Kudos

Thanks for your suggestions.

We are registering the assemblies as per your suggestions.

One extra level of complexity we are now removing was the class we were registering for COM was written in VS2005.

So we were creating a proxy class in VS2003, creating a strong name for that. THEN creating a VS2005 class which references the proxy and and exposes public method and calls the VS2003 proxy. We then created a strong name for that VS2005 class and registered it as well ..... sound complex doesn't it!

We are now<b> simplifying</b> the process and only creating a VS2003 class, and exposing public methods there ... hopefully this simplification will help us achieve success.

I'll let you know how it goes!

-Sheldon

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Shelton,

.NET Connector is a tool that integrates itself with visual studio .net2003. As you implemented, to call function first you have to generate the function, table objects via connector wizard.

I recommend that, if you want to connect SAP via COM via dll, you can create 'your own connector' using SAP dlls that can be found under your installation directory. But this can be more difficult. Another way is, create your functions with vs2003, create a dll, then use this dll via ASP

Best Regards,

Huseyin Akturk

SW Engineer & SAP ABAP Consultant

www.huseyinakturk.net