PdcMaterialFile.WriteOff: Difference between revisions
No edit summary |
No edit summary |
||
Line 25: | Line 25: | ||
<source lang="vb"> | <source lang="vb"> | ||
dim strCalcNo | |||
dim strMatPos | |||
dim lngMatID | |||
dim strMatNo | |||
dim strStockID | |||
dim dblQnty | |||
strCalcNo = "01483" | |||
strMatPos = "0001" | |||
lngMatID = 2118 | |||
strMatNo = "BU.050.050.RVS309" | |||
strStockID = 7 | |||
dblQnty = 10 | |||
if pdc.MasterData.MaterialFile.WriteOff(strCalcNo, strMatPos, lngMatID, strMatNo, strStockID, dblQnty) then | |||
msgbox "Het is gelukt." | |||
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. |
Revision as of 08:12, 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
Adjust a material's sourcing strategy.
dim strCalcNo
dim strMatPos
dim lngMatID
dim strMatNo
dim strStockID
dim dblQnty
strCalcNo = "01483"
strMatPos = "0001"
lngMatID = 2118
strMatNo = "BU.050.050.RVS309"
strStockID = 7
dblQnty = 10
if pdc.MasterData.MaterialFile.WriteOff(strCalcNo, strMatPos, lngMatID, strMatNo, strStockID, dblQnty) then
msgbox "Het is gelukt."
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.