a customer of mine gets occasionally an error when invoicing saying:
"Illegal reference between stock table and stock transactions for item '99'
". The problem is that TransId in StockTans and SalesTrans is not unique,
there are two or more posts with the same TransId.
How is this possible?
I have temporarilly solved the problem with invoicing by deleting one of the
posts with same TransId in StockTable and SalesTrans table and creating it a
new post in SalesTrans, but why does this happen?
The XAL version is 3.8.1.351 (Build #351) with SQL db (2008).
Has anyone had this problem? Greatful for any ideas about cause and solution.
NHL
When the error occurred, I have run the following code:
#IF.XALAPPL
SET &NextSeq = #DB_File(FileStr(StockTrans),SEQ) + 1
INTRODUCE StockTrans[TransIdIdx,0]
LAST StockTrans
SET &TransIdMax= StockTrans.TransId
IF &TransIdMax >= &NextSeq THEN
PROCESS #PROC_XalRun 'Xal=DataRenumberTransID Parm=1'
INTRODUCE StockTrans[TransIdIdx,0]
LAST StockTrans
SET &TransIdMax= StockTrans.TransId
#IF.SQL
IF &TransIdMax >= &NextSeq THEN
SET SqlWrap::AlterXalSeq(&TransIdMax+1)
#SQLWriteLog("@SYS25994")
ENDIF
#ENDIF
ENDIF
#ENDIF
The code is from DataImport.xal and is supposed to set the next
TransId=MaxTansId +1. I thought that the kernel will go on setting following
TransId further on.
It did not work exactly right.
Any suggestions are welcome.
NHL