PdcMaterialFile.WriteOff

From External Bemet Wiki
Revision as of 07:38, 20 June 2014 by TC (talk | contribs)
Jump to navigation Jump to search

Declaration

WriteOff(CalcNo as String, MatPos as String, MatID as long, MatNo as string, StockID as long, Quantity as double) as Boolean

Description

This method writes off a stock line (with certificate) for a specific material number on a calculation.

Notes

CalcNo = Calculation number (DO_ORDNR).
MatPos = Material position in the calculation (DM_POS).
MatID = Material ID in the calculation (DM_ID).
MatNo = Material number (LM_MATN).
StockID = The stockline ID (LMV_ID).
Quantity = The quantity to write off.

This sets of parameters writes off a quantity on a calculation:
1. You have to apply the parameters CalcNo, MatPos, MatNo, StockID and Quantity.
2. You have to apply the parameters MatID, MatNo, StockID and Quantity.

This method writes off the quantity and deduct the existing reservation. The reservation is removed when the remaining quantity is zero.
Write off a material with a different number than the forecast is possible.
A stock history line is also created with this method.

Code example

Adjust a material's sourcing strategy.

Sub btn_SelectMatNrClick(Sender)
  edt_MatNr.Text = pdc.ChooseRecord(36, "", "")
End Sub

Sub btn_CheckSourcesClick(Sender)
dim booResult
dim booStock
  booStock  = (GetAnyField("LM_MAT", "LM_MATN", edt_MatNr.Text, "LM_VR") = "J")
  booResult = pdc.MasterData.MaterialFile.CheckSourceFPart(edt_MatNr.Text, booStock)
  msgbox "CheckSourceFPart = " & booResult
End Sub

Availability

Available since Jsnuary 2013 (4.3).