okneb1
6th December 2022, 16:42
We have a custom LN table, where we insert records directly from SQL DB (with triggers). I can see these records in LN just fine, but if I try updating any of them with db.update(xxxx,...) I always get error 201 (I have set retry.point and so on). I suspect corrupted index is the problem here, probably because records are not inserted via LN DB driver/layer. What's really interesting here is that I can update this record via GTM session, but not with code.

If I do Reorganize Table (with indices) in LN, db.update starts to work until another new record gets inserted via DB trigger. Probably because Reorginaze process also rebuilds indexes.

Does anyone have any experience working with LN records that were not inserted via LN db driver, but direclty via DB triggers or some other 3rd party software? Seems like in this scenarios LN has problems with updating records because of mismatched indexes.

mark_h
6th December 2022, 20:44
We abandoned this concept 10 or 15 years ago because we could not figure out what we were missing internally on the data dictionary for baan. I always thought it could be done, but we never could figure out exactly what it was and it was easier for us to just process a file in baan. Then the 3rd party apt could just read from baan (no updates). I hope someone has a solution.

Juergen
7th December 2022, 10:53
We have a direct DB connection with our external invoice scanning and processing system. In LN we have two own tables (Invoice heaeder and invoice positions) and in our Oracle DB we created two DB views for that tables. The external invoice system did insert records to that two DB Views.
That set-up is now working since years without any problem.

Example:
Oracle code to create DB view for Invoice header table (LN table tfacp920)
create or replace view erpln.Invoiceheader(itxSeq, itxFileId, itxCompanyCode, invInvoiceNumber, invInvoiceType, invOrderNumber,
invIncomingDate, invInvoiceDate, invValutaDate, invBookingDate, invCreditorId, invTermsOfPayment,
invCurrency, invGrossAmount, invValueOfGoods, invExtraCharges1, invExtraCharges2, invExtraCharges3,
invError, invErrortext, invStatus, invDocumentNumber, Refcntd, Refcntu)
as select t$insq, t$fiid, t$ncmp, t$invn, t$ttyp, t$orno, t$docd, t$invd, t$vald, t$bokd, t$bpid,
t$cpay, t$ccur, t$gamt, t$namt, t$xch1, t$xch2, t$xch3, t$errc, t$errt, t$stat, t$ninv, t$refcntd, t$refcntu
from erpln.ttfacp920110

From that two table the the data are further processed in LN

mark_h
7th December 2022, 15:16
I am curious - why insert with a view versus inserting straight to a table?