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.
Hi Paul
Did you finally got the solution on how to create a material revaluation based on batches through DI API?
I have checked the MaterialRevaluationSNBService but I don't have found a clear example how to use it. In addition, in DTW there is no template for this (only the template for the FIFO Layer).
Do you know if DI API actually support the material revaluation based on batches?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please see this help.sap.com link:
Valuation For A Single Batch - Logistics General (LO) - SAP Library
Please see the paragraph starting "In the following exercises you will create two purchase orders with different prices for the same material. You then post the goods receipt to different batches. You then check the prices at plant level and batch level".
We considered this solution in a project and the pre-requisite material master data settings were nt in line with our business requirements. Hence we wrote custom code based on certain assumptions to calculate cost of a batch.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Paul
I would suggest checking with SAP on the following:
MaterialRevaluationSNBService Class
This is listed as an object in the REFDI help file, but I cannot see it listed anywhere in the DI API. The FIFO one is there. I am using 9.1 PL07. I also checked under the CompanyService.
Kind regards
Peter Juby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
100 | |
8 | |
6 | |
6 | |
5 | |
5 | |
5 | |
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.