on ‎2018 Jun 25 11:08 PM
Hi,
I just want to override the OOB canonicalitem (CanonicalPricingSalesAreaMapping) attribute (distributionchannel-true).
I am getting the below error.
2018-06-26 01:22:24,547 [WARN] [c.h.d.s.s.i.DefaultItemResolver] Reference to CanonicalPricingSalesAreaMapping is not complete. com.hybris.datahub.composition.key.IncompleteKeyException: Value for attribute distributionChannel of canonical item CanonicalPricingSalesAreaMapping is blank or null. at com.hybris.datahub.composition.key.AlphabeticalIntegrationKeyGenerationStrategy.generateKeyValue(AlphabeticalIntegrationKeyGenerationStrategy.java:37) at com.hybris.datahub.composition.key.DefaultIntegrationKeyGenerator.calculateIntegrationKey(DefaultIntegrationKeyGenerator.java:75) at com.hybris.datahub.composition.key.DefaultIntegrationKeyGenerator.calculateIntegrationKey(DefaultIntegrationKeyGenerator.java:56) at com.hybris.datahub.service.spel.impl.DefaultItemResolver.calculateIntegrationKey(DefaultItemResolver.java:96) at com.hybris.datahub.service.spel.impl.DefaultItemResolver.lookupReferencedItemByMatchingKey(DefaultItemResolver.java:88) at com.hybris.datahub.service.spel.impl.DefaultItemResolver.resolveReference(DefaultItemResolver.java:76) at com.hybris.datahub.service.spel.impl.DefaultItemResolver.resolve(DefaultItemResolver.java:57) at com.hybris.datahub.service.spel.impl.ResolveMethodExecutor.execute(ResolveMethodExecutor.java:48) at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:130) at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:86) at org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:51) at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:87) at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:121) at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:262) at com.hybris.datahub.service.spel.impl.CompilableSpelExpressionProcessor.transform(CompilableSpelExpressionProcessor.java:84) at com.hybris.datahub.service.publication.impl.DefaultCanonicalToTargetItemConverterService.populateAttributeFromCanonicalItem(DefaultCanonicalToTargetItemConverterService.java:101) at com.hybris.datahub.service.publication.impl.DefaultCanonicalToTargetItemConverterService.lambda$populateTargetItem$0(DefaultCanonicalToTargetItemConverterService.java:89) at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1548) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) at com.hybris.datahub.service.publication.impl.DefaultCanonicalToTargetItemConverterService.populateTargetItem(DefaultCanonicalToTargetItemConverterService.java:89) at com.hybris.datahub.service.publication.impl.DefaultCanonicalToTargetItemConverterService.convert(DefaultCanonicalToTargetItemConverterService.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498)
Request clarification before answering.
Firstly, distributionChannel attribute of CanonicalPricingSalesAreaMapping is a primaryKey so it cannot be null and when you are searching with key attributes of this canonical item you cannot give null values as parameters. This is the reason of the error you get when you're not sending distribution channel with IDoc (Data Hub interprets this value as null when it cannot find corresponding segment).
Secondly, you cannot override the definition of the canonical item's attributes, when you try this, Data Hub gives error during startup. But you may override the transformation of this attribute by using the following code snippet in your custom extension which has a dependency on the required extension (`sappricing-raw` in this case):
<item>
<type>CanonicalPrice</type>
<attributes>
<attribute>
<name>distributionChannel</name>
<transformations>
<transformation override="true">
<rawSource>RawCOND_A</rawSource>
<expression spel="true">#root.getField('E1KOMG-VTWEG') ne null ? #root.getField('E1KOMG-VTWEG') : 'NDC'</expression>
</transformation>
</transformations>
</attribute>
</attributes>
</item>
This code snippet overrides the distributionChannel attribute, and in the SpEL expression it checks the field of the IDoc where you're sending distribution channel value ( E1KOMG-VTWEG ) and if it's not null then it uses the value, otherwise it uses value NDC (Short for No-Distribution-Channel). Now you need to define mapping in Hybris for the distribution channel we defined for null values (NDC) to an appropriate value. After that you will not get the aforementioned error since you replaced null values with a non-null value (NDC in this case).
Hope this helps,
Mansur
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mansur, Thanks for your quick response. I did the same thing which you have explained,in that case the error is resolved.but i am getting a new error,please have a look at the below error and kindly let me know if i have missed anything or need to do something else. com.hybris.datahub.service.spel.TransformationExpressionException: Could not transform by expression resolve('CanonicalPricingSalesAreaMapping', 'SAPCONFIGURATION_POOL').c at com.hybris.datahub.service.spel.impl.CompilableSpelExpressionProcessor.transform(CompilableSpelExpressionProcessor.java:89)
Error :- com.hybris.datahub.service.spel.TransformationExpressionException: Could not transform by expression resolve('CanonicalPricingSalesAreaMapping', 'SAPCONFIGURATION_POOL').c at com.hybris.datahub.service.spel.impl.CompilableSpelExpressionProcessor.transform(CompilableSpelExpressionProcessor.java:89) at com.hybris.datahub.service.publication.impl.DefaultCanonicalToTargetItemConverterService.populateAttributeFromCanonicalItem(DefaultCanonicalToTargetItemConverte at com.hybris.datahub.service.publication.impl.DefaultCanonicalToTargetItemConverterService.lambda$populateTargetItem$0(DefaultCanonicalToTargetItemConverterServic at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1548) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) at com.hybris.datahub.service.publication.impl.DefaultCanonicalToTargetItemConverterService.populateTargetItem(DefaultCanonicalToTargetItemConverterService.java:89 at com.hybris.datahub.service.publication.impl.DefaultCanonicalToTargetItemConverterService.convert(DefaultCanonicalToTargetItemConverterService.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have resolved the issue. It's a change in SAP Global Configuration --> Pricing Replication on the HMC side , we would need to add the Sales Organization, Distribution Channel, Owning Division and respective Catalog Version for pricing condition. After adding all the Mapping Sales Area Catalogs, need to save it and then upload it to the Data Hub.
Thanks!
,
Please share the configurations steps.
Regards, Gaurav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.