PdcMaterialFile.WriteOff: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 3: Line 3:


== Description ==
== Description ==
This method writes off a stock line (with certificate) for a specific material number on a calculation.
== Notes ==
CalcNo  = Calculation number (DO_ORDNR).<br/>
CalcNo  = Calculation number (DO_ORDNR).<br/>
MatPos  = Material position (DM_POS).<br/>
MatPos  = Material position (DM_POS).<br/>
Line 17: Line 20:
Write off a material with a different number than the forecast is possible.<br/>
Write off a material with a different number than the forecast is possible.<br/>
A stock history line is also created with this method.<br/>
A stock history line is also created with this method.<br/>
== 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 ==
== Code example ==

Revision as of 07:37, 20 June 2014

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 (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.

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).