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

Howto add/update data in UDT/UDF?

I generated own UDT+UDF using the Metadata-Objects in C# and with SAPBO 6.50.52 SP00 EF08 and succeeded in reading some predefined data (inserted into the table with SAP-BO) via a



recordSet.Item(<index>).Value, which I then assign to the UserDataSource-Items on a form.

But how can I add values on our own from within the app? If I set the values with


the operation crashes, although the documentation states Item.Value as a read/write-property.

I know that I can update data using

recordSet.doQuery("UPDATE [@MYTABLE] SET MYCOL1='X', MYCOL2='Y' WHERE MYTABLE=<CODE>". But as using SQL is not recommended, I'd rather liked to use other ways to acess our UDTs. Also the recordSets are kind of slow because they load all data, so I wished for another method to read our data.

Thx, Ch. Becker

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 19, 2004 at 09:07 AM

    There is a UserTable object that can be used to interact with the data on user tables. This has code and name properties and a userfields collection that can be used to read/write the data. Ive included a small sample below.


    Dim sboUserTable As SAPbobsCOM.UserTable

    Set sboUserTable = sboCompany.UserTables(strTable)

    sboUserTable.Code = "MyCode"

    sboUserTable.Name = "MyDesc"

    sboUserTable.UserFields("U_MYFIELD").Value = "UDF Field Value"


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks. Same code in C# looks a bit different but works very good. I must have had something wrong.

      SAPbobsCOM.UserTables tbls = company.UserTables;

      SAPbobsCOM.UserTable tbl = tbls.Item(strTable);

      tbl.Code = "MyCode";

      tbl.Name = "MyName";

      tbl.UserFields.Fields.Item("U_MYFIELD").Value = "UDF Field Value";

      Message was edited by: Christian Becker