Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
About Inventory Revaluation:

If your company runs a perpetual inventory system, you may need to perform inventory revaluation. It is also known as “Material Revaluation”. Valuation is based on the calculation methods like Moving Average, Standard, FIFO, or Serial/Batch.

For more information on Inventory Revaluation, you can refer to following link:

http://help.sap.com/saphelp_sbo92/helpdata/en/45/2365519e152b31e10000000a1553f7/content.htm?frameset...

Inventory Revaluation/Material Revaluation in SAP Business One DI API:

“MaterialRevaluation” is a business object that enables you to update the items' price (average price or standard price only), revaluate the stock, and create journal entries accordingly.

This object applies only to the companies that manage their stock using Continuous Stock system.

Below are some samples to use this object in DI API:

Add a Material Revaluation Document for the Items managed by 'Batches' and having Valuation method as 'Serial/Batch' using DI API:
SAPbobsCOM.MaterialRevaluation oMaterialRevaluation = default(SAPbobsCOM.MaterialRevaluation);
SAPbobsCOM.SNBLines oMaterialRevaluationSNBLines = default(SAPbobsCOM.SNBLines);
oMaterialRevaluation = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oMaterialRevaluation);
oMaterialRevaluation.DocDate = System.DateTime.Now;
oMaterialRevaluation.RevalType = "P";
oMaterialRevaluation.Comments = "Added through DIAPI";
oMaterialRevaluation.Lines.ItemCode = "TEST01";
oMaterialRevaluation.Lines.WarehouseCode = "02";
oMaterialRevaluation.Lines.RevaluationDecrementAccount = "_SYS00000000134";
oMaterialRevaluation.Lines.RevaluationIncrementAccount = "_SYS00000000135";
oMaterialRevaluationSNBLines = oMaterialRevaluation.Lines.SNBLines;
oMaterialRevaluationSNBLines.SetCurrentLine(0);
oMaterialRevaluationSNBLines.SnbAbsEntry = 80; //AbsEntry from OBTN Table
oMaterialRevaluationSNBLines.NewCost = 900;
oMaterialRevaluationSNBLines.Add();
oMaterialRevaluationSNBLines.SetCurrentLine(1);
oMaterialRevaluationSNBLines.SnbAbsEntry = 81; //AbsEntry from OBTN Table
oMaterialRevaluationSNBLines.NewCost = 1000;
int RetVal = oMaterialRevaluation.Add();
if (RetVal != 0)
{
oCompany.GetLastError(out RetVal, out ErrStr);
MessageBox.Show(ErrStr.ToString().Trim());
}
else
{
oMaterialRevaluation.SaveXML(@"C:\MYFOLDER\MaterialRevaluation.xml");
}

Add a Material Revaluation Document for the Items managed by 'Serial Numbers' and having Valuation method as 'Serial/Batch' using DI API:
SAPbobsCOM.MaterialRevaluation oMaterialRevaluation = default(SAPbobsCOM.MaterialRevaluation);
SAPbobsCOM.SNBLines oMaterialRevaluationSNBLines = default(SAPbobsCOM.SNBLines);
oMaterialRevaluation = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oMaterialRevaluation);
oMaterialRevaluation.DocDate = System.DateTime.Now;
oMaterialRevaluation.RevalType = "P";
oMaterialRevaluation.Comments = "Added through DIAPI";
oMaterialRevaluation.Lines.ItemCode = "MYITEM";
oMaterialRevaluation.Lines.WarehouseCode = "01";
oMaterialRevaluationSNBLines = oMaterialRevaluation.Lines.SNBLines;
oMaterialRevaluationSNBLines.SetCurrentLine(0);
oMaterialRevaluationSNBLines.SnbAbsEntry = 587; //AbsEntry from OSRN
oMaterialRevaluationSNBLines.NewCost = 15;
oMaterialRevaluationSNBLines.Add();
int RetVal = oMaterialRevaluation.Add();

if (RetVal != 0)
{
oCompany.GetLastError(out RetVal, out ErrStr);
MessageBox.Show(ErrStr.ToString().Trim());
}
else
{
oMaterialRevaluation.SaveXML(@"C:\MYFOLDER\MaterialRevaluation.xml");
}

Add a Material Revaluation Document for the Item having Valuation method as 'FIFO' using DI API:
SAPbobsCOM.MaterialRevaluation oMaterialRevaluation = (SAPbobsCOM.MaterialRevaluation)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oMaterialRevaluation);
SAPbobsCOM.MaterialRevaluation_lines oMaterialRevaluationLines = oMaterialRevaluation.Lines;
SAPbobsCOM.FIFOLayers oFIFOLayers = oMaterialRevaluationLines.FIFOLayers;
SAPbobsCOM.CompanyService oCompanyService = (SAPbobsCOM.CompanyService)oCompany.GetCompanyService();
SAPbobsCOM.MaterialRevaluationFIFOService oMRVFIFOService = (SAPbobsCOM.MaterialRevaluationFIFOService)oCompanyService.GetBusinessService(SAPbobsCOM.ServiceTypes.MaterialRevaluationFIFOService);
SAPbobsCOM.MaterialRevaluationFIFOParams oMRVFIFOParam = (SAPbobsCOM.MaterialRevaluationFIFOParams)oMRVFIFOService.GetDataInterface(SAPbobsCOM.MaterialRevaluationFIFOServiceDataInterfaces.mrfifosMaterialRevaluationFIFOParams);
SAPbobsCOM.MaterialRevaluationFIFO oMRVFIFO;

oMaterialRevaluation.DocDate = DateTime.Now;
oMaterialRevaluation.RevalType = "P";
oMaterialRevaluationLines.SetCurrentLine(0);
oMaterialRevaluationLines.ItemCode = "TEST2";
oMRVFIFOParam.ItemCode = "TEST2";
oMRVFIFOParam.LocationCode = "01";
oMRVFIFOParam.LocationType = "64";
oMRVFIFOParam.ShowIssuedLayers = SAPbobsCOM.BoYesNoEnum.tNO;
oMRVFIFO = oMRVFIFOService.GetMaterialRevaluationFIFO(oMRVFIFOParam);
oFIFOLayers.LayerID = oMRVFIFO.Layers.Item(0).LayerID;
oFIFOLayers.TransactionSequenceNum = oMRVFIFO.Layers.Item(0).TransactionSequenceNum;
oFIFOLayers.Price = 60;
int LayerNum = oMRVFIFO.Layers.Count;

for (int i = 1; i < LayerNum; ++i)
{
oFIFOLayers.Add();
oFIFOLayers.SetCurrentLine(i);
oFIFOLayers.LayerID = oMRVFIFO.Layers.Item(i).LayerID;
oFIFOLayers.TransactionSequenceNum = oMRVFIFO.Layers.Item(i).TransactionSequenceNum;
oFIFOLayers.Price = 60;
}
int Add = oMaterialRevaluation.Add();
8 Comments