on 08-24-2016 7:14 AM - last edited on 02-04-2024 3:23 AM by postmig_api_4
Hi All,
I'm trying to extend Data Hub with custom attribute from SAP ERP and pass that onto the hybris. In order to do so, I've followed the Data Hub Extensibility guide and some threads in the experts forum.
However I'm not able to validate my custom attribute in the RawMATMAS nor in canonical. The custom jar files are kept in webinf libs of the data hub. Below are the xmls. Please suggest what is going wrong. link text The version of hybris is 6.1.0.0 & Data Hub is 6.1.0.0 RC3. I'm also attaching complete console logs.
Quick responses will really be appreciated. Thanks Gourav
Raw XML:
<dependencies>
<dependency>
<extension>zbalerpproduct-canonical</extension>
<extension>saperpproduct-raw</extension>
<extension>saperpproduct-canonical</extension>
<extension>saperpproduct-target</extension>
</dependency>
</dependencies>
<rawItems>
<item>
<type>RawMATMAS</type>
<description>Raw representation of a ZMATMAS</description>
<attributes>
<attribute>
<name>E1MARAM-ZE1MARA-NITROGEN</name>
</attribute>
</attributes>
</item>
</rawItems>
<canonicalItems>
<item>
<type>CanonicalProduct</type>
<attributes>
<attribute>
<name>Nitrogen</name>
<transformations>
<transformation>
<rawSource>RawMATMAS</rawSource>
<expression>E1MARAM-ZE1MARA-NITROGEN</expression>
</transformation>
</transformations>
</attribute>
</attributes>
</item>
</canonicalItems>
Canonical XML:
enter code here
<dependencies>
<dependency>
<extension>saperpproduct-raw</extension>
<extension>saperpproduct-canonical</extension>
<extension>saperpproduct-target</extension>
</dependency>
</dependencies>
<canonicalItems>
<item>
<type>CanonicalProduct</type>
<description>Canonical representation of ZMATMAS</description>
<status>ACTIVE</status>
<attributes>
<attribute>
<name>Nitrogen</name>
<model>
<localizable>false</localizable>
<collection>false</collection>
<type>String</type>
<primaryKey>false</primaryKey>
</model>
</attribute>
</attributes>
</item>
</canonicalItems>
Target XML:
<dependencies>
<dependency>
<extension>zbalerpproduct-canonical</extension>
<extension>saperpproduct-raw</extension>
<extension>saperpproduct-canonical</extension>
<extension>saperpproduct-target</extension>
</dependency>
</dependencies>
<targetSystems>
<targetSystem>
<name>HybrisCore</name>
<type>HybrisCore</type>
<exportURL>${datahub.extension.exportURL}</exportURL>
<userName>${datahub.extension.userName}</userName>
<password>${datahub.extension.password}</password>
<exportCodes>
<exportCode>
$catalogVersion=catalogversion(catalog(id[default=Default]),version[default='Staged'])[unique=true,default=Default:Staged]
</exportCode>
<exportCode>
$baseProduct=baseProduct(code,catalogVersion(catalog(id[default='Default']),version[default='Staged']))
</exportCode>
</exportCodes>
<targetItems>
<item>
<type>Product</type>
<exportCode>Product</exportCode>
<description>Hybris Platform representation of ZMATMAS</description>
<updatable>true</updatable>
<canonicalItemSource>CanonicalProduct</canonicalItemSource>
<status>ACTIVE</status>
<attributes>
<attribute>
<name>Nitrogen</name>
<localizable>false</localizable>
<collection>false</collection>
<transformationExpression>resolve('CanonialProduct').Nitrogen</transformationExpression>
<exportCode>Nitrogen</exportCode>
<mandatoryInHeader>false</mandatoryInHeader>
</attribute>
</attributes>
</item>
</targetItems>
</targetSystem>
</targetSystems>
Hi Gaurav, Please check your custom extensions (raw,canonical and target ) has been loaded successfully without any error . Your xml changes looks fine to me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gourav, but in attached log ther isn't logged "Importing extension resource yourExtension-canonical" also for yourExtension-raw and yourExtension-taget, i suppose that yourExtension is zbalerpproduct.
Are you sure that the custom jars are in the correct folder?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andrea,
THanks for your response. yes, I could see that there was another older version of data hub working on the same box, causing the confusion, that I was deploying to but the working server was different. Had managed to get the custom attribute on the Data Hub side.
Now can you please suggest me how can I get this attribute to reflect on hybris side. What are the steps involved?
Thanks.
Hi Gourav,
I think that you must have the field Nitrogen in your Product in targetSystem.
After you should see the field in section Catalog-Product in Hybris.
If you want to check the update the RawMATMAS in dataHub got to http://localhost:8080/datahub-webapp/v1/item-classes/raw/item-types/RawMATMAS/attributes
and you should find E1MARAM-ZE1MARA-NITROGEN.
Hi Andrea,
If for a POC I want to map the custom attribute to an existing attribute value in the hybris side say description for example, can you please suggest where do we need to do the config.? To my understanding it is the export code field in the target xml where we need to refer it to which I've tried but not getting the value.
Also get publication error below: Could not transform by expression unit !=null and !unit.isEmpty() ? resolve('CanonicalProductUnit').EAN?:'' : resolve('CanonicalProduct').GTIN?: resolve('CanonicalProduct').resolve('CanonicalProductUnit')?.EAN?:''
Hi Gourav,
I try to answer (if i understand).
Your raw-extention.xml should be
<rawItems>
<item>
<type>RawMATMAS</type>
<description>Raw representation of a sample raw item</description>
<attributes>
<attribute>
<name>E1MARAM-ERNAM</name><!-- MSGFN -->
</attribute>
</attributes>
</item>
</rawItems>
<canonicalItems>
<item>
<type>CanonicalProduct</type>
<attributes>
<attribute>
<name>description</name>
<transformations>
<transformation>
<rawSource>RawMATMAS</rawSource>
<expression>E1MARAM-ERNAM</expression>
</transformation>
</transformations>
</attribute>
</attributes>
</item>
Your canoncial-extention.xml should be
<canonicalItems>
<item>
<type>CanonicalProduct</type>
<description>Canonical representation of sample item</description>
<status>ACTIVE</status>
<attributes>
<attribute>
<name>description</name>
<model>
<localizable>false</localizable>
<type>String</type>
<primaryKey>false</primaryKey>
</model>
</attribute>
</attributes>
</item>
</canonicalItems>
And target-extension.xml should be
<item>
<exportCode>Product</exportCode>
<type>BaseProduct</type>
<description>Products</description>
<updatable>true</updatable>
<canonicalItemSource>CanonicalProduct</canonicalItemSource>
<status></status>
<attributes>
<attribute>
<name>decription</name>
<localizable>false</localizable>
<transformationExpression >description.toLowerCase()</transformationExpression>
<exportCode>description</exportCode>
<mandatoryInHeader>false</mandatoryInHeader>
</attribute>
</attributes>
</item>
where exportCode is target system field to which it is mapped
I hope this helps you
Hi Andrea,
Thanks very much for your response. I've made changes to my existing xmls as you suggested below and has mapped to existing column comments. On publication I'm getting an error on the hybris console as well in the data hub backoffice UI. I'm attaching both. alt textPlease suggest.
Hi,
I also notice the attached error in loading the standard saperpproduct-raw extension even without my custom jars. Please suggest.link text
HI Andrea,
Above errors are sorted out but I still have some queries. In hybris, I've my custom itemtypes say product P1 wherein I've the above attribute nitrogen. I'm trying to map in the target xml to my custom itemtype say P1 so that in the back office I can see the product mapped to my custom product type but its not working. In the target xml, I've put in the export code as the target item type and the expressions resolving as ('CanonicalProduct').nitrogen. Can you please suggest what's missing? Thanks.
User | Count |
---|---|
7 | |
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.