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

How to combine fields using Data Hub Grouping Handler?

Former Member
0 Likes
466

I am trying to map the Future Stock from the IDOC to Future Stock in Hybris.

Since there is no Future Stock mapping OOTB, I have created my own by defining the raw, canonical and target (Please refer to the attachments). The Canonical Item has productCode, warehouse, date and quantity as primary keys.

The Future Stock on the IDOC can be multiple entries. The segment for Future Stock is E1MDPSL (where E1MDPSL.BAART=NB. ie Open Purchase Orders). If there are multiple open purchase order on same date, the incoming data do have multiple records.
The Grouping Handler will have to sum the data before inserting to Hybris.

I've created a GroupingHandler which would group the Raw item fragments with the same date (Please refer to the attachment). I've done this by only including the RawItems that I need to the CompositionGroup but when I check the ImpEx file that was generated by Data Hub, it still contains the Raw Items that I did not include in the CompositionGroup. My expectation was that only the RawItems in the CompositionGroup will be composed into Canonical Items.

Here is the ImpEx that was generated:

INSERT_UPDATE FutureStock;;quantity;date[dateformat=yyyyMMdd];productCode(code)[unique=true];warehouse(code)[unique=true] ;6;336.000;20170315;100000143;5521 ;8;168.000;20170501;100000143;5521 ;5;224.000;20170501;100000143;5521

I was expecting to only see 2 Future Stock records. 1 record would just have a quantity of 336 and the other record would be a combined quantity of 168 and 224 so 392 (combined because it has the same date).

[1]: /storage/temp/8464-support.zip

Accepted Solutions (1)

Accepted Solutions (1)

former_member224482
Active Contributor
0 Likes

Change quantity to primaryKey = false.

Former Member
0 Likes

Yes thank you. That worked!

Former Member
0 Likes

Hi Andreau,

I am facing similar issue. the attribute warehouse is not part of future stock. How is it working for you. I am getting an error saying that "unknown attribute 'warehouse' in header 'INSERT_UPDATE FutureStock"

Thanks.

Answers (0)