Cuando nos pega un DUMP por duplicidad en la tabla EKKI... SAPSQL_ARRAY_INSERT_DUPREC
Se le puede pasar este programa 'Z' para eliminar esos registros. Se le indica el pedido que da problemas y listo.
*&---------------------------------------------------------------------*
*& Report ZZEKKI01
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Title: Delete EKKI records for items before correction *
*&---------------------------------------------------------------------*
REPORT zzekki01.
TABLES: ekki, komk, ekko.
PARAMETERS: p_ebeln LIKE ekko-ebeln.
DATA: tekki LIKE ekki OCCURS 0 WITH HEADER LINE.
DATA: tkomv LIKE komv OCCURS 0 WITH HEADER LINE.
CHECK NOT p_ebeln IS INITIAL.
SELECT SINGLE * FROM ekko
WHERE ebeln = p_ebeln .
CHECK sy-subrc EQ 0.
CHECK ( ekko-bstyp EQ 'F' OR ekko-bstyp EQ 'L' ) AND
ekko-stako EQ space AND ekko-knumv NE space.
REFRESH tekki.
CLEAR komk.
komk-knumv = ekko-knumv.
CALL FUNCTION 'RV_KONV_SELECT'
EXPORTING
comm_head_i = komk
general_read = 'X'
TABLES
tkomv = tkomv.
LOOP AT tkomv WHERE kntyp EQ 'B'.
CLEAR tekki.
tekki-mandt = sy-mandt.
tekki-eknty = 'B'.
tekki-klief = tkomv-lifnr.
tekki-lifnr = ekko-lifnr.
tekki-reswk = ekko-reswk.
tekki-ebeln = ekko-ebeln.
tekki-ebelp = tkomv-kposn.
tekki-knumv = ekko-knumv.
READ TABLE tekki.
IF sy-subrc NE 0.
APPEND tekki.
ENDIF.
ENDLOOP.
DESCRIBE TABLE tekki LINES sy-tfill.
IF sy-tfill GT 0.
DELETE ekki FROM TABLE tekki.
ENDIF.