How I can export only one product in Hybris using impex

Adam picture Adam · Dec 31, 2015 · Viewed 7.3k times · Source

I want to export only one product using hybris impex:
following sql give me that product.

select * from products where code='489923'

I am trying to modify the export script:

# ---- Extension: core ---- Type: Product ----
"#% impex.setTargetFile( ""Product.csv"" );"
insert_update Product;pk;Europe1PriceFactory_PDG(code,itemtype(code));Europe1PriceFactory_PPG(code,itemtype(code));Europe1PriceFactory_PTG(code,itemtype(code));approvalStatus(code,itemtype(code))[allownull=true];articleStatus[lang=en];buyerIDS(key(code,itemtype(code)));catalog(id)[allownull=true];catalogVersion(catalog(id),version)[unique=true,allownull=true];code[unique=true,allownull=true];contentUnit(code);creationtime[forceWrite=true,dateformat=dd.MM.yyyy hh:mm:ss];data_sheet(catalogVersion(catalog(id),version),code);deliveryTime;description[lang=en];detail(catalogVersion(catalog(id),version),code);ean;endLineNumber;erpGroupBuyer;erpGroupSupplier;europe1Discounts(pk);europe1Prices(pk);europe1Taxes(pk);galleryImages(catalogVersion(catalog(id),version),qualifier);logo(catalogVersion(catalog(id),version),code);manufacturerAID;manufacturerName;manufacturerTypeDescription[lang=en];maxOrderQuantity;minOrderQuantity;name[lang=en];normal(catalogVersion(catalog(id),version),code);numberContentUnits;offlineDate[dateformat=dd.MM.yyyy hh:mm:ss];onlineDate[dateformat=dd.MM.yyyy hh:mm:ss];order;orderQuantityInterval;others(catalogVersion(catalog(id),version),code);owner(pk)[allownull=true];picture(catalogVersion(catalog(id),version),code);priceQuantity;productOrderLimit(pk);remarks[lang=en];segment[lang=en];sequenceId;specialTreatmentClasses();startLineNumber;summary[lang=en];supplierAlternativeAID;thumbnail(catalogVersion(catalog(id),version),code);thumbnails(catalogVersion(catalog(id),version),code);unit(code);variantType(code);variants(catalogVersion(catalog(id),version),code);xmlcontent
"#% impex.exportItems( ""Product"" , false );"

as follows:

# ---- Extension: core ---- Type: Product ----
"#% impex.setTargetFile( ""Product.csv"" );"
insert_update Product;pk;Europe1PriceFactory_PDG(code,itemtype(code));Europe1PriceFactory_PPG(code,itemtype(code));Europe1PriceFactory_PTG(code,itemtype(code));approvalStatus(code,itemtype(code))[allownull=true];articleStatus[lang=en];buyerIDS(key(code,itemtype(code)));catalog(id)[allownull=true];catalogVersion(catalog(id),version)[unique=true,allownull=true];code[unique=true,allownull=true];contentUnit(code);creationtime[forceWrite=true,dateformat=dd.MM.yyyy hh:mm:ss];data_sheet(catalogVersion(catalog(id),version),code);deliveryTime;description[lang=en];detail(catalogVersion(catalog(id),version),code);ean;endLineNumber;erpGroupBuyer;erpGroupSupplier;europe1Discounts(pk);europe1Prices(pk);europe1Taxes(pk);galleryImages(catalogVersion(catalog(id),version),qualifier);logo(catalogVersion(catalog(id),version),code);manufacturerAID;manufacturerName;manufacturerTypeDescription[lang=en];maxOrderQuantity;minOrderQuantity;name[lang=en];normal(catalogVersion(catalog(id),version),code);numberContentUnits;offlineDate[dateformat=dd.MM.yyyy hh:mm:ss];onlineDate[dateformat=dd.MM.yyyy hh:mm:ss];order;orderQuantityInterval;others(catalogVersion(catalog(id),version),code);owner(pk)[allownull=true];picture(catalogVersion(catalog(id),version),code);priceQuantity;productOrderLimit(pk);remarks[lang=en];segment[lang=en];sequenceId;specialTreatmentClasses();startLineNumber;summary[lang=en];supplierAlternativeAID;thumbnail(catalogVersion(catalog(id),version),code);thumbnails(catalogVersion(catalog(id),version),code);unit(code);variantType(code);variants(catalogVersion(catalog(id),version),code);xmlcontent
"#% impex.exportItems(""SELECT {K:pk} FROM {Product as K} WHERE {K:code}='489923'  , false );"

so that I can export only one product. But it is giving me error? Also I am not sure how to see the details of the error.

Answer

Maxwell Cheng picture Maxwell Cheng · Aug 23, 2018

you can run below export impex in hac:

insert_update Product;pk;approvalStatus(code,itemtype(code))[allownull=true];articleStatus[lang=en];buyerIDS(key(code,itemtype(code)));catalog(id)[allownull=true];catalogVersion(catalog(id),version)[unique=true,allownull=true];
"#% impex.exportItemsFlexibleSearch( ""select {pk},{approvalStatus},{articleStatus},{buyerIDS},{catalog},{catalogVersion}from {Product} where {pk}='8799737217054'"" );"

A file will be available for you to download underneath