Sales Line record variable does not get new data after commit

Hello.

I have a strange error.

We have own codeunit which does some steps of automatic order process, such as updates free quantity in lines, stores order in archive and etc.

COMMIT calls after each step of processing, so I can see in debug mode that correct values has been written to database. And at the same time I can see in parallel opened NAV app that values are on their places. I hope you understand me.

Strange things begin when at one step calls procedure form standart codeunit 5063 - Archive Management

IsSalesHeaderArchived(Rec : Record “Sales Header”) : Boolean
WITH Rec DO BEGIN
CLEAR(ArchiveManagement);
ArchiveManagement.ArchSalesDocumentNoConfirm(Rec);
END;
EXIT(TRUE);

At this point Sales Lines differ from it was before starting autoprocess. I can see it in database, but…

This piece of code from Archive Management codeunit. (Standart, not modified):

SalesLine.RESET;
SalesLine.SETRANGE(“Document Type”,SalesHeader.“Document Type”);
SalesLine.SETRANGE(“Document No.”,SalesHeader.“No.”);
IF SalesLine.FINDSET THEN
… at this point I see in debug that there are old Sales Lines! As they were before autoprocess started! And ArchiveManagement stores order with old lines!

At the same time I look in parallel opened NAV that Sales Lines are new.

So the problem that in debug sales lines record does not get new data from database, even if I call CLEAR and CLEARALL.

Is this a kind of memory overflow or something?

This error appears on clients test base, and on our test base does not appear.

Bases are almost the same. Nav 5.0 SP1. All objects synchronized.

I don’t know what to do.
thanks in advance for any help.

hey guys, I found the solution which works.

I replaced FINDSET’s and FIND(’-’) with non-cursor FINDFIRST!

When I use FINDFIRST it gets the last fresh data from database, but when I use FINDSET it retrieves old not modified data!!!

I don’t know if it’s right or wrong, but it works and it is most important thing at this moment.