cancel
Showing results for 
Search instead for 
Did you mean: 

Writing Data to Usertable

Former Member
0 Kudos

I just started with the SDK for SBO.

One of the examples is called Matrix

I fooled around with it. I understand how to get data from a

UserTable and place it in the Matrix. But I want to Save the

changed data to my User table.

Is there a way to Save the Data in DBDatasource to a UserTable?

I Already looked around on this forum but, I did not find a solution.

Some can provide me with some sample code?

Thanks

Michiel Kramer

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thank you for your quick response.

I understand your sample code. But I cannot access "SAPbobsCOM"

I'm using VisualStudio now (I'm originaly a Delhpi developer) can you explain me how to add "SAPbobscom" to my project in Visual Studio.

I cannot find a place to add a package or namespace.

Thank you

Michiel Kramer

Former Member
0 Kudos

You need to install the DI.

normally, if you go with the explorer under the install folder of BO, you can find the DI folder

it's something like

C:\Program Files\SAP Manage\SAP Business One\SBO_SHR\SBODIAPI

just be careful, if you updated the PL of Business One, you have to install not the DI I just told you, but the DI that was with the update file.

once the API installed, go in VS, in the Solution explorer, right click on references, add a references, and you'll find it in the COM tab

HTH

Sebastien

Answers (3)

Answers (3)

Former Member
0 Kudos

I found it....

I feel stupid, I had to use Add Reference...

Sorry, for this stupid question.

Michiel Kramer

Former Member
0 Kudos

Hello Michiel, welcome to this forum

if you want to save the data to the table, you have to use a DI object.

if you want to save data in a usertable, use the UserTable object

dim oUserTable  as SAPbobsCOM.SAPUserTable
oUserTable=oCompany.UserTables.Item("Name of the table")
oUserTable.Code=oDBDatasource.GetValue("Code",oDBDatasource.Offset)
oUserTable.Name=oDBDatasource.GetValue("Name",oDBDatasource.Offset)
oUserTable.UserFields.Fields.Item.("U_MyField").Value=oDBDatasource.GetValue("U_MyField",oDBDatasource.Offset)
oUserTable.Add

in case it's not a usertable, but a BO object like Business Partner, you'll have to use the good DI object

BusinessPartners

AdKerremans
Active Contributor
0 Kudos

You have to read all rows of the matrix and update the table using the recordset object