I have a problem with STARTSESSION. I'm going to try to explain. I have a code with next structure in CU5000 (ChangeComapyT is a table that i've create)
OK := STARTSESSION(SessionEvent."Session ID", CODEUNIT::ChangeCompany, CompanyDest, ChangeCompanyT);
IF NOT OK THEN
//PART1 - HEADER
IF SalesHeader.FINDFIRST THEN BEGIN
SalesHeader.VALIDATE("Sell-to Customer No.",Rec.CustomerNo);
//PART2 - LINES
IF SalesLineOri.FINDFIRST THEN
IF SalesLine.FINDFIRST THEN
UNTIL SalesLine.NEXT = 0;
UNTIL SalesLineOri.NEXT = 0;
My problem is: PART1 does not work with this code, but if I delete PART 2, PART1 works, I do not understand why this happens.
My second problem is: If i delete part 2 and I put the code in CU5000, when i do SalesHeader.VALIDATE some lines of SalesLine are modified. It seems that STARTSESSION does not run sequentially because i modified SalesLine after STARTSESSION in CU5000. I do not understand the operation of STARTSESSION very well.
I'm sorry because maybe my explanation is bad and my English is worse. Thank you very much if someone can help me.