PdcMaterialFile.WriteOff: Difference between revisions
No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 22: | Line 22: | ||
== Code example == | == Code example == | ||
Write off 10 m of material "BU.050.050.RVS309" on calculation "01483". | |||
<source lang="vb"> | <source lang="vb"> | ||
dim strCalcNo | |||
dim strMatPos | |||
dim lngMatID | |||
dim strMatNo | |||
dim strStockID | |||
dim dblQnty | |||
strCalcNo = "01483" | |||
strMatPos = "0001" | |||
lngMatID = 0 | |||
strMatNo = "BU.050.050.RVS309" | |||
strStockID = 7 | |||
dblQnty = 10 | |||
if pdc.MasterData.MaterialFile.WriteOff(strCalcNo, strMatPos, lngMatID, strMatNo, strStockID, dblQnty) then | |||
msgbox "Write off completed." | |||
else | |||
msgbox pdc.LastError | |||
end if | |||
</source> | </source> | ||
== Availability == | == Availability == | ||
Available since 20 June 2014 (4.3 and 5.1). 5.1 onwards, this function is removed, because other functionality is build with other methods. | Available since 20 June 2014 (4.3 and 5.1). 5.1 onwards, this function is removed, because other functionality is build with other methods. |
Latest revision as of 08:13, 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 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
Write off 10 m of material "BU.050.050.RVS309" on calculation "01483".
dim strCalcNo
dim strMatPos
dim lngMatID
dim strMatNo
dim strStockID
dim dblQnty
strCalcNo = "01483"
strMatPos = "0001"
lngMatID = 0
strMatNo = "BU.050.050.RVS309"
strStockID = 7
dblQnty = 10
if pdc.MasterData.MaterialFile.WriteOff(strCalcNo, strMatPos, lngMatID, strMatNo, strStockID, dblQnty) then
msgbox "Write off completed."
else
msgbox pdc.LastError
end if
Availability
Available since 20 June 2014 (4.3 and 5.1). 5.1 onwards, this function is removed, because other functionality is build with other methods.