Hello Everyone,
Below is a sample C# code I wrote for updating an existing Item Batches properties for SAP 9.1.
private static void BatchUpdate()
{
SAPbobsCOM.CompanyService oCompanyService;
oCompanyService = oCompany.GetCompanyService();
SAPbobsCOM.BatchNumberDetailsService oBatchNumbersService;
oBatchNumbersService = oCompanyService.GetBusinessService(SAPbobsCOM.ServiceTypes.BatchNumberDetailsService);
SAPbobsCOM.BatchNumberDetailParams oBatchNumberDetailParams;
oBatchNumberDetailParams = oBatchNumbersService.GetDataInterface(SAPbobsCOM.BatchNumberDetailsServiceDataInterfaces.bndsBatchNumberDetailParams);
try
{
int docentry = 81; //Put here the actual AbsEntry of the Batchnumber record from table OBTN
oBatchNumberDetailParams.DocEntry = docentry;
SAPbobsCOM.BatchNumberDetail oBatchNumberDetail;
oBatchNumberDetail = oBatchNumbersService.Get(oBatchNumberDetailParams);
oBatchNumberDetail.BatchAttribute1 = "W1F";
oBatchNumberDetail.UserFields.Item("U_PalletID").Value = "45109-07";
oBatchNumbersService.Update(oBatchNumberDetail);
System.Runtime.InteropServices.Marshal.ReleaseComObject(oBatchNumberDetail);
}
catch (Exception e)
{
gApp.MessageBox("An unknown error occurred in method BatchUpdate.\n\n" + e.ToString(), 1, "Ok", "", "");
}
finally
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(oCompanyService);
System.Runtime.InteropServices.Marshal.ReleaseComObject(oBatchNumbersService);
System.Runtime.InteropServices.Marshal.ReleaseComObject(oBatchNumberDetailParams);
}
}
Hope this helps some of you
Regards,
Krishnan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |