Search code examples
sap-commerce-cloudimpex

unable to insert values to the classAttributeAssignment in impex


$classificationSystem=hpeClassification 
$classificationCatalogVersion=catalogversion(catalog(id[default=$classificationSystem]),version[default='1.0'])[unique=true,default=$classificationSystem:1.0] 
$classificationSystemVersion=systemVersion(catalog(id[default=$classificationSystem]),version[default='1.0'])[unique=true,default=$classificationSystem:1.0]
$code=/facet/Category
$class=classificationClass($code,$classificationCatalogVersion)[unique=true]
$attribute=classificationAttribute(code,$classificationSystemVersion)[unique=true]
$unit=unit(code,$classificationSystemVersion)

INSERT_UPDATE ClassAttributeAssignment;$class;$attribute;multiValued[default=false];range[default=false];attributeType(code[default=string]);localized[default=true];$unit;attributeValues(code,$classificationSystemVersion);

Solution

  • The problem is the use of macro for code(i.e $code).I modified the impex and bellow version should work(However it will not insert nothing in DB):

    $classificationSystem=hpeClassification    
    $classificationCatalogVersion=catalogversion(catalog(id[default=$classificationSystem]),version[default='1.0'])[unique=true,default=$classificationSystem:1.0] 
    $classificationSystemVersion=systemVersion(catalog(id[default=$classificationSystem]),version[default='1.0'])[unique=true,default=$classificationSystem:1.0]
    $class=classificationClass(code,$classificationCatalogVersion)[unique=true]
    $attribute=classificationAttribute(code,$classificationSystemVersion)[unique=true]
    $unit=unit(code,$classificationSystemVersion)
    
    INSERT_UPDATE ClassAttributeAssignment;$class;$attribute;multiValued[default=false];range[default=false];attributeType(code[default=string]);localized[default=true];$unit;attributeValues(code,$classificationSystemVersion);
    

    An example of inserting an instance in DB would be:

    $classificationSystem=hpeClassification
    $classificationCatalogVersion=catalogversion(catalog(id[default=$classificationSystem]),version[default='1.0'])[unique=true,default=$classificationSystem:1.0]
    $classificationSystemVersion=systemVersion(catalog(id[default=$classificationSystem]),version[default='1.0'])[unique=true,default=$classificationSystem:1.0]
    $class=classificationClass(code,$classificationCatalogVersion)[unique=true]
    $attribute=classificationAttribute(code,$classificationSystemVersion)[unique=true]
    $unit=unit(code,$classificationSystemVersion)
    
    INSERT_UPDATE ClassAttributeAssignment;$class;$attribute;multiValued[default=false];range[default=false];attributeType(code[default=string]);localized[default=true];$unit;attributeValues(code,$classificationSystemVersion);
    ;accessoryclassification;bands
    

    Where "accessoryclassification" is the code of an already existing(in DB) Classification Class and "bands" is the code of already existing classification attribute