Duplicate records are created in INTran during Purchase Order release

This article provides a resolution for the issue that duplicate inventory transactions are created during Purchase Order release in Microsoft Dynamics SL.

Applies to:   Microsoft Dynamics SL
Original KB number:   2953073

Cause

This problem can occur when you press the Cancel button during the Purchase Order Batch Release (04.400.00) process for a batch that has receipts that use a Purchase For of Good for Sales Order, or Non-Inventory Goods if there is a Project ID included on the detail line.

Resolution

Determine the duplicate record in the INTran table, and then delete the duplicate record. To do this, follow these steps:

  1. In Microsoft SQL Server Management Studio, access the appropriate application database. Then, run the following statement to determine whether duplicate records exist in the INTran table.

    SELECT InvtID, TranAmt, LineRef, RecordID, * FROM INTran WHERE BatNbr = '<XXXXXX>'
    

    Note

    In the statement, replace the <XXXXXX> placeholder with the batch number.

  2. Review the results to determine whether duplicate records exist. If a duplicate record exists, run the following statement to delete it.

    Note

    The recordid to delete would be the HIGHER of the duplicate records.

    Run this first:

    Begin Transaction
    

    Run this next:

    DELETE FROM INTran WHERE BatNbr = '<XXXXXX>' and RecordID = <YYYYYY>
    

    Note

    In the statement, replace the <XXXXXX> placeholder with the batch number. Replace the <YYYYYY> placeholder with the RecordID value of the record that you want to delete.

    The delete should return one row.

    Run this last:

    Commit transaction
    

    If it does not delete just one row, run this:

    Rollback transaction
    

    If you find more than one duplicate, you have to identify the recordid (unique) for the other duplicates and delete them by using the same procedure.