PdcAllocation.WriteOff
Jump to navigation
Jump to search
Declaration
WriteOff() as Boolean
Description
Writes off the allocation in PdC.
Notes
Important: Only materials with the write-off-setting set to WriteOffComplete can be written off using scripts. When changing this setting to WriteOffComplete, it has to be done before the calculation is given into production or else the material can’t be written of.
The WriteOffComplete, WriteOffPropPreCalc and WriteOffPropRes properties have been made public on pdcMaterial in order to change them through scripting.
Code example
The following code example creates a new allocation and sets the properties. If the save goes wrong it will show the PDC.LastError.
dim alloc
Set alloc = PDC.Logistics.Allocations.New
alloc.MaterialID = 2075
alloc.MaterialNo = "ASSY3 SCHAW10"
alloc.Quantity = 4
alloc.LMV_ID = 111
alloc.ReservationID = 357
alloc.UseExistingAlloc = False
if alloc.Save() then
Label1.Caption = alloc.ReservationID
else
Label1.Caption = "error: " + PDC.LastError
end if
Availability
Available since May 2017 (from version 5.4)