on 12-04-2007 7:00 AM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Vishynu,
you are true, the object isn`t instantiated. It is no problem to make connection as
oCompany.CompanyDB =
oCompany.UserName =
oCompany.Password =
lRetCode = oCompany.Connect
but is there some possibility to connect through DI without specification of db, name and pswd - the same way as in UI - connect to running instance of SAP?
Hi Petr,
You can connect to the running instance of SAP using the credentials for the UI as you would normally and then just use the DI connection. You can find an example of this (called Single Sign On) in this example:
C:\Program Files\SAP\SAP Business One SDK\Samples\COM UI DI\VB.NET\HelloWorld\2003
Hope it helps,
Adele
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
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
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.