Skip to Content
0
Jun 17, 2009 at 05:36 PM

abap bug? insert lines of ... into (sorted unique) table creates duplicates

114 Views

Hello,

what I read in this wiki (https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/sorted+UniqueTablewithnon-unique++entries) was very much surprising : it says that "If we insert entries of a sorted table ( unique or non-unique ) to a sorted unique empty table by INSERT LINES OF t_itab INTO TABLE t_itab1 statement , the target table would be populated with duplicate entries if any." (the 2 conditions in bold MUST BE true).

I thought an internal table with unique key couldn't have duplicates of course. But this wiki is right! TRY IT!

How does SAP consider that, is this a bug, or is it a bug in SAP documentation (http://help.sap.com/saphelp_nw70/helpdata/EN/fc/eb361f358411d1829f0000e829fbfe/content.htm) because it doesn't specify this exception ; it just says "The system inserts the lines of table itab1 one by one into table itab2 using the same rules as for single lines."

For single lines, the same SAP library says "If the internal table has a unique key, lines whose key already exists in the table will not be inserted and sy-subrc is set to 4."

Do you have a SAP URL or SAP note which explains that ?

Thank you for your opinion and inputs!