Skip to Content
0
Former Member
Oct 19, 2012 at 06:08 AM

Runtime Errors ITAB_DUPLICATE_KEY In ALV Report

51 Views

Hi,

Tried various hit and trial but this dump didn't get removed, plase help.

Runtime Errors ITAB_DUPLICATE_KEY
Date and Time 2012-10-19 07:57:09

Short text
A row with the same key already exists.

What happened?
Error in the ABAP Application Program

The current ABAP program "ZFIAAR_INVLIST_ALV01" had to be terminated because it
has
come across a statement that unfortunately cannot be executed.

Error analysis
An entry was to be entered into the table
"\PROGRAM=ZFIAAR_INVLIST_ALV01\DATA=I_COST" (which should have
had a unique table key (UNIQUE KEY)).
However, there already existed a line with an identical key.

The insert-operation could have ocurred as a result of an INSERT- or
MOVE command, or in conjunction with a SELECT ... INTO.

The statement "INSERT INITIAL LINE ..." cannot be used to insert several
initial lines into a table with a unique key.

Trigger Location of Runtime Error
Program ZFIAAR_INVLIST_ALV01
Include ZFIAAN_INVLIST_ALV01_FORMS
Row 1,921
Module type (FORM)
Module Name F_AUTHORITY_CHECK

1891 ELSEIF l_exit = space.
1892 p_vari = wl_variant2-variant.
1893 ENDIF.
1894
1895 ENDFORM. " F_SHOW_LIST_OF_VARIANTS
1896 *&---------------------------------------------------------------------*
1897 *& Form F_AUTHORITY_CHECK
1898 *&---------------------------------------------------------------------*
1899 * text
1900 *----------------------------------------------------------------------*
1901 * --> p1 text
1902 * <-- p2 text
1903 *----------------------------------------------------------------------*
1904 form F_AUTHORITY_CHECK .
1905
1906 SELECT bukrs ktopl periv
1907 FROM t001 INTO TABLE i_t001
1908 WHERE bukrs IN s_bukrs.
1909 IF sy-subrc IS NOT INITIAL.
1910 MESSAGE e000 WITH text-130.
1911 ELSE.
1912
1913 *** Select Asset Class
1914 IF s_anlkl[] IS NOT INITIAL.
1915 SELECT anlkl FROM anka INTO TABLE i_anka
1916 WHERE anlkl IN s_anlkl.
1917 ENDIF.
1918
1919 *** Select Cost Center
1920 IF s_kostl[] IS NOT INITIAL.
>>>>> SELECT kostl FROM csks INTO TABLE i_cost
1922 WHERE kostl IN s_kostl.
1923 ENDIF.
1924
1925 *** Select Plant
1926 IF s_werks[] IS NOT INITIAL.
1927 SELECT werks FROM t001w INTO TABLE i_t001w
1928 WHERE werks IN s_werks.
1929 ENDIF.
1930
1931 LOOP AT i_t001 INTO wa_t001.
1932
1933 *** Authorization object Asset class
1934 PERFORM f_auth_object_anlkl.
1935
1936 *** Authorization object Cost center
1937 PERFORM f_auth_object_kostl.
1938
1939 *** Authorization object Plant
1940 PERFORM f_auth_object_werks.

In TOP Include:

TYPES: BEGIN OF tp_cskt,
spras TYPE cskt-spras,
kokrs TYPE cskt-kokrs,
kostl TYPE cskt-kostl,
ltext TYPE cskt-ltext,
END OF tp_cskt,

BEGIN OF tp_cost, "Cost Center Master Data
kostl TYPE csks-kostl, "Cost Center
END OF tp_cost.

DATA: i_cskt TYPE STANDARD TABLE OF tp_cskt,
wa_cskt TYPE tp_cskt,

i_cost TYPE SORTED TABLE OF tp_cost
WITH UNIQUE KEY kostl,
wa_cost TYPE tp_cost.

In FORMS Include:

SORT: i_cskt BY kostl,
i_ankt BY anlkl.