cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Publication Type "delete" for deleting records through datahub

Former Member
0 Likes
521

Hi Team,

We have requirement to delete records through datahub, as per my understanding we have "INSERT_UPDATE" and "INSERT" operation are existing in Datahub adapter, but when i gone through OOTB datahub jar file "datahub-core-export-service.Jar" i have seen that, if "Publication Type" is "DELETE" then in Impex header instead of "INSERT_UPDATE" and "INSERT" we have an option to add "REMOVE" in Impex header.

Can anyone help me how to provide "Publication Type" is "DELETE" in target xml file.

Thanks,

Accepted Solutions (1)

Accepted Solutions (1)

Slava
Product and Topic Expert
Product and Topic Expert
0 Likes

Quick answer is that loaded data (raw items) should be marked for deletion. Then DataHub will use the key columns of the raw items to determine, which records will be deleted, so during composition the corresponding canonical items are marked for deletion and then deleted canonical items are published as DELETE blocks in the impex. See details here https://help.sap.com/viewer/50c996852b32456c96d3161a95544cdb/1905/en-US/e3d64afce21840e4bed5a234695c...

That said, I don't know how that delete flag can be specified in iDocs but I'm pretty sure it can be done. If needed search documentation for the SAP integration DataHub extensions to find the answer.

bidyadhar_tripathy
Participant
0 Likes

Thank you slava for your response.

I have written a grouping handler, where I am setting the delete flag in raw item and DELETE impex is getting created at hybris and working fine. But I have a problem below.

We have a custom item "Compliance" and a custom product type contains "Collection of Compliances"

Sample code :

 public  List> group(final CompositionGroup compositionGroup) {
     for (RawItem rawItem : compositionGroup.getItems()) {
         rawItem.setDelete(true);
     }
 }

Sample data :

 materialNumber,complianceType,complianceStatus,complianceEffectiveStartDate,complianceName,complianceVersion
 "000000000000011107","ROHS_EU","NOT_IN_SCOPE","20180512","EU RoHS miketesting","4.5"

when we are posting above data, it is removing compliance and as well as product "000000000000011107".

But my requirement is only to remove compliance and its association with product not the product itself.

Note : I have defined 2 items in target.xml. One for compliance and another for associating compliance to product. So it using REMOVE script for all items defined in target.xml

Any idea on this issue ?

Slava
Product and Topic Expert
Product and Topic Expert
0 Likes

It's hard to advise something without understanding your case and how it's modeled. Perhaps the related product is removed because it's in a cascade relationship with compliance. If so, it needs to be fixed in the items.xml. If product is deleted by the grouping handler, then you need adjust its logic. Also, I want to mention that associations can be cleared through DataHub by specifying an empty value for the foreign key attribute in a one-to-many relationship. See https://help.sap.com/viewer/50c996852b32456c96d3161a95544cdb/1905/en-US/9677910439ac4268ba3d515e9112... for details

Answers (1)

Answers (1)

bidyadhar_tripathy
Participant
0 Likes

Any solution on this issue ?

Former Member
0 Likes

Hi Bidya,

Yeah we have resolved this issue by setting publicationStatusType as removed through enums defined in the publicationStatusType. for example, publicationStatusType.Remove inside Composition Handler. Inorder to add this status type we need to check condition for deleting particular record in composition handler.

Thanks, Suresh G.