Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error when connection SAP by RFC in VB code

com_2018
Participant
0 Likes
1,630

Dear experts,

VB code:

Set oFunction = CreateObject("SAP.LogonControl.1")

Set oConnection = oFunction.NewConnection

oConnection.Client = "300"

oConnection.Language = "EN"

oConnection.User = "test"

oConnection.Password = "test001"

oConnection.ApplicationServer = "111.111.12.11"

oConnection.SystemNumber = "00"

result = oConnection.Logon(0, True)

Set ofun = CreateObject("SAP.FUNCTIONS")

Set ofun.Connection = oConnection

Set func = ofun.Add("RFC_READ_TABLE")

Error sentence when running:

Set func = ofun.Add("RFC_READ_TABLE")

Error information:

"Runtime error '1001' No connection to SAP system available."

Could you help me?

Thanks and regards,

collysun.

6 REPLIES 6
Read only

Former Member
0 Likes
1,121

What is the user type of user "test" in SAP ( Dialog user or CPIC user )???

Can you try loggong using SAPGUI with same parameters...

Read only

0 Likes
1,121

I can login on SAP using sapgui with same parameters.

Read only

0 Likes
1,121

SAPGUI version:640

Read only

0 Likes
1,121

try this code

dim fns set fns = createobject("SAP.Functions")
dim conn 
set conn = fns.connectionconn.ApplicationServer = "111.111.12.11" 
conn.System = "DEV" 
conn.user = "<user id>" 
conn.password = "<pwd>" 
conn.Client = "300" 
conn.Language = "E" 

if conn.logon(0, true) <> true 
then
 exit 
sub 
end if 
dim myfunct 
set myfunc = fns.add("RFC_READ_TABLE") 

Regards

Raja

Read only

0 Likes
1,121

Thank you very much for your help.

Read only

0 Likes
1,121

If your question is answered , can you reward points to the helpful answers and mark the thread as answered.

Regards

Raja