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=/en/44/c4c1cd7ca22e17e10000000a114a6b/frameset.htm&current_toc=/en/b1/8fe14910cf46b9b2ff2de2f315e5a2/plain.htm&node_id=1698&show_children=false

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();
To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply