Buenos días, me podrían ayudar, quiero ingresar datos desde una Aplicación DI API C# hacia una Tabla Definidas de Usuario, pero de Tipo DOCUMENTO Y FILA DE DOCUMENTO (cabezera detalle).
MI PRIMER INTENTO
No puedes usar ese método para agregar valores a una UserTable de tipo de Documento o Datos Daestros. El objeto UserTable solo funcionará para la tabla de tipo “Ningún Objeto”. Esto es una limitación en SAP B1 SDK.
Para hacerlo correctamente, deberás registrar la UDT como UDO y alli usar el Objeto GeneralService:
SAPbobsCOM.GeneralService oGeneralService = null;
SAPbobsCOM.GeneralData oGeneralData = null;
SAPbobsCOM.GeneralDataParams oGeneralParams = null;
SAPbobsCOM.CompanyService sCmp = null;
SAPbobsCOM.GeneralData oChild = null;
SAPbobsCOM.GeneralDataCollection oChildren = null;
sCmp = eCommon.oCompany.GetCompanyService();
try
{
oGeneralService = sCmp.GetGeneralService("UDOName");
// Get UDO record
oGeneralParams = ((SAPbobsCOM.GeneralDataParams)(oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams)));
oGeneralParams.SetProperty("DocEntry", DocEntryOfTheRecordToUpdate);
oGeneralData = oGeneralService.GetByParams(oGeneralParams);
// Add lines on UDO Child Table
oChildren = oGeneralData.Child("ChildTableNameWithout@");
// Create data for rows in the child table
oChild = oChildren.Add();
oChild.SetProperty("colUID", "TEST");
// Update an existing line
oChild = oChildren.Item(1);
oChild.SetProperty("colUID", "TEST");
//Update the UDO Record
oGeneralService.Update(oGeneralData);
}
catch (Exception ex)
{
SBO_Application.MessageBox(ex.Message, 1, "OK", null, null);
}
Muchas gracias, si tiene razón estaba intentando hacer el ingreso sin Crear el UDO en SAP, Directamente hacia las tablas. por lo que no podía usar Objeto GeneralService.
Un error de principiantes. Saludos y Mil gracias por su Ayuda