web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Can't Close Shift in POS

(0) ShareShare
ReportReport
Posted on by 2,259

Hello!

I'm trying to close shift in one of the POS but an error shows and the following in event viewer..

LSRetailPosis.POSProcesses.POSProcessThread: System.Data.SqlClient.SqlException (0x80131904): Violation of PRIMARY KEY constraint 'I_-1033447763_133955128'. Cannot insert duplicate key in object 'ax.RETAILPOSBATCHTABLE'. The duplicate key value is (TA01, TA01POS02, 19, sh).
The statement has been terminated.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at LSRetailPosis.DataAccess.DataUtil.DBUtil.Execute(SqlInsert SqlInsert)
   at LSRetailPosis.DataAccess.BatchData.CloseBatch(Batch batch)
   at Microsoft.Dynamics.Retail.Pos.EOD.EOD.CloseShift(IPosTransaction transaction)
   at LSRetailPosis.POSProcesses.CloseShift.Execute()
   at LSRetailPosis.POSProcesses.Operation.RunOperation()
   at LSRetailPosis.POSProcesses.POSProcessThread.ThreadProc()
ClientConnectionId:44fbe122-265a-4683-aef2-dd2f57c8be22.

can anyone help with this please

*This post is locked for comments

I have the same question (0)
  • SHOXF Profile Picture
    490 on at

    Wasim Please delete the duplicate record in  ax.RETAILPOSBATCHTABLE store data base and try to close the shift again.

  • w.sallam Profile Picture
    2,259 on at

    thanks Muhammad for your reply,

    just want to know if there will be any issue if deleted the record from the database,

    I will try to back up first anyway.

  • SHOXF Profile Picture
    490 on at

    I didn't faced any issue after deleted. But take backup of this table before using delete command

  • Suggested answer
    Shafeeque P. Profile Picture
    6,533 Moderator on at

    There are chances you may run in to the same issue when you close the shift next day if you used delete the duplicate record option . Retail POS gets the next number sequence shift number, transaction number, receipt ID etc from posseedvalue table and is sometimes cached in isolated storage folder in Retail POS. In some cases, the cache may get corrupted or the posseedvalue table goes blank, the system will start all the number sequence from 1 which the POS may accept if the old transactions were deleted as per your data retention policy in functionality profile. However, the data will not be inserted in HQ after running the P job as a transaction with the same transactionid and terminal already exist in the store.

    In your case, deleting the duplicate key may resolve problem. However, this data will not be inserted in HQ due to primary key violation. The best approach in your case is to investigate what made shift number to reset. If you see that all the past transaction has been replicated to HQ. Use the POS redeployment function to calculate and push the correct next numbers as per the data you have in HQ.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans