cancel
Showing results for 
Search instead for 
Did you mean: 

RFC server using VB.NET

Former Member
0 Kudos

Hi Experts,

I am new to .NET connector, and would like your help if you could let me know the step by step process to create a RFC Server using VB .NET.

Thanks for all the help!!

Kind Regards

Piyush

Accepted Solutions (0)

Answers (1)

Answers (1)

reiner_hille-doering
Active Contributor
0 Kudos

1. Define the signature of your Server Function(s) in SE37 in ABAP. If you want to reuse an existing function's signature, skip this step.

2. In VS create a new Command Line Application.

3. Add new Item->SAP Connector Proxy.

4. You see an empty designer.

5. Configure Server Explorer so that you see the SAP Server.

6. Drag the function(s) defined in 1. to the designer.

7. Click on background and change to Properties window. Change the ProxyType property from "Client" to "Server" and save the designer.

8. Delete the original "Program.Vb", as the ...Impl.vb already contains a Main function.

9. Fill the server code into the ...Impl.vb file.

10. In SM59 define a TCP/IP destination form 'Registered Server Program' and invent a Program ID.

11. Run your .NET application with command line "prog -g<GatewayHost> -x<GatewayPort> -a<ProgramID". GatewayHost is usually the name or IP of you SAP server. GatewayPort is usualy 3600+SystemNumber or somthing like "sapgw00". ProgramID is the string you entered in step 10.

12. Call you function from ABAP specifying the destinatio name configured in step 10.

Former Member
0 Kudos

Hi Reiner,

Thanks for the detailed description. It did help me going a long way in solving the problem at hand.

Although I am facing the following weird problem:

I am trying to intantiate an object using Createobject("CLSID","") but it simply moves the focus to the server's console window and hangs. If I type Exit in the console window then the server stops and the processing then continues back in the .NET program. But since the server has been exited, the code in ABAP gives a DUMP.

I am not sure what could be the reason for the focus to shift to console window and the application to hang.

I tried to write a normal .NET application to do exactly the same piece of work, and it works perfectly fine!!

Would appreciate any clues or pointers to the same!!

Thanks,

Piyush

reiner_hille-doering
Active Contributor
0 Kudos

Ah, you are using external COM-objects. You should know that most COM-objects require the so-called Appartment-Threading model, which is based on Windows message passing.

Please try adding in the Main function where your server instances are created, after

Server = new SAPProxy1Impl(args,Host)

to add the following line.

Server.COMApartmentModel = Threading.ApartmentState.STA

I'm not sure if this is sufficient. You may also need to add a message loop somewhere in your application-