cancel
Showing results for 
Search instead for 
Did you mean: 

UserTables.Count = 0?????

Former Member
0 Kudos

Hi everybody,

When I execute this:

SAPbobsCOM.UserTables oUserTables = null;

oUserTables = DICompany.UserTables;

System.Windows.Forms.MessageBox.Show(oUserTables.Count.ToString());

and this message show me the text "0"

It could not be true because I had added 6 User tables!

Everything else works fine, user forms, user menu, user event handling...

Which one could be the reason?

Regards.

--

Enriquillo Guigni

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I had been searching for an other reason and I found that my Single Sign-On does not work fine:

- the DICompany doesn't connect

There is something bad with???

private bool Connect()

{

string ConnectionString = string.Empty;

string ConnectionContext = string.Empty;

string Cookie = string.Empty;

int RetCode = 0;

try

{

ConnectionString = Environment.GetCommandLineArgs().GetValue(1).ToString();

GuiApi = null;

GuiApi = new SAPbouiCOM.SboGuiApi();

GuiApi.Connect(ConnectionString);

SboApp = GuiApi.GetApplication(0);

DICompany = null;

DICompany = new SAPbobsCOM.Company();

Cookie = DICompany.GetContextCookie();

ConnectionContext = SboApp.Company.GetConnectionContext(Cookie);

if (DICompany.Connected)

{

DICompany.Disconnect();

}

}

catch (Exception Ex)

{

System.Windows.Forms.MessageBox.Show(Ex.Message, "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);

Environment.Exit(0);

}

RetCode = DICompany.SetSboLoginContext(ConnectionContext);

if (RetCode != 0)

{

return false;

}

else

{

SboApp.StatusBar.SetText("NcfAddOn connection success", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);

return true;

}

}

When I execute this:

oUTMD = (SAPbobsCOM.UserTablesMD)(DICompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserTables));

I got an error: You are not conected to a company....

Can you helpme?

--

Enriquillo Guigni

Former Member
0 Kudos

There was no DICompany.Connect();

Ex.

--

Enriquillo Guigni

Former Member
0 Kudos

Hi

I writed this code in my add-on


Dim i As Integer = SBO_Company.UserTables.Count
Console.WriteLine("SBO_Company.UserTables.Count=" & i.ToString)

Result in output console:


SBO_Company.UserTables.Count=80

Regards

Sierdna S.

Former Member
0 Kudos

I'm using SBO2007 SP00 PL30

I have a Profesional Licence.

I was using 2005 and I changed to 2007, I started from scrash on 2007 and I'm having this error on 2007.

It works fine over 2005, sorry I didn't Tell you.

--

Enriquillo Guigni

Nussi
Active Contributor
0 Kudos

Hi,

looks like you found a bug in 2007.

send this problem to SAP Bug report.

EDIT:

use this SELECT in a RecordSet as workarount

select count(*) from OUTB

lg David

Edited by: David Nussböck on Oct 6, 2008 5:03 PM

Nussi
Active Contributor
0 Kudos

Hi,

i tried it with both codes


Console.WriteLine(oCompany.UserTables.Count);


SAPbobsCOM.UserTables oUserTables = null;
oUserTables = oCompany.UserTables;
Console.WriteLine(oUserTables.Count.ToString());

and it worked for me -> correct number of UserTables.

iam tried it in SBO 2005 SP01 PL 39

just want to clarify that your code works, maybe it's a patch level problem

lg David