SAP Issue - "This entry already exists in the following tables"

Follow

Comments

4 comments

  • Avatar
    Morten Pedersen

    Update:
    We have received a workaround from a partner that can be used if you are in a hurry:
    "Deleting all object and boy tables will solve the problem. But is a lot of work."

    Update 2:
    A partner has gotten the following fix from SAP:

    Update ONNM Set AutoKey = (select MAX(DocEntry) + 1 from
    [@BOY_41_FUNCTIONS]) WHERE ObjectCode
    = 'BOY_41_FUNCTIONS'

    Please only use this and test databases. For live databases contact SAP support to verify the fix.

  • Avatar
    Morten Pedersen (Edited )

    Update 3: 
    A partner has gotten a fix and a SQL that detects the issue from SAP:

    /* Detect affected rows */

    SELECT A.ObjectCode, A.AutoKey, B.Autokey + 1
    FROM ONNM AS A
    JOIN (
    SELECT 'BOY_BUTTONS_EX' AS [ObjectCode], MAX(DOCENTRY) AS [AutoKey] FROM [@BOY_BUTTONS_EX] UNION ALL
    SELECT 'BOY_40_CONFIG' AS [ObjectCode], MAX(DOCENTRY) AS [AutoKey] FROM [@BOY_40_CONFIG] UNION ALL
    SELECT 'BOY_41_FUNCTIONS' AS [ObjectCode], MAX(DOCENTRY) AS [AutoKey] FROM [@BOY_41_FUNCTIONS] UNION ALL
    SELECT 'BOY_63_SCONFIG' AS [ObjectCode], MAX(DOCENTRY) AS [AutoKey] FROM [@BOY_63_SCONFIG] UNION ALL
    SELECT 'BOY_IPT' AS [ObjectCode], MAX(DOCENTRY) AS [AutoKey] FROM [@BOY_IPT] UNION ALL
    SELECT 'BOY_MANDATORY' AS [ObjectCode], MAX(DOCENTRY) AS [AutoKey] FROM [@BOY_MANDATORY] UNION ALL
    SELECT 'BOY_B1UP_USERGROUP' AS [ObjectCode], MAX(DOCENTRY) AS [AutoKey] FROM [@BOY_B1UP_USERGROUP]
    ) AS B ON A.ObjectCode = B.Objectcode AND A.Autokey <> (B.Autokey + 1)

    /* Correct affected rows */

    UPDATE A
    SET A.Autokey = (B.Autokey + 1)
    FROM ONNM AS A
    JOIN (
    SELECT 'BOY_BUTTONS_EX' AS [ObjectCode], MAX(DOCENTRY) AS [AutoKey] FROM [@BOY_BUTTONS_EX] UNION ALL
    SELECT 'BOY_40_CONFIG' AS [ObjectCode], MAX(DOCENTRY) AS [AutoKey] FROM [@BOY_40_CONFIG] UNION ALL
    SELECT 'BOY_41_FUNCTIONS' AS [ObjectCode], MAX(DOCENTRY) AS [AutoKey] FROM [@BOY_41_FUNCTIONS] UNION ALL
    SELECT 'BOY_63_SCONFIG' AS [ObjectCode], MAX(DOCENTRY) AS [AutoKey] FROM [@BOY_63_SCONFIG] UNION ALL
    SELECT 'BOY_IPT' AS [ObjectCode], MAX(DOCENTRY) AS [AutoKey] FROM [@BOY_IPT] UNION ALL
    SELECT 'BOY_MANDATORY' AS [ObjectCode], MAX(DOCENTRY) AS [AutoKey] FROM [@BOY_MANDATORY] UNION ALL
    SELECT 'BOY_B1UP_USERGROUP' AS [ObjectCode], MAX(DOCENTRY) AS [AutoKey] FROM [@BOY_B1UP_USERGROUP]
    ) AS B ON A.ObjectCode = B.Objectcode AND A.Autokey <> (B.Autokey + 1)

    Again please only use this and test databases. For live databases contact SAP support to verify the fix.

  • Avatar
    Greg Lewis

    I get the following error when attempting update #3:

     

     

     

  • Avatar
    Morten Pedersen

    Hi Greg,

    I have updated the SQL to be correct. It had one UNION ALL to many.

Please sign in to leave a comment.

Powered by Zendesk