Product Master data Import through Job

Dear Abbas,

Solved.

Thanks,

Waseem.

Dear Abbas,

when i import product master with this script

====================================================

private void multiLines()
{
info(“Multilines”);

select inventtable where inventtable.ItemId == itemId
join ecoResProductMaster where ecoResProductMaster.SearchName == searchName;

// Size
ecoResSize = ecoResSize::findByName(sizeId);
if (!ecoResSize)
{
ecoResSize.clear();
ecoResSize.initValue();
ecoResSize.Name = sizeId;
ecoResSize.insert();
}

// color
ecoResColor = ecoResColor::findByName(colorid);
if (!ecoResColor)
{
ecoResColor.clear();
ecoResColor.initValue();
ecoResColor.Name = colorid;
ecoResColor.insert();
}

info(strFmt(“Size %1”,ecoResSize.RecId));
info(strFmt(“ItemId %1”,ecoResProductMaster.RecId));
//Sizes assigned to product master
select ecoResProductMasterSize
where ecoResProductMasterSize.Size == ecoResSize.RecId
&& ecoResProductMasterSize.SizeProductMaster == ecoResProductMaster.RecId;
if(!ecoResProductMasterSize && sizeId != “”)
{
ecoResProductMasterSize.clear();
ecoResProductMasterSize.initValue();
ecoResProductMasterSize.Size = ecoResSize.RecId;
ecoResProductMasterSize.Description = sizeId;
ecoResProductMasterSize.SizeProductDimensionAttribute = EcoResProductDimensionAttribute::inventDimFieldId2DimensionAttributeRecId(fieldNum(InventDim, InventSizeId));
ecoResProductMasterSize.SizeProductMaster = ecoResProductMaster.RecId;
ecoResProductMasterSize.insert();
info(“masuk ecoResProductMasterSize”);
}

info(strFmt(“Color %1”,ecoRescolor.RecId));
//Color assigned to product master
select ecoResProductMasterColor
where ecoResProductMasterColor.Color == ecoRescolor.RecId
&& ecoResProductMasterColor.ColorProductMaster == ecoResProductMaster.RecId ;
if(!ecoResProductMasterColor && colorId != “”)
{
ecoResProductMasterColor.clear();
ecoResProductMasterColor.initValue();
ecoResProductMasterColor.Color = ecoRescolor.RecId;//.RecId;
ecoResProductMasterColor.Description = colorName;
ecoResProductMasterColor.ColorProductDimensionAttribute = EcoResProductDimensionAttribute::inventDimFieldId2DimensionAttributeRecId(fieldNum(InventDim, InventColorId));
ecoResProductMasterColor.ColorProductMaster = ecoResProductMaster.RecId;
ecoResProductMasterColor.insert();
info(“masuk ecoResProductMasterColor”);
}

//Product variant
ecoResDistinctProductVariant.clear();
ecoResDistinctProductVariant.initValue();
ecoResDistinctProductVariant.DisplayProductNumber = EcoResProductNumberBuilderVariant::buildFromProductNumberAndDimensions(EcoResProduct::find(InventTable.Product).productNumber(),EcoResProductVariantDimValue::getDimensionValuesContainer("",ecoResSize.Name,ecoResColor.Name,""));
ecoResDistinctProductVariant.SearchName = ecoResProductMaster.SearchName;// +ItemId/ConfigId/;
ecoResDistinctProductVariant.ProductType = ecoResProductMaster.ProductType;
ecoResDistinctProductVariant.ProductMaster = ecoResProductMaster.RecId;
ecoResDistinctProductVariant.RetaiTotalWeight = 1;
if(ecoResDistinctProductVariant.validateWrite())
{
info(“its validate ecoResDistinctProductVariant”);
ecoResDistinctProductVariant.insert();
}

info(“ecoResProductVariantSize”);
//Size variant configuration
ecoResProductVariantSize.clear();
ecoResProductVariantSize.initValue();
ecoResProductVariantSize.initFromDistinctProductVariant(ecoResDistinctProductVariant);
ecoResProductVariantSize.ProductDimensionAttribute = EcoResProductDimensionAttribute::inventDimFieldId2DimensionAttributeRecId(fieldNum(InventDim, InventSizeid));
ecoResProductVariantSize.Size = ecoResSize.RecId;
ecoResProductVariantSize.insert();

info(“ecoResProductVariantColor”);
//Color variant configuration
ecoResProductVariantColor.clear();
ecoResProductVariantColor.initValue();
ecoResProductVariantColor.initFromDistinctProductVariant(ecoResDistinctProductVariant);
ecoResProductVariantColor.ProductDimensionAttribute = EcoResProductDimensionAttribute::inventDimFieldId2DimensionAttributeRecId(fieldNum(InventDim, InventColorId));
ecoResProductVariantColor.Color = ecoResColor.RecId;
ecoResProductVariantColor.insert();

//Product variant translation
EcoResProductTranslation::createOrUpdateTranslation(ecoResDistinctProductVariant.RecId, searchName, searchName);

//Find newly created Product Variant
ecoResDistinctProductVariant = ecoResDistinctProductVariant::find(ecoResDistinctProductVariant.RecId);//RecId);

//Now release the Product variant
releaseManager = EcoResProductReleaseManagerBase::newFromProduct(ecoResDistinctProductVariant);
releaseManager.release();
select inventDim
where inventDim.InventSizeId == sizeId
&& inventDim.InventColorId == colorId;

inventDimCombination = inventDimCombination::find(itemid,inventDim.inventDimId);
inventItemBarCode.itemId = itemid;
inventItemBarCode.barcodeSetupId = “MRCPI”;//“EAN128”;
inventItemBarCode.inventDimId = inventDim.inventDimId;
inventItemBarCode.itemBarCode = barcodeId;
inventItemBarCode.RetailVariantId = inventDimCombination.RetailVariantId;
inventItemBarCode.useForInput = NoYes::Yes;
inventItemBarCode.useForPrinting = NoYes::Yes;
inventItemBarCode.UnitID = “Pcs”;
inventItemBarCode.insert();
}

====================================================

i have error this

" Database insert operation is not allowed on an abstract table. "

thanks

Kirom

Possible for you to send the tmp table XPO to me via email on mohdhussainaziz@yahoo.com

how to declare IT_TestImport? please show me the path thank you

Hi,

I have attached the XPO in this reply. Please import and let me know if you have any issues.

Br Ababs
PrivateProject_IT_Abs_InventImprt_25012013.zip (5.96 KB)

IT_TestImport is the new customized table which is used to temporarily holds the data before create the item in master.

I have attached the Project XPO with my previous message. Kindly check and compare with your object.

Br Abbas