static void CreateEcoResProduct(Args _args)
{
EcoResEcoResProduct_TrackingDimGroup tracDimGroup;
EcoResEcoResProduct_Product_Master productMaster;
EcoResEcoResProduct_Product_Distinct distMaster;
EcoResEcoResProduct_ProductDimGroup prodDimGroup;
EcoResEcoResProduct_StorageDimGroup storDimGroup;
EcoResEcoResProduct_translation translation;
EcoResEcoResProduct_Identifier identifier;
EcoResProductService ecoProdSvc;
EcoResProductNumber lEcoResProductNumber;
NumberSequenceTable numberSequenceTable;
EcoResEcoResProduct ecoResProd;
EcoResProductType ecoResProductType;
boolean isMaster = false;
EcoResProductSearchName _ecmProductName;
EcoResProductSubtype prodSubType;
;
prodSubType = EcoResProductSubtype::ProductMaster;
_ecmProductName = " IDB test 09";
lEcoResProductNumber = "IDB -099";
try
{
// create product by initializing the Service object
ecoProdSvc = EcoResProductService::construct();
// initialize the EcoResEcoResProduct object
ecoResProd = new EcoResEcoResProduct();
// numberSequenceTable = EcoResProductParameters::numRefProductNumber().numberSequenceTable(); // Automated
// lEcoResProductNumber = NumberSeq::newGetNumFromId(numberSequenceTable.RecId).num(); // Automated
ecoResProductType = EcoResProductType::Item;
if(prodSubType == EcoResProductSubtype::ProductMaster)
{
isMaster = true;
//Create a new product master
productMaster = new EcoResEcoResProduct_Product_Master();
//initialize product master
productMaster.parmDisplayProductNumber(lEcoResProductNumber);
productMaster.parmProductType(ecoResProductType);
productMaster.parmSearchName(_ecmProductName);
productMaster.parmProductType(EcoResProductType::Service);
productMaster.parmVariantConfigurationTechnology(EcoResVariantConfigurationTechnologyType::PredefinedVariants);
//create a product master Translation Object
translation = productMaster.createTranslation().addNew();
// create a new identifier object
Identifier = productMaster.createIdentifier().AddNew();
// Create the ProductDimensionGroup
prodDimGroup = productMaster.createProductDimGroup().addNew();
prodDimGroup.parmProduct(lEcoResProductNumber);
prodDimGroup.parmProductDimensionGroup('Con-Dim');
// Create the StorageDimgroup object
storDimGroup = productMaster.createStorageDimGroup().addNew();
storDimGroup.parmProduct(lEcoResProductNumber);
storDimGroup.parmStorageDimensionGroup("Con-Dim"); // Storage dimension group
// Create the TrackingDimGroup object
tracDimGroup = productMaster.createTrackingDimGroup().addNew();
tracDimGroup.parmProduct(lEcoResProductNumber);
tracDimGroup.parmTrackingDimensionGroup("Con-Dim"); // Tracking dimension group
}
else
{
// Create a new product distinct master
distMaster = new EcoResEcoResProduct_Product_Distinct();
// Take the newly created and initialize ProdMaster - variable and fill with product data
distMaster.parmDisplayProductNumber(lEcoResProductNumber);
distMaster.parmProductType(ecoResProductType);
distMaster.parmSearchName(_ecmProductName);
// Create a translation object
translation = distMaster.createTranslation().addNew();
// Create a new identifier object
Identifier = distMaster.createIdentifier().addNew();
// Create the StorageDimgroup object
storDimGroup = distMaster.createStorageDimGroup().addNew();
storDimGroup.parmProduct(lEcoResProductNumber);
storDimGroup.parmStorageDimensionGroup("Con-Dim");
// Create the TrackingDimGroup object
tracDimGroup = distMaster.createTrackingDimGroup().addNew();
tracDimGroup.parmProduct(lEcoResProductNumber);
tracDimGroup.parmTrackingDimensionGroup("Con-Dim");
}
// fill the translation object
translation.parmDescription(_ecmProductName);
translation.parmLanguageId('en-us');
//translati
translation.parmName(_ecmProductName);
// fill the identifier
identifier.parmProductNumber(lEcoResProductNumber);
// add the product to ecoResProd
if(isMaster)
ecoResProd.createProduct().add(productMaster);
else
ecoResProd.createProduct().add(distMaster);
// create the product using service
ecoProdSvc.create(ecoResProd);
}
catch(Exception::Error)
{
throw Exception::Error;
}
catch(Exception::Deadlock)
{
retry;
}
catch(Exception::UpdateConflict)
{
if(appl.ttsLevel() == 0)
{
if(xSession::currentRetryCount() >= 4)
{
throw Exception::UpdateConflictNotRecovered;
}
else
{
retry;
}
}
else
{
throw Exception::UpdateConflict;
}
}
}
{
EcoResEcoResProduct_TrackingDimGroup tracDimGroup;
EcoResEcoResProduct_Product_Master productMaster;
EcoResEcoResProduct_Product_Distinct distMaster;
EcoResEcoResProduct_ProductDimGroup prodDimGroup;
EcoResEcoResProduct_StorageDimGroup storDimGroup;
EcoResEcoResProduct_translation translation;
EcoResEcoResProduct_Identifier identifier;
EcoResProductService ecoProdSvc;
EcoResProductNumber lEcoResProductNumber;
NumberSequenceTable numberSequenceTable;
EcoResEcoResProduct ecoResProd;
EcoResProductType ecoResProductType;
boolean isMaster = false;
EcoResProductSearchName _ecmProductName;
EcoResProductSubtype prodSubType;
;
prodSubType = EcoResProductSubtype::ProductMaster;
_ecmProductName = " IDB test 09";
lEcoResProductNumber = "IDB -099";
try
{
// create product by initializing the Service object
ecoProdSvc = EcoResProductService::construct();
// initialize the EcoResEcoResProduct object
ecoResProd = new EcoResEcoResProduct();
// numberSequenceTable = EcoResProductParameters::numRefProductNumber().numberSequenceTable(); // Automated
// lEcoResProductNumber = NumberSeq::newGetNumFromId(numberSequenceTable.RecId).num(); // Automated
ecoResProductType = EcoResProductType::Item;
if(prodSubType == EcoResProductSubtype::ProductMaster)
{
isMaster = true;
//Create a new product master
productMaster = new EcoResEcoResProduct_Product_Master();
//initialize product master
productMaster.parmDisplayProductNumber(lEcoResProductNumber);
productMaster.parmProductType(ecoResProductType);
productMaster.parmSearchName(_ecmProductName);
productMaster.parmProductType(EcoResProductType::Service);
productMaster.parmVariantConfigurationTechnology(EcoResVariantConfigurationTechnologyType::PredefinedVariants);
//create a product master Translation Object
translation = productMaster.createTranslation().addNew();
// create a new identifier object
Identifier = productMaster.createIdentifier().AddNew();
// Create the ProductDimensionGroup
prodDimGroup = productMaster.createProductDimGroup().addNew();
prodDimGroup.parmProduct(lEcoResProductNumber);
prodDimGroup.parmProductDimensionGroup('Con-Dim');
// Create the StorageDimgroup object
storDimGroup = productMaster.createStorageDimGroup().addNew();
storDimGroup.parmProduct(lEcoResProductNumber);
storDimGroup.parmStorageDimensionGroup("Con-Dim"); // Storage dimension group
// Create the TrackingDimGroup object
tracDimGroup = productMaster.createTrackingDimGroup().addNew();
tracDimGroup.parmProduct(lEcoResProductNumber);
tracDimGroup.parmTrackingDimensionGroup("Con-Dim"); // Tracking dimension group
}
else
{
// Create a new product distinct master
distMaster = new EcoResEcoResProduct_Product_Distinct();
// Take the newly created and initialize ProdMaster - variable and fill with product data
distMaster.parmDisplayProductNumber(lEcoResProductNumber);
distMaster.parmProductType(ecoResProductType);
distMaster.parmSearchName(_ecmProductName);
// Create a translation object
translation = distMaster.createTranslation().addNew();
// Create a new identifier object
Identifier = distMaster.createIdentifier().addNew();
// Create the StorageDimgroup object
storDimGroup = distMaster.createStorageDimGroup().addNew();
storDimGroup.parmProduct(lEcoResProductNumber);
storDimGroup.parmStorageDimensionGroup("Con-Dim");
// Create the TrackingDimGroup object
tracDimGroup = distMaster.createTrackingDimGroup().addNew();
tracDimGroup.parmProduct(lEcoResProductNumber);
tracDimGroup.parmTrackingDimensionGroup("Con-Dim");
}
// fill the translation object
translation.parmDescription(_ecmProductName);
translation.parmLanguageId('en-us');
//translati
translation.parmName(_ecmProductName);
// fill the identifier
identifier.parmProductNumber(lEcoResProductNumber);
// add the product to ecoResProd
if(isMaster)
ecoResProd.createProduct().add(productMaster);
else
ecoResProd.createProduct().add(distMaster);
// create the product using service
ecoProdSvc.create(ecoResProd);
}
catch(Exception::Error)
{
throw Exception::Error;
}
catch(Exception::Deadlock)
{
retry;
}
catch(Exception::UpdateConflict)
{
if(appl.ttsLevel() == 0)
{
if(xSession::currentRetryCount() >= 4)
{
throw Exception::UpdateConflictNotRecovered;
}
else
{
retry;
}
}
else
{
throw Exception::UpdateConflict;
}
}
}
No comments:
Post a Comment