04-14-2010 9:51 AM
Im trying to use hash table in a program but Im gettin an error I cant understand...
DATA gt_kna1 TYPE HASHED TABLE OF kna1 WITH UNIQUE KEY kunnr.
SELECT kunnr INTO TABLE gt_kna1
FROM kna1.
Im gettin this error:
An entry was to be entered into the table "\PROGRAM=ZTABLA_HASH\DATA=GT_KNA1" (which should havehad a unique table key (UNIQUE KEY)).
However, there already existed a line with an identical key.
But this is impossible, the field kunnr is key in table kna1.
Does Anybody know why Im gettin this dump?
Regards
04-14-2010 10:00 AM
Hi,
Use this code now it will not go dump.
DATA gt_kna1 TYPE HASHED TABLE OF kna1 WITH UNIQUE KEY kunnr.
SELECT kunnr INTO corresponding fields of TABLE gt_kna1
FROM kna1.
Regards and Best wishes.
04-14-2010 10:09 AM
Try this way
TYPES: BEGIN OF TY_KUNNR,
KUNNR LIKE KNA1-KUNNR.
TYPES: END OF TY_KUNNR.
DATA: IT_KUNNR TYPE HASHED TABLE OF TY_KUNNR WITH UNIQUE KEY KUNNR.
SELECT KUNNR INTO TABLE IT_KUNNR
FROM KNA1
a®