PdcMaterialFile.WriteOff: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 7: Line 7:
== Notes ==
== Notes ==
CalcNo  = Calculation number (DO_ORDNR).<br/>
CalcNo  = Calculation number (DO_ORDNR).<br/>
MatPos  = Material position (DM_POS).<br/>
MatPos  = Material position in the calculation (DM_POS).<br/>
MatID    = Material ID (DM_ID).<br/>
MatID    = Material ID in the calculation (DM_ID).<br/>
MatNo    = Material number (DM_MATN).<br/>
MatNo    = Material number (LM_MATN).<br/>
StockID  = The stockline ID (LMV_ID.<br/>
StockID  = The stockline ID (LMV_ID).<br/>
Quantity = The quantity to write off.<br/>
Quantity = The quantity to write off.<br/>


Line 22: Line 22:


== Code example ==
== Code example ==
Adjust a material's  sourcing strategy.
Write off 10 m of material "BU.050.050.RVS309" on calculation "01483".


<source lang="vb">
<source lang="vb">
Sub btn_SelectMatNrClick(Sender)
dim strCalcNo
  edt_MatNr.Text = pdc.ChooseRecord(36, "", "")
dim strMatPos
End Sub
dim lngMatID
dim strMatNo
dim strStockID
dim dblQnty


Sub btn_CheckSourcesClick(Sender)
  strCalcNo  = "01483"
dim booResult
   strMatPos = "0001"
dim booStock
  lngMatID  = 0
   booStock = (GetAnyField("LM_MAT", "LM_MATN", edt_MatNr.Text, "LM_VR") = "J")
  strMatNo  = "BU.050.050.RVS309"
   booResult = pdc.MasterData.MaterialFile.CheckSourceFPart(edt_MatNr.Text, booStock)
  strStockID = 7
  msgbox "CheckSourceFPart = " & booResult
   dblQnty    = 10
End Sub
  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 Jsnuary 2013 (4.3).
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.