it seems as though there is already a Recref variable thats been opened.
you could either close that recref first (although it may be required with other code).
or specify another recref variable.
Whereabouts is the code you're trying to execute?
I mean to say that there is nothing is wrong with the code as it runs perfectly on 4.3 database
RecordRef.OPEN(tableno) is the point where i get the error message
RecordRef variable has not been closed.You must close the RecordRef with close before opening a new table
on a 5.0 DB[/code]
It seems that there is new check in NAV 5.0 and it is why "there is nothing wrong in NAV 4.0". If you are opening new record without closing previous one it leads to memory leaks, NAV 5.0 is checking this and it means you need to change your code to be able to run under NAV 5.0. That something works under older version and not under new one doesn't mean that there is bug or something, it can be new "feature"... 8)
It seems that there is new check in NAV 5.0 and it is why "there is nothing wrong in NAV 4.0". If you are opening new record without closing previous one it leads to memory leaks, NAV 5.0 is checking this and it means you need to change your code to be able to run under NAV 5.0.
Argh! How stupid ](*,)
Why on earth did Microsoft "solve" it like this? Why didn't they simply always close RecordRefs before opening them? It should be possible to do very simple in the implementation of the OPEN function. Now all C/AL developers have to go through all the code using RecRef and insert a silly line before using this function. What a waste of time and a lot of changes in code that needs to be reviewed and tested and validated... #-o
Edit: I thougt the problem was with both OPEN and GETTABLE, but it seems GETTABLE doesn't care if it has been used before. This makes it even more strange...
Comments
you could either close that recref first (although it may be required with other code).
or specify another recref variable.
Whereabouts is the code you're trying to execute?
RecordRef.OPEN(tableno) is the point where i get the error message on a 5.0 DB[/code]
GD
also, is this standard NAV 5 or has any customizations been done to the object?
It seems that there is new check in NAV 5.0 and it is why "there is nothing wrong in NAV 4.0". If you are opening new record without closing previous one it leads to memory leaks, NAV 5.0 is checking this and it means you need to change your code to be able to run under NAV 5.0. That something works under older version and not under new one doesn't mean that there is bug or something, it can be new "feature"... 8)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
GD
Why on earth did Microsoft "solve" it like this? Why didn't they simply always close RecordRefs before opening them? It should be possible to do very simple in the implementation of the OPEN function. Now all C/AL developers have to go through all the code using RecRef and insert a silly line before using this function. What a waste of time and a lot of changes in code that needs to be reviewed and tested and validated... #-o
Edit: I thougt the problem was with both OPEN and GETTABLE, but it seems GETTABLE doesn't care if it has been used before. This makes it even more strange...
Peter