on 09-26-2008 10:06 AM
Hi,
While connecting to the company using single sign on i am getting the following error.
Error code : 1000000004
Error msg : Unknown session
any suggestion??
i am using following code.
OCT_SboGuiApi = New SAPbouiCOM.SboGuiApi
OCT_Company = New SAPbobsCOM.Company
strConnection = Environment.GetCommandLineArgs.GetValue(1)
OCT_SboGuiApi.Connect(strConnection)
GOD_Application = OCT_SboGuiApi.GetApplication()
strCookie = OCT_Company.GetContextCookie
strConnection = GOD_Application.Company.GetConnectionContext(strCookie)
lngGetCompanyString = OCT_Company.SetSboLoginContext(strConnection)
If OCT_Company.Connected = True Then
OCT_Company.Disconnect()
End If
If Not lngGetCompanyString = 0 Then
Exit Sub
End If
lngGetCompanyString = OCT_Company.Connect
Regards,
Mahendra
Edited by: Mahendrakumar on Sep 26, 2008 11:06 AM
In this case, you may need to restart the License Server, then it works fine.
Regards
-Yatsea
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi...
use this code...
Public Sub New()
MyBase.new()
StartApplication()
If Not SetConnectionContext() = 0 Then
SBO_Application.MessageBox("Failed setting a connection to DI API")
End ' Terminating the Add-On Application
End If
If Not ConnectToCompany() = 0 Then
SBO_Application.MessageBox("Failed connecting to the company's Data Base")
End ' Terminating the Add-On Application
End If
NI = 0
SBO_Application.MessageBox("PR Connected to : " & OCompany.CompanyName)
AddMenuItem()
End Sub
Private Sub StartApplication()
Dim SAPUI As SAPbouiCOM.SboGuiApi
Dim ConStr As String
SAPUI = New SAPbouiCOM.SboGuiApi
ConStr = Environment.GetCommandLineArgs.GetValue(1)
'ConStr = "0030002C0030002C00530041005000420044005F00440061007400650076002C0050004C006F006D0056004900490056"
SAPUI.Connect(ConStr)
'SAPUI.AddonIdentifier = "5645523035496D706C656D656E746174696F6E3A5830333832303233373832564E5607827D2ACACD0F468D337053739D921D8C"
SBO_Application = SAPUI.GetApplication
End Sub
Private Function ConnectToCompany() As Integer
Try
ConnectToCompany = OCompany.Connect
'ServerName = OCompany.Server
Catch ex As Exception
'SBO_Application.MessageBox(ex.Message)
End Try
End Function
Private Function SetConnectionContext() As Integer
Dim sCookie As String
Dim sConnectionContext As String
Dim lRetCode As Integer
OCompany = New SAPbobsCOM.Company
sCookie = OCompany.GetContextCookie
sConnectionContext = SBO_Application.Company.GetConnectionContext(sCookie)
If OCompany.Connected = True Then
OCompany.Disconnect()
End If
SetConnectionContext = OCompany.SetSboLoginContext(sConnectionContext)
End Function
regards...
Billa 2007
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try This.....
#Region "Single Sign On"
Public WithEvents app As SAPbouiCOM.Application
Public gui As SAPbouiCOM.SboGuiApi
Public com As SAPbobsCOM.Company
Private Sub SetApplication()
Dim GuiSboGuiApi As SAPbouiCOM.SboGuiApi
Dim StrConnectionString As String
GuiSboGuiApi = New SAPbouiCOM.SboGuiApi
Try
StrConnectionString = Environment.GetCommandLineArgs.GetValue(1)
GuiSboGuiApi.Connect(StrConnectionString)
app = GuiSboGuiApi.GetApplication()
Catch ex As IndexOutOfRangeException
StrConnectionString = "0030002C0030002C00530041005000420044005F00440061007400650076002C0050004C006F006D0056004900490056"
GuiSboGuiApi.Connect(StrConnectionString)
app = GuiSboGuiApi.GetApplication()
Catch Ex As Exception
app.MessageBox(Ex.Message)
Finally
End Try
End Sub
Private Function SetConnectionContext() As Integer
Dim StrCookie As String
Dim StrConnectionContext As String
Try
com = New SAPbobsCOM.Company
com.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL
StrCookie = com.GetContextCookie
StrConnectionContext = app.Company.GetConnectionContext(StrCookie)
If com.Connected = True Then
com.Disconnect()
End If
SetConnectionContext = com.SetSboLoginContext(StrConnectionContext)
Catch Ex As Exception
app.MessageBox(Ex.Message)
Finally
End Try
End Function
Private Function ConnectToCompany() As Integer
Try
If com.Connected = True Then
com.Disconnect()
End If
ConnectToCompany = com.Connect
Catch Ex As Exception
app.MessageBox(Ex.Message)
Finally
End Try
End Function
#End Region
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
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.