Product creation in Ax2012 using code.

I have the scenario that i want to create the new product using code.When I am importing the excel this new product has to be created.Can any one please help me on this.I need the brief description for the object which we are using for the product creation in 2012.

Can we achieve this by using AXinventtable Class?

Hi Saju,

did u get any solution for creating product using code, can you please share it.

the same requirement is for me also.

Products have changed in AX 2012. They are a global definition, that is company-agnostic. EcoResProduct, EcoResProductTranslation should get you down the right path for creating those global definitions of a product ( number, name, search name, procurement category [EcoResProductCategory] , etc. )

Then, after that is created, you can release that as a EcoResDistinctProductVariant to a legal entity, which will place the data in the InventTable.

If you are creating products with configurations such as Config, Color, Size, then you will need to investigate Product Masters and product variants, and the releasing thereof.

We utilized the AIF for this task, over 10,000+ products imported in a few hours.

~S

Hi,

Public void SBS_Productcreate()
{
EcoResProductService erProdSvc;
EcoResEcoResProduct EcoResProd;
EcoResEcoResProduct_Product_distinct ProdMast;
EcoResEcoResProduct_Translation Translation;
EcoResEcoResProduct_Identifier Identifier;
EcoResEcoResProduct_ProductDimGroup ProdDimGroup;
EcoResEcoResProduct_Product_Distinct DistProd;
EcoResProduct ecoResProduct;
// Used for releasing Product
EcoResEcoResProduct_StorageDimGroup storageDimGroup;
// Used to assign Storage Dim Group
EcoResEcoResProduct_TrackingDimGroup trackingDimension;
// used to assign Tracking Dimension

erProdSvc = EcoResProductService::construct();
EcoResProd = new EcoResEcoResProduct();
ProdMast = new EcoResEcoResProduct_Product_distinct();

ttsBegin;
ProdMast.parmDisplayProductNumber(“Test84756”);
ProdMast.parmProductType(EcoResProductType::Item);
// Product is Item OR Service
ProdMast.parmSearchName(“Test84756”);
DistProd = new EcoResEcoResProduct_Product_Distinct();
Translation = ProdMast.createTranslation().addNew();
Translation.parmDescription (“Test Product1”);
Translation.parmLanguageId(“en-us”);
Translation.parmName (“Test Product1”);
Identifier = ProdMast.createIdentifier().addNew();
Identifier.parmProductNumber(“Test84756”);
//Code for adding Storage Dimension Group…
storageDimGroup = ProdMast.createStorageDimGroup().addNew();
storageDimGroup.parmProduct(“Test84756”);
storageDimGroup.parmStorageDimensionGroup(“BD2”);
// Code for adding Tracking Dimension Group…
trackingDimension = ProdMast.createTrackingDimGroup().addNew();
trackingDimension.parmProduct(“Test84756”);
trackingDimension.parmTrackingDimensionGroup(“BD2”);

EcoResProd.createProduct().add(ProdMast);
erProdSvc.create(EcoResProd);
info(“Test Product1 is created”);

// Code for releasing Product
ecoResProduct = EcoResProduct::findByProductNumber(“Test84756”);
EcoResProductReleaseManagerBase::releaseProduct(ecoResProduct.RecId,CompanyInfo::findDataArea(“bd2”).RecId);
ttsCommit;
}

Hi Silvano,

Thanks for your reply.I need more description of EcoresProduct,EcoresproductTranslation object.