We are getting a "ITAB duplicate key" error in a DataSource enhancement for BW that selects data from table MBEW into a hash table. The internal table has the same fields as the key of the table. I don't understand how we could be getting ITAB_DUPLICATE_KEY error when the where clause on the select statement has the key of the table. Is this a buffering issue? Here's a subset of the important code:
TYPES:
BEGIN OF TY_MBEW, "Material Valuation
MATNR TYPE MBEW-MATNR, "Material Number
BWKEY TYPE MBEW-BWKEY, "Valuation Area
BWTAR TYPE MBEW-BWTAR, "Valuation Type
STPRS TYPE MBEW-STPRS, "Standard Price
PEINH TYPE MBEW-PEINH, "Price Unit
VERPR TYPE MBEW-VERPR, "Moving Average Price/Periodic Unit Price
VPRSV TYPE MBEW-VPRSV, "Price Control Indicator
END OF TY_MBEW.
DATA:
IT_MBEW_HSH TYPE HASHED TABLE OF TY_MBEW
WITH UNIQUE KEY MATNR BWKEY BWTAR,
SELECT MATNR
BWKEY
BWTAR
STPRS
PEINH
VERPR "Moving Average Price/Periodic Unit Price
VPRSV "Price Control Indicator
FROM MBEW
INTO CORRESPONDING FIELDS OF TABLE it_mbew_hsh
FOR ALL ENTRIES IN LI_DATA
WHERE MATNR = LI_DATA-MATNR AND
BWKEY = LI_DATA-WERKS AND
BWTAR = ''.