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

How to create User Table

I`m trying create User Table from sample COM DI, but when I run code:

Dim oUserTablesMD As SAPbobsCOM.UserTablesMD
 oUserTablesMD = oCompany.GetBusinessObject (SAPbobsCOM.BoObjectTypes.oUserTables)

I receive error on the seccond line:

Object reference not set to an instance of an object.

Any idea how to solve it? Thanks.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 07:22 AM

    Hi

    please check your company object. i think that is not instantiated.

    place the following code before Second line

    if oCompany= nothing then

    MsgBox("not Connected to Company")

    End if

    oUserTablesMD = oCompany.GetBusinessObject (SAPbobsCOM.BoObjectTypes.oUserTables)

    if you get the message means your company object is not instantiated.

    Regrads

    Vishnu

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi

      please try with this code

      Dim objCompany As SAPbobsCOM.Company

      Dim strCookie As String

      Dim strCookieContext As String

      objCompany = New SAPbobsCOM.Company

      strCookie = objCompany.GetContextCookie

      strCookieContext = SBOApplication.Company.GetConnectionContext(strCookie)

      objCompany.SetSboLoginContext(strCookieContext)

      If objCompany.Connect <> 0 Then

      strLastError = "Connection Error"

      SBOApplication.StatusBar.SetText("Connection Error", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)

      Return Nothing

      End it

      Hope this helps you

      Regards

      Vishnu

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.