create a product using service

private void createProduct(itemId _itemId,
DataAreaId _dataAreaId = curext()
)

{
EcoResProductService ecoResProdService;
EcoResEcoResProduct ecoResProduct;
EcoResEcoResProduct_Product_Distinct product;
EcoResEcoResProduct_Translation translation;
EcoResEcoResProduct_Identifier identifier;
EcoResEcoResProduct_StorageDimGroup storageDimGroup;
EcoResEcoResProduct_TrackingDimGroup trackingDimensionGroup;
;

ecoResProdService = EcoResProductService::construct();
ecoResProduct = new EcoResEcoResProduct();
product = new EcoResEcoResProduct_Product_Distinct();

//Newly created and initialize product

product.parmDisplayProductNumber(“demo5”);
product.parmProductType(EcoResProductType::Item);
product.parmSearchName(“demo5”);

//Create a new translation object:
Translation = product.createTranslation().addNew();

Translation.parmDescription(“demo5”);
Translation.parmLanguageId(CompanyInfo::languageId());
Translation.parmName(“demo5”);
Identifier = product.createIdentifier().addNew();

Identifier.parmProductNumber(“demo5”);

storageDimGroup = product.createStorageDimGroup().addNew();
storageDimGroup.parmProduct(“demo5”);
storageDimGroup.parmStorageDimensionGroup(“SITEWHSE”);

trackingDimensionGroup = product.createTrackingDimGroup().addNew();
trackingDimensionGroup.parmProduct(“demo5”);
trackingDimensionGroup.parmTrackingDimensionGroup(“NONE”);

ecoResProduct.createProduct().add(product);
ecoResProdService.create(ecoResProduct);

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s