PdcMaterialFile.WriteOff
Declaration
WriteOff(CalcNo as String, MatPos as String, MatID as long, MatNo as string, StockID as long, Quantity as double) as Boolean
Description
CalcNo = Calculation number (DO_ORDNR).
MatPos = Material position (DM_POS).
MatID = Material ID (DM_ID).
MatNo = Material number (DM_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.
Notes
When changing a material's stock strategy in PdC, user is presented with the option to adjust all Fparts the material is incorporated in. This function executes that functionality from vbScript. Note that any checks required for setting a material to non-stocked (outstanding reservation, purchase order lines and existing stock position) need to be carried out in the script it self!
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).