Add Method (BomItemSubst)
- Last UpdatedNov 06, 2025
- 6 minute read
The Add() method adds a new BOM item substitute record to the Bom_Item_Substitute table.
'Declaration
Public Shared Sub Add( _
ByVal sessionId As Integer, _
ByVal parentItemId As String, _
ByVal verId As String, _
ByVal bomPos As Integer, _
ByVal altNo As Integer, _
ByVal pref As Integer, _
ByVal substLevel As Integer, _
ByVal itemId As String, _
ByVal reqdGradeCd As DBInt, _
ByVal instruction As DBString, _
ByVal qtyPerParentItem As Double, _
ByVal maxQtyPerParentItem As DBDouble, _
ByVal minQtyPerParentItem As DBDouble, _
ByVal updateInv As Nullable(Of Boolean), _
ByVal backflush As Nullable(Of Boolean), _
ByVal defReasCd As DBInt, _
ByVal defLotNo As DBString, _
ByVal defSubLotNo As DBString, _
ByVal defStorageEntId As DBInt, _
ByVal defRejectEntId As DBInt, _
ByVal scalingFactor As DBDouble, _
ByVal mustConsumeFromInv As Nullable(Of Boolean), _
ByVal mayChooseAltInvLoc As Nullable(Of Boolean), _
ByVal mayCreateNewLots As Nullable(Of Boolean), _
ByVal mustConsumeFromWip As Nullable(Of Boolean), _
ByVal mustConsumeBeforeProd As Nullable(Of Boolean), _
ByVal constantQty As Nullable(Of Boolean), _
ByVal estTime As DBDouble, _
ByVal spare1 As DBString, _
ByVal spare2 As DBString, _
ByVal spare3 As DBString, _
ByVal spare4 As DBString, _
ByVal lastEditComment As DBString, _
ByRef lastEditAt As Date _
)
'Usage
Dim sessionId As Integer
Dim parentItemId As String
Dim verId As String
Dim bomPos As Integer
Dim altNo As Integer
Dim pref As Integer
Dim substLevel As Integer
Dim itemId As String
Dim reqdGradeCd As DBInt
Dim instruction As DBString
Dim qtyPerParentItem As Double
Dim maxQtyPerParentItem As DBDouble
Dim minQtyPerParentItem As DBDouble
Dim updateInv As Nullable(Of Boolean)
Dim backflush As Nullable(Of Boolean)
Dim defReasCd As DBInt
Dim defLotNo As DBString
Dim defSubLotNo As DBString
Dim defStorageEntId As DBInt
Dim defRejectEntId As DBInt
Dim scalingFactor As DBDouble
Dim mustConsumeFromInv As Nullable(Of Boolean)
Dim mayChooseAltInvLoc As Nullable(Of Boolean)
Dim mayCreateNewLots As Nullable(Of Boolean)
Dim mustConsumeFromWip As Nullable(Of Boolean)
Dim mustConsumeBeforeProd As Nullable(Of Boolean)
Dim constantQty As Nullable(Of Boolean)
Dim estTime As DBDouble
Dim spare1 As DBString
Dim spare2 As DBString
Dim spare3 As DBString
Dim spare4 As DBString
Dim lastEditComment As DBString
Dim lastEditAt As Date
BomItemSubst.Add(sessionId, parentItemId, verId, bomPos, altNo, pref, substLevel, itemId, reqdGradeCd, instruction, qtyPerParentItem, maxQtyPerParentItem, minQtyPerParentItem, updateInv, backflush, defReasCd, defLotNo, defSubLotNo, defStorageEntId, defRejectEntId, scalingFactor, mustConsumeFromInv, mayChooseAltInvLoc, mayCreateNewLots, mustConsumeFromWip, mustConsumeBeforeProd, constantQty, estTime, spare1, spare2, spare3, spare4, lastEditComment, lastEditAt)
public static void Add(
int sessionId,
string parentItemId,
string verId,
int bomPos,
int altNo,
int pref,
int substLevel,
string itemId,
DBInt reqdGradeCd,
DBString instruction,
double qtyPerParentItem,
DBDouble maxQtyPerParentItem,
DBDouble minQtyPerParentItem,
Nullable<bool> updateInv,
Nullable<bool> backflush,
DBInt defReasCd,
DBString defLotNo,
DBString defSubLotNo,
DBInt defStorageEntId,
DBInt defRejectEntId,
DBDouble scalingFactor,
Nullable<bool> mustConsumeFromInv,
Nullable<bool> mayChooseAltInvLoc,
Nullable<bool> mayCreateNewLots,
Nullable<bool> mustConsumeFromWip,
Nullable<bool> mustConsumeBeforeProd,
Nullable<bool> constantQty,
DBDouble estTime,
DBString spare1,
DBString spare2,
DBString spare3,
DBString spare4,
DBString lastEditComment,
out DateTime lastEditAt
)
Parameters
- sessionId
Required. Holds the session ID and thus the user who is making this method call.
- parentItemId
Required. Holds the ID of the parent item being made.
- verId
Required. Holds the ID of the BOM version.
- bomPos
Required. Holds the BOM position (usually sequential). For by-products, this value is negative. For this item being produced, the BOM position is 0, in which case the item_id is the same as the parent_item_id.
- altNo
Required. Holds the alternative number for the BOM position.
- pref
Required. Holds the preference of the alternative starting at 1. Lower numbered alternatives are preferable to higher numbered ones.
- substLevel
Required. Holds the substitution level of the user. The default is 0.
- itemId
Required. Holds the ID of the substitute that is being consumed or produced.
- reqdGradeCd
Optional. Holds the grade code that is required for the BOM Item. If null, it is is disabled.
- instruction
Optional. Holds the instructions to consume or produce this item.
- qtyPerParentItem
Required. Holds the quantity of the item required per unit of the current parent item.
- maxQtyPerParentItem
Optional. Holds the maximum quantity required per unit of the current parent item.
- minQtyPerParentItem
Optional. Holds the minimum quantity required per unit of the current parent item.
- updateInv
Optional. Holds a flag that, if set to true, specifies that the inventory table is updated with item consumption The default is false.
- backflush
Optional. Holds a flag that, if set to true, specifies that the consumption is backflushed. The default is false.
- defReasCd
Optional. Holds the default consumption or production code for the item. If null, it defaults to the value specified for the entity on which this job is run.
- defLotNo
Optional. Holds the default lot number of the item. If null, it defaults to the lot specified for the entity on which the job is run.
- defSubLotNo
Optional. Holds the default sublot number of the item. If is null, it defaults to the sublot specified for the entity on which the job is run.
- defStorageEntId
Optional. Holds the default entity of the component, product, or byproduct. If null, it defaults to the default storage entity on which the job is run.
- defRejectEntId
Optional. Holds the ID of the reject production items. If null, the def_storage_ent_id is used.
- scalingFactor
Optional. Holds the scaling factor which is used to get the correct units from item dependent counts.
- mustConsumeFromInv
Optional. Holds a flag that, if set to true, specifies that the consumption should occur from inventory for the item. The default is false.
- mayChooseAltInvLoc
Optional. Holds a flag that, if set to true, specifies that the user can select alternate inventory locations when consuming or producing this item. The default is true.
- mayCreateNewLots
Optional. Holds a flag that, if set to true, specifies that the user can create new lots when consuming or producing this item. The Default is true.
- mustConsumeFromWip
Optional. Holds a flag that, if set to true, specifies that the lots consumed during a job must be limited to those lots produced to the item_inv table for the same work order in an upstream job. The default is false.
- mustConsumeBeforeProd
Optional. Holds a flag that, if set to true, specifies whether to prevent any production transactions until 'acceptable' quantities of BOM components have been consumed, as specified by the 'max_qty_per_parent_item' and 'min_qty_per_parent_item' fields. The default is false.
- constantQty
Optional. Holds a flag that, if set to true, specifies that the quantity of the item consumed is independent of the quantity of the parent item produced. The default is false.
- estTime
Optional. Holds the number of hours required to consume or produce the component per unit of BOM position zero.
- spare1
Optional. Holds the contents of the user-defined spare1 field.
- spare2
Optional. Holds the contents of the user-defined spare2 field.
- spare3
Optional. Holds the contents of the user-defined spare3 field.
- spare4
Optional. Holds the contents of the user-defined spare4 field.
- lastEditComment
Optional. Holds comments that describe why this record is being added.
- lastEditAt
Output. Holds the returned date and time when this record was added, for optimistic concurrency control. The lastEditAt parameter is used by other methods that modify or delete this type of record for optimistic concurrency control.
Observe the following input parameter rules:
-
Required non-DB* parameters: Must pass a value. Cannot be empty or null.
-
Optional non-DB* parameters: Either enter a value or pass a null. If passing a null and a default value has been defined, the default value will be used for the parameter.
-
Required DB* parameters: Must pass a value. To enter an empty value for the parameter, pass DB*.null (e.g., DBInt.null). " Optional DB* parameters: To enter no value for the parameter, pass DB*.null (e.g., DBInt.null). To use the default value for the parameter if one has been defined for the object being added, pass a null.