# Transfer-Boms This function is executed when clicking the "Transfer" button within the {ref}`BOM Tab `.\ All the [BOMs](/code_reference/commandlets/show-bomwindow/objects/bom) from the BOM Window can be transferred to ERP. ## Syntax ```powershell Transfer-Boms [-Boms] > ``` ## Parameters | Type | Name | Description | input/output | Mandatory | Default value | |--------------------------------------------------------------------|------|-------------------------------------|--------------|-----------|---------------| | [Bom](/code_reference/commandlets/show-bomwindow/objects/bom) \[\] | Boms | The BOMs which should be transfered | input | yes | | ## Return type **void** ## Remarks Each **unique** [BOM](/code_reference/commandlets/show-bomwindow/objects/bom) shown in the BOM Window with another [](/bom_window/status) then *Unknown* is passed to this function. It's recommended to update the [](/bom_window/status) of all the BOMs and their rows with the [](/code_reference/commandlets/show-bomwindow/commandlets/update-bomwindowentity) cmdlet. When an exception is thrown within this function, the BOM Window {ref}`shows the Exception ` message of the terminated Transfer operation.\ The [](/bom_window/status) of all the [BOMs](/code_reference/commandlets/show-bomwindow/objects/bom) and their *Children* that where not updated, gets automatically changed to *Unknown*. ## Examples **Creating all the Item BOMs with Status "New" in ERP. When adding succeeds the Status and StatusDetails gets updated to "Identical" otherwise to "Error":** ```powershell function Transfer-Boms($boms) { foreach($vaultBom in $boms) { if($bom._Status -eq 'New'){ $result = Add-ERPObject -EntitySet 'Boms' -Properties @{ 'ParentNumber'= $bom._PartNumber 'Children' = @( $bom.Children | foreach-object { @{ 'ParentNumber' = $parentNumber 'ChildNumber' = $_.Bom_Number 'Position' = [int]($_.Bom_PositionNumber) 'Quantity' = $_.Bom_Quantity }}) } if($result){ $bom | Update-BomWindowEntity -Status 'Identical' -StatusDetails 'Successfully transfered Bom' } else { $bom | Update-BomWindowEntity -Status 'Error' -StatusDetails 'Error occured when transfering Bom' } } } } ``` **Updating all BomRows with the Status "Different" in ERP and setting Status and StatusDetails on the according row:** ```powershell function Transfer-Boms($boms) { foreach($vaultBom in $boms) { foreach($bomRow in $bom.Children){ if($bomRow._Status -eq 'Different'){ if((Update-ERPObject -EntitySet 'BomItems' -Keys $bomItem._Keys -Properties $bomItem._Properties)){ $bomRow | Update-BomWindowEntity -Status 'Identical' -StatusDetails 'Successfully updated BomRow' } else { $bomRow | Update-BomWindowEntity -Status 'Error' -StatusDetails 'Error occured when updating BomRow' } } } } } ```