on 2016 Feb 08 3:43 PM
Hello,
Does anybody have a working example in creating a material revaluation based on batches ?
All I can find is about FIFO but we have to do this on a specific batch.
Thanks,
Paul
Hi,
This is the actual working code in c#
MaterialRevaluation oMaterialRevaluation = (MaterialRevaluation)SwissAddonFramework.B1Connector.GetB1Connector().Company.GetBusinessObject(BoObjectTypes.oMaterialRevaluation);
SAPbobsCOM.SNBLines oMaterialRevaluationSNBLines = default(SAPbobsCOM.SNBLines);
oMaterialRevaluation.DocDate = System.DateTime.Now;
oMaterialRevaluation.RevalType = "P";
oMaterialRevaluation.Comments = "Herwaardering batches";
oMaterialRevaluation.Lines.ItemCode = ItemCode;
oMaterialRevaluation.Lines.RevaluationDecrementAccount = reknr;
oMaterialRevaluation.Lines.RevaluationIncrementAccount = reknr;
oMaterialRevaluation.Lines.WarehouseCode = "01";
oMaterialRevaluation.Lines.Quantity = quantity;
oMaterialRevaluationSNBLines = oMaterialRevaluation.Lines.SNBLines;
oMaterialRevaluationSNBLines.SetCurrentLine(0);
oMaterialRevaluationSNBLines.BaseLine = 0;
oMaterialRevaluationSNBLines.SnbAbsEntry = Convert.ToInt32(rs.Fields.Item(0).Value);
if (Convert.ToDouble(rs.Fields.Item("SaldoBatch").Value) > 0)
{
double newprice = Convert.ToDouble(rs.Fields.Item("BatchPrijsM3").Value) + opslag;
oMaterialRevaluationSNBLines.NewCost = newprice;
TextOK("Nieuwe waarde : " + newprice);
}
if (oMaterialRevaluation.Add() != 0)
{
oMaterialRevaluation.SaveXML(@"c:\temp\omrv.xml");
TextError("batch hw");
}
else
TextOK("batch hw ok");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
105 | |
8 | |
6 | |
6 | |
5 | |
5 | |
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.