Adding new record in user table via Dynamic Code
Hi there,
I created in SAP B1 two user tables (Master data and master data rows). I'd like to add a new header record in my master data user table via Dinamic Code (SDK).
This is my source code:
C#:
SAPbobsCOM.Company oCompany;
SAPbobsCOM.UserTable oUserTable;
oUserTable = (SAPbobsCOM.UserTable)company.UserTables.Item("My_Table");
oUserTable.Code = "1";
oUserTable.Name = "test";
oUserTable.Add() ;
but I have an exception error message: "SAP B1 Cannot add rows to a MasterData type UserTable"
I tryied another script using VB.Net
Dim oGeneralService As SAPbobsCOM.GeneralService
Dim oGeneralData As SAPbobsCOM.GeneralData
Dim CompService As SAPbobsCOM.CompanyService = Company.GetCompanyService()
oGeneralService = CompService.GetGeneralService("My_Table")
oGeneralData = oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralData)
oGeneralData.SetProperty("Code","1")
oGeneralService.Add(oGeneralData)
However, I got another error message: Exception has been thrown by the target of an invocation. - Service Not Found
Do you know if its possible to add lines in UDT?
Kind Regards,
David
-
Any idea on this?
Kind Regards.
David
Iniciar sesión para dejar un comentario.
Comentarios
2 comentarios