on 2005 May 25 2:46 AM
Hi All,
We are trying to cnnect to SAP from a VB application and invoke some BAPIs there. Everything is working fine, I am able to log into SAP and run BAPIs as well. The only issue is When I log on to SAP from VB Code, it pops up a box asking Titled "SAP Logon at 00" asking Client, User, Password, Language with "OK", "Cancel", "System", Password" button. My requirement is not to have this Pop up box, My VB code should silently log into SAP and if there is any error while login show that. Here is my VB code...
All the Logon Parameters, I am currently hardcoding during my testing testing.
Set SAPBAPIControl1 = CreateObject("SAP.BAPI.1")
With SAPBAPIControl1.Connection
.ApplicationServer = "AppServer Name"
.System = "System Number"
.User = "My User ID"
.Password = "My Password"
.client = "Client ID"
.language = "EN"
'Check if the connection was succesfully established
If Not .Logon(Me.hWnd, False) Then
MsgBox "Connection failed"
Exit Sub
Else
MsgBox "Connect successfull"
End If
End With
If somebody has already worked on this, Kindly let me know how to block this pop up box so that I login to SAP seemlessly.
Thanks in Advance.
hi sunil ,
u can easily suppress that logon box.
just u need to ensure that u r supplying correct username,password etc.
let the code be :
Set oFunction = CreateObject("SAP.Functions")
.......
.......
Set oConnection = oFunction.Connection
......
.............
.. oConnection.Logon(0, bSilentLogon)....
if u supply bSilentLogon = TRUE then it wont pop up.
For more details check out the link :
http://www.members.tripod.com/abap4/Source_Code.html
Hope it helps!
Regards,
Ankur
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ankur,
I am doing the Login as suggested by you. But I am facing one very peculier issue when I do as suggested by you.
.. oConnection.Logon(0, bSilentLogon).... If I do this way and I set bSilentLogon = True, it always gives me that it is not able to connect to SAP. When I set bSilentLogon = False it brings up the Pop up and I press "OK" and It connects me to SAP.
So with same logon credentials, it is not allowing me to logon when I set the bSilentLogon = True.
So you have some idea why this is happenning, Kindly let me know.
Just to add, When I set bSilentLogon = true, Pop up is not coming, but it is not connecting to SAP.
This my Code...
Private Sub Form_Load()
Dim booReturn As Boolean
Dim bSilentLogon As String
bSilentLogon = True
Set SAPBAPIControl1 = CreateObject("SAP.BAPI.1")
With SAPBAPIControl1.Connection
.ApplicationServer = "App Server"
.System = "00"
.User = "User Id"
.Password = "Password"
.client = "Client Number"
.language = "EN"
'Check if the connection was succesfully established
If Not .Logon(0, bSilentLogon) Then
MsgBox "Connection failed"
Exit Sub
Else
MsgBox "Connect successfull"
End If
End With
End Sub
Regards
Sunil Singh
Hi Ankur,
I tried as per your suggestion and here is my findings.
We are two vendors A and B working for client C. Both vendors access Clinet C network through VPN Connectivity. I belong to Vendor A, Our responsibility is to develop BAPIs. Vendor B responsibility is to develop a VB Application and access these BAPIs we developed.
As a part of vendor A (Developing only BAPIs), I wrote a small VB code to see if the Login to SAP from VB code works fine and also to test my developed BAPIs, and If I write this code (I am pasting the code again for new experts who might be looking into this issue)
Private Sub Form_Load()
Dim bSilentLogon As Boolean
bSilentLogon = True
Set SAPBAPIControl1 = CreateObject("SAP.BAPI.1")
With SAPBAPIControl1.Connection
.ApplicationServer = "vuh513"
.System = "00"
.User = "D226741"
.Password = "satyamus"
.client = "430"
.language = "EN"
'Check if the connection was succesfully established
If Not .Logon(0, bSilentLogon) Then
MsgBox "Connection failed"
Exit Sub
Else
MsgBox "Connect successfull"
End If
End With
End Sub
When I go and test this code, I do not get the SAP Logon Pop up window and I am able to login to SAP relatively seemlessly, So no issues from Vendor A (ie. from Vendor A accessing Cleint C through VPN Connectivity).
But When I share this code with Vendor B (as they are responbile for developing actual VB code) When they run this code without any modification, They get the message "Connection Failed" (This is coded in the above code itself when logon to SAP fails) and when they keeep on trying for 4 to 5 times, they get this error message "Connect to SAP Gateway Failed".
But when they set the value of bSilentLogon = false and they run the code, they get the SAP log on Pop up window, with all information already populated they Press the button OK and they are able to log into SAP.
So my question is, What is the issue which is causing this sort of behavior for Vendor B. Vendor A doesn't seem to have any issue whe running the same code.
Hi,
Check if this link helps you:
http://www.tek-tips.com/viewthread.cfm?qid=494927&page=1
Regards,
Anjali
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
105 | |
8 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.