Hi All,
I getting the following error message when i try to capture the error while transferring of data from one field to other field whose datatype lengths are different .I want to capture the error in a separate field .
totable.DELETEALL;
fromtable.RESET;
fromtable.FINDFIRST;
REPEAT
totable.INIT;
totable.TRANSFERFIELDS(fromtable);
totable.INSERT;
MESSAGE(FORMAT('Error Successfully Captured'));
IF NOT errorcapture1.RUN(fromtable) THEN
totable.errortable :=COPYSTR(GETLASTERRORTEXT,250);
totable.INSERT;
//errorcapture2.RUN;
UNTIL fromtable.NEXT =0;
when i was running i got the following error mesage.
Microsoft Dynamics NAV Classic
The following C/AL functions can be used only to a limited degree during write transactions because one or more tables will be locked.
Form.RunModal is not allowed in write transactions.
CodeUnit.Run is allowed in write transactions only if the return value is not used. For example, 'OK := CodeUnit.Run()' is not allowed.
Report.RunModal is allowed in write transactions only if 'RequestForm = FALSE'. For example, 'Report.RunModal(...,FALSE)' is allowed.
DataPort.RunModal is allowed in write transactions only if 'RequestForm = FALSE'. For example, 'DataPort.RunModal(...,FALSE)' is allowed.
Use the COMMIT function to save the changes before this call, or structure the code differently.
OK
0
Answers
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Insert a commit before but be aware that there is no roll back if another error occurs. All records will be written permanently until this point.
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
IF NOT errorcapture1.RUN(fromtable) THEN
I did the following things to capture the error in nav using getlasterrortext but its throwing some error which i Have posted above.Please provide me some help..
Warm regards,
Bharath.K
The message says: Do not do any write-transactions to the database before calling "ErrorCapture.RUN" or when you have to do it, put a COMMIT before "ErrorCapture.RUN".
Thanks Hannes Its working for me .. thanks a lot