cancel
Showing results for 
Search instead for 
Did you mean: 

Hybris DataHub: CompanyAddress dependant on CanonicalParty

A situation has come up in testing our SAP ECC -> Hybris Data Hub -> Hybris Commerce integration:

  • We used BD12 to initially send all of our customers (DEBMAS) and their address (ADRMAS)
  • We found a bug in the Canonical structures and had to restart data hub with create-drop which clears all CanonicalItems as the entire schema is dropped and recreated
  • A tester queried why when making a change to an address and running a Change Pointer ADRMAS the change did not hit Hybris

I have found this is because a CompanyAddress publication is dependent on the CanonicalParty existing already in DataHub with a type of "COMPANY" due to this OOTB Java in CompanyAddressPublicationHandler:

	@Override
	public <T extends CanonicalItem> boolean isApplicable(final T item, final TargetItemCreationContext context)
	{
		if ("CompanyAddress".equals(context.getTargetItemTypeCode()))
		{
			final String canonicalPartyId = (String) item.getField("partyId");
			final CanonicalItem canonicalParty = this.canonicalItemService.findLatestValidItem("CanonicalParty", canonicalPartyId, item.getDataPool());


			if (canonicalParty == null)
			{
				return true;
			}

			final String canonicalPartyType = (String) canonicalParty.getField("type");
			if (!"COMPANY".equals(canonicalPartyType))
			{
				return true;
			}

As we haven't yet seen a DEBMAS, it will not be the case a CanonicalParty with a type of "COMPANY" can exist as it needs to see a DEBMAS-KTOKD:

				<attribute>
					<name>type</name>
					<transformations>
						<transformation>
							<rawSource>RawDEBMAS</rawSource>
                            <expression spel="true">#root.getField('E1KNA1M-KTOKD') eq null or #root.getField('E1KNA1M-KTOKD') eq '' ? 'PERSON' : 'COMPANY'</expression>
						</transformation>

My questions are:

  1. Is this correct, and the theory is that DataHub will always have and store the CanonicalItems forever as it will have seen them at some point?
  2. If yes, then how do we handle the fact a Canonical Item may need a structure change once we go live in production, and until we drop the database Data Hub fails to correctly pick up the new transformations?

Accepted Solutions (0)

Answers (0)