Skip to Content
author's profile photo Former Member
Former Member

In Single sign-on - Error code:1000000004 Error msg:Unknown session

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Oct 09, 2008 at 07:23 AM

    In this case, you may need to restart the License Server, then it works fine.

    Regards

    -Yatsea

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2008 at 09:54 AM

    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
    

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 07, 2008 at 12:34 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.