I'm trying to schedule a job to start a vb .NET .exe that logs on to SAP via RFC. As soon as I put my SAP Logon function in there it hangs at the line R3.Connection.Logon(0, silent). It doesn't crash, but it never completes it. It works fine when I start
the exe on the server by hand though. I assume it has something to do with the SAP GUI being called in background mode or something along these lines. However, I can't find out anything more, because SQL never throws an error or writes anything in the log
file. It is just stuck in the execution stage.
The strange thing is that this has worked for a colleague of mine. Unfortunately that was many many years ago in vb6 and we don't have the code anymore. I do know that it must work somehow though.
I created a test program that simply contains the logon code and nothing else, but as soon as the job gets to the .Connection.Logon(0, silent) line it stops. I tried R3.Connection.RfcWithDialog = 0 and other properties of the SAP object, but nothing works.
The job simply never gets past that line.
Relevant code:
Dim R3 As Object = CreateObject("SAP.Functions") With R3 .Connection.Client = Client .Connection.User = User .Connection.Password = Password .Connection.RfcWithDialog = 0 .Connection.System = "Q11" .Connection.MessageServer = MessageServer .Connection.GroupName =GroupName End With Call R3.Connection.Logon(0, silent)