cancel
Showing results for 
Search instead for 
Did you mean: 

How to create BOM in ByD programmatically?

abelousov
Active Participant

Hi,

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

Thank you.

Aleksei

Accepted Solutions (1)

Accepted Solutions (1)

abelousov
Active Participant

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

kostadin_terziev
Participant
0 Kudos

Thank you for the example abelousov .

Do we have to create Engineering change order before creating the BoM or is it automatically created?

Regards,

Kostadin

Answers (0)