cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to import data in CategoryProductRelation and category after SAP commerce upgrade 2205

sharada1234
Explorer
0 Kudos

Hi All,

We need to update CategoryProductRelation and category tables on daily basis in production.But when we try to import data,it is failing with below error. and below is the impex i used to import data into category and CategoryProductRelation .

IMPEX:

$productRef=code,catalogVersion(catalog(id[default='TestProductCatalog']),version[default='Staged'])

$categoryRef=code,catalogVersion(catalog(id[default='TestProductCatalog']),version[default='Staged'])

INSERT_UPDATE CategoryProductRelation;source($categoryRef)[unique=true];target($productRef)[unique=true]

;testCat;testProduct

Error:

INSERT_UPDATE CategoryProductRelation;source(code,catalogVersion(catalog(id[default='TestProductCatalog']),version[default='Staged']))[unique=true];target(code,catalogVersion(catalog(id[default='TestProductCatalog']),version[default='Staged']))[unique=true];sequenceNumber

,,,,Exception : line 5: cannot create CategoryProductRelation with values ItemAttributeMap[ registry: null, type: <null>, data: {source=8797208281230, sequencenumber=1, target=8796668919809} ] due to [de.hybris.platform.servicelayer.interceptor.impl.MandatoryAttributesValidator@3022ba2b]:missing values for [source, target] in model LinkModel (<unsaved>) to create a new CategoryProductRelation, Exception : line 3: cannot create CategoryProductRelation with values ItemAttributeMap[ registry: null, type: <null>, data: {sequencenumber=1, source=8797208281230, target=8796668919809} ] due to [de.hybris.platform.servicelayer.interceptor.impl.MandatoryAttributesValidator@3022ba2b]:missing values for [source, target] in model LinkModel (<unsaved>) to create a new CategoryProductRelation;testCat;testProduct

And the given Source and target are existing in the system.Not sure why ia m getting MandatoryAttributesValidator issue.

Category Impex:

$productCatalog=TestProductCatalog

$catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default='Staged'])[unique=true,default=$productCatalog:Staged]

INSERT_UPDATE Category;$catalogVersion[unique=true];code[unique=true]

;;test

Error:

INSERT_UPDATE Category;catalogversion(catalog(id[default=TestProductCatalog]),version[default='Staged'])[unique=true,default=TestProductCatalog:Staged][unique=true];code[unique=true]

,,,,Exception : line 9: cannot create Category with values ItemAttributeMap[ registry: null, type: <null>, data: {code=test, catalogversion=TestProductCatalog/Staged(8796125823577)} ] due to [de.hybris.platform.servicelayer.interceptor.impl.MandatoryAttributesValidator@3022ba2b]:missing values for [catalogVersion] in model CategoryModel (<unsaved>) to create a new Category, Exception : line 3: cannot create Category with values ItemAttributeMap[ registry: null, type: <null>, data: {code=test, catalogversion=SpainProductCatalog/Staged(8796125823577)} ] due to [de.hybris.platform.servicelayer.interceptor.impl.MandatoryAttributesValidator@3022ba2b]:missing values for [catalogVersion] in model CategoryModel (<unsaved>) to create a new Category;;test

I am just trying to create a simple test category but it is throwing missing mandatory attribute 'Catalog version' issue which is there in the impex.

I am able to create category from backoffice.But not sure why it is throwing error when I try to create with Impex.

Can someone please help here?

Thanks,

Sharada

Accepted Solutions (0)

Answers (1)

Answers (1)

gaurav11
Participant
0 Kudos

Hi Sharada,

Please try with below header.

$productCatalog=TestProductCatalog

$productCatalogName=Test Product Catalog

$catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default='Online'])[unique=true,default=$productCatalog:Online]

$supercategories=source(code, $catalogVersion)[unique=true]

$categories=target(code, $catalogVersion)[unique=true]

# Insert Categories

INSERT_UPDATE Category;code[unique=true];allowedPrincipals(uid)[default='customergroup'];$catalogVersion

;testCat

# Insert Category Structure

INSERT_UPDATE CategoryProductRelation;target(code,$catalogVersion)[unique=true];source(code,$catalogVersion)[unique=true];;

;testProduct;testCat

Thanks,