The EcoResProductService class and behavior

Hi

Using the following classes to create multiple products in ax2012 reading from file. If I try
to do it this way, I get an error adding the second record to the list in the EcoResEcoResProduct
that the product already exist. It seems that using the product service class you have to call
the create() method on the service for each record you want to create. This is not the way that
other services in AX2012 can be used - for customers, vendors ect. you can add more records
to the list and only call the create() method once.

Does anybody know if this is the “rule” for the EcoResProductService class, or am I missing
something ?

example:

EcoResProductService ecoProdSvc;
EcoResEcoResProduct ecoResProd;
EcoResEcoResProduct_Product_Distinct distProd;

// initialize the Service object
ecoProdSvc = EcoResProductService::construct();

while (io.status() == IO_Status::OK)

{

// initialize the EcoResEcoResProduct object
ecoResProd = new EcoResEcoResProduct();

// Create a new product distinct master

distProd = new EcoResEcoResProduct_Product_Distinct();

distProd.parmDisplayProductNumber(ProductNumber);

distProd.parmProductType(EcoResProductType::Item);
distProd.parmSearchName(SearchName);

ecoResProd.createProduct().add(distProd);

}

// Create the product
ecoProdSvc.create(ecoResProd);