Skip to Content

How to create BOM in ByD programmatically?

Hi,

Please, could you give a simple example of creating BOM (BO ProductionBillOfMaterial) in ABSL?

Thank you.

Aleksei

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Aug 22, 2017 at 07:02 AM

    A simple example:

    // Create New BOM
    var productionbillofmaterialData : elementsof  ProductionBillOfMaterial;
    productionbillofmaterialData.ID.content = "100009";
    var productionbillofmaterial = ProductionBillOfMaterial.Create ( productionbillofmaterialData );
    
    var descriptionData : elementsof  ProductionBillOfMaterial.Description;
    descriptionData.Description.content = "BOM Test2";
    var description = productionbillofmaterial.Description.Create ( descriptionData );
    
    var variantData : elementsof  ProductionBillOfMaterial.Variant;
    variantData.ID = "VAR1";
    variantData.Quantity.content = 1;
    variantData.Quantity.unitCode = "EA";
    variantData.MaterialKey.ProductID.content = "P100709";
    var variant = productionbillofmaterial.Variant.Create ( variantData );
    
    var variantdescriptionData : elementsof  ProductionBillOfMaterial.Variant.VariantDescription;
    variantdescriptionData.Description.content = "VAR1 Test2";
    var variantdescription = variant.VariantDescription.Create ( variantdescriptionData );
    
    var itemgroupData : elementsof ProductionBillOfMaterial.ItemGroup;
    itemgroupData.ID = "1";
    itemgroupData.MultipleSelectionAllowedIndicator = true;
    var itemgroup = productionbillofmaterial.ItemGroup.Create ( itemgroupData );
    
    var itemgroupitemData : elementsof itemgroup.ItemGroupItem;
    
    itemgroupitemData.ID = "1";
    var itemgroupitem = itemgroup.ItemGroupItem.Create ( itemgroupitemData );
    
    var itemgroupitemchangestateData : elementsof itemgroupitem.ItemGroupItemChangeState;
    itemgroupitemchangestateData.MaterialKey.ProductID.content = "P100213";
    itemgroupitemchangestateData.Quantity.content = 2;
    itemgroupitemchangestateData.Quantity.unitCode = "EA";
    itemgroupitemchangestateData.EngineeringChangeOrderID.content = newECO; // "1"
    var itemgroupitemchangestate = itemgroupitem.ItemGroupItemChangeState.Create ( itemgroupitemchangestateData );
    
    itemgroupitemData.ID = "2";
    itemgroupitem = itemgroup.ItemGroupItem.Create ( itemgroupitemData );
    
    itemgroupitemchangestateData.MaterialKey.ProductID.content = "P110801";
    itemgroupitemchangestateData.Quantity.content = 3;
    itemgroupitemchangestateData.Quantity.unitCode = "EA";
    itemgroupitemchangestateData.EngineeringChangeOrderID.content = "1";
    itemgroupitemchangestate = itemgroupitem.ItemGroupItemChangeState.Create ( itemgroupitemchangestateData );
    

    Best regards,

    Aleksei

    Add comment
    10|10000 characters needed characters exceeded