on 06-04-2018 6:34 PM
Good day experts,
I'm trying to add units of measurements Group Definition through SDK.
I have data on my OUGP table, and I want to add some data to the UGP1.
My code so far
SAPbobsCOM.IUnitOfMeasurementGroupsService uomg_service = _oCompany.GetCompanyService().GetBusinessService(SAPbobsCOM.ServiceTypes.UnitOfMeasurementGroupsService);
SAPbobsCOM.UnitOfMeasurementGroup uomg = uomg_service.GetDataInterface(SAPbobsCOM.UnitOfMeasurementGroupsServiceDataInterfaces.uomgsUnitOfMeasurementGroup);
SAPbobsCOM.UoMGroupDefinition collection = uomg_service.GetDataInterface(SAPbobsCOM.UnitOfMeasurementGroupsServiceDataInterfaces.uomgsUnitOfMeasurementGroup);
uomg.GroupDefinitions.Add();
uomg.GroupDefinitions.Item(coleccion).AlternateUoM = 3;
However this line of code works uomg.GroupDefinitions.Item(coleccion) for an existing item...
Also the SDK tells me for the add method that I must update the group definition parent
any ideas?
Hi alf.matute and delapec,
Add a UoM Group:
SAPbobsCOM.CompanyService oCompService = oCompany.GetCompanyService();
SAPbobsCOM.UnitOfMeasurementGroupsService oUoMGroupService = (SAPbobsCOM.UnitOfMeasurementGroupsService)oCompService.GetBusinessService(SAPbobsCOM.ServiceTypes.UnitOfMeasurementGroupsService);
SAPbobsCOM.UnitOfMeasurementGroup oUoMGroup = (SAPbobsCOM.UnitOfMeasurementGroup)oUoMGroupService.GetDataInterface(SAPbobsCOM.UnitOfMeasurementGroupsServiceDataInterfaces.uomgsUnitOfMeasurementGroup);
oUoMGroup.Code = "TEST";
oUoMGroup.Name = "TEST UOM";
oUoMGroup.BaseUoM = 9;
SAPbobsCOM.UnitOfMeasurementGroupParams oGrpParams = oUoMGroupService.Add(oUoMGroup);
Update an existing UoM Group:
SAPbobsCOM.CompanyService oComService = oCompany.GetCompanyService();
SAPbobsCOM.UnitOfMeasurementGroupsService oUmGrpService = oComService.GetBusinessService(SAPbobsCOM.ServiceTypes.UnitOfMeasurementGroupsService);
SAPbobsCOM.UnitOfMeasurementGroup oUomGroup = (SAPbobsCOM.UnitOfMeasurementGroup)oUmGrpService.GetDataInterface(SAPbobsCOM.UnitOfMeasurementGroupsServiceDataInterfaces.uomgsUnitOfMeasurementGroup);
SAPbobsCOM.UnitOfMeasurementGroupParams oUomParam = (SAPbobsCOM.UnitOfMeasurementGroupParams)oUmGrpService.GetDataInterface(SAPbobsCOM.UnitOfMeasurementGroupsServiceDataInterfaces.uomgsUnitOfMeasurementGroupParams);
oUomParam.AbsEntry = 4;
oUomGroup = oUmGrpService.Get(oUomParam);
oUomGroup.Code = "Test";
oUomGroup.Name = "Test2";
oUomGroup.BaseUoM = 8;
oUmGrpService.Update(oUomGroup);
Hope it helps!
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hola Luis, pudiste resolverlo?
Gracias!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.