on ‎2018 Apr 16 11:54 AM - last edited on ‎2024 Feb 04 5:25 AM by postmig_api_4
Hi All,
I create one custom canonical attribute summary in CanonicalProductSales in datahub , which is mapped with raw attribute E1MARAM-E1MAKTM-MAKTX. As this attribute have multiple language specific values I create new bean in my customraw-datahub-extension-spring.xml to replicate all the values as per their language code as below.
<bean id="cgiProductShortTextCompositionHandler" class="com.hybris.datahub.saperpproduct.composition.LocalizedCompositionHandler">
<property name="canonicalAttribute" value="shortText" />
<property name="canonicalTypeCode" value="CanonicalProductSales" />
<property name="rawAttribute" value="E1MARAM-E1MAKTM-MAKTX" />
<property name="rawAttributeISO" value="E1MARAM-E1MAKTM-SPRAS_ISO" />
<property name="rawTypeCode" value="RawMATMAS" />
</bean>
My IDOC contains below values of E1MARAM-E1MAKTM-MAKTX
<MAKTX>PARTS
F/GARAGE
DOOR
OPEN(LENS-ASSY)</MAKTX><SPRAS_ISO>Z9</SPRAS_ISO></E1MAKTM><E1MAKTM
SEGMENT="1"><MSGFN>005</MSGFN><SPRAS>E</SPRAS><MAKTX>LIGHT
LENS</MAKTX><SPRAS_ISO>EN</SPRAS_ISO></E1MAKTM><E1MAKTM
SEGMENT="1"><MSGFN>005</MSGFN><SPRAS>S</SPRAS><MAKTX>MANUFACTURAS
DE
PLASTICO</MAKTX><SPRAS_ISO>ES</SPRAS_ISO></E1MAKTM>
It should replicate all the three values, but now its replicating only last value
Custom attribute :-
customraw-datahub-extension.xml
CanonicalProductSales
<attributes>
<!-- Custom raw attribute mapping with canonical shortText attribute -->
<attribute>
<name>shortText</name>
<transformations>
<transformation>
<rawSource>RawMATMAS</rawSource>
<expression></expression>
</transformation>
</transformations>
</attribute>
customcanonical-datahub-extension.xml
<!-- Start of canonical item for CanonicalProductSales -->
<type>CanonicalProductSales</type>
<attributes>
<attribute>
<name>summary</name>
<model>
<localizable>true</localizable>
<type>String</type>
</model>
</attribute>
customtarget-datahub-extension.xml
<attribute>
<name>summary</name>
<localizable>true</localizable>
<transformationExpression>summary</transformationExpression>
<exportCode>summary</exportCode>
</attribute>
I noticed that their is one OOTB canonical attribute name which is mapped with E1MARAM-E1MAKTM-MAKTX, for the attribute name all the three values are getting replicated.
For OOTHB attribute its replicating all the three values, but not for my custom attribute, Is their any thing missing while creation of custom attribute ?
Regards, Rasika
Request clarification before answering.
I create one custom canonical attribute summary in CanonicalProductSales in datahub , which is mapped with raw attribute E1MARAM-E1MAKTM-MAKTX.
This is a mistake as E1MAKTM is not a child segment of E1MVKEM. Only the fields under E1MVKEM shall be mapped to CanonicalProductSales.
It should replicate all the three values, but now its replicating only last value.
No, it should not repeat the three values. Segments E1MAKTM and E1MVKEM are hierarchically independent and therefore cannot be map/reduced into the same data structure linearly.
I noticed that their is one OOTB canonical attribute name which is mapped with E1MARAM-E1MAKTM-MAKTX, for the attribute name all the three values are getting replicated.
There is no reason to define an additional summary field for the same input.
Solution :
Do not create canonical attribute summary in CanonicalProductSales for duplicating an already mapped field.
Simply use the resolve method in the target definition. Example :
<transformationExpression>resolve('CanonicalProduct').name</transformationExpression>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I agree that I need to use OOTB canonical attribute name
But I want E1MARAM-E1MAKTM-MAKTX with language = EN , so for this I create custom attribute shortText and custom handler to filter MAKTX with language = EN
Is their any way to use custom composition hanlder instead of OOTB LocalizedCompositionHandler for OOTB canonical attribute name?
| User | Count |
|---|---|
| 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.