I run Navision 3.7 client to do development in a 3.6 Navision database.
I have the following problem, and hope somebody can shed some light on this for me:
We had our purchases & payables section customised, and a Goods Returned items was added. This form makes use of a header and lines table respectively.
The header table has amongst others, two fields for the record number. The [No.] field initially contains a pre-post number for the goods returned note, while the [Pre-Assigned No.] field contains the post-post number. During the posting procedure, the two numbers are swopped.
I would like to email a HTML representation of the goods returned note to various users. For that, I created a report.
After the goods returned note is successfully posted, I run a procedure to create the HTML file, and email that off. So, from start to finish, the whole posting and emailing process happens in one transaction.
My problem is this:
If I run the report like this -
REPORT.RUN(50072, FALSE, FALSE, GoodsRetHeader)
the report prints fine, but if I use -
REPORT.SAVEASHTML(50072, FilenameHTML, FALSE, GoodsRetHeader)
I get the following error:
The E-M Purch. Goods Ret. Header does not exist.
Identification fields and values:
UnPosted/Posted='Unposted',No.='GRR05507'
The fields identified by the error message are from the header record BEFORE the post. If I debug and look at the actual record just before the report is run, the UnPosted/Posted field contains the value 'Posted' , while the No. field contains 'GRP05324'.
This leads me to believe that somehow, the copy of the header table used in report 50072, when using the REPORT.SAVEASHTML method, is out of sync with the header table after the posting was done. To try and remedy this, I've tried to do a COMMIT followed by a SELECTLATESTVERSION after the posting procedure and before the report is generated. This had no effect. So now I'm stuck!
Has anybody ever had a similar issue with REPORT.SAVEASHTML, and if so, how do I solve this?
Thanks,
Charl
Comments
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
It seems that the table's key gets renamed during the post procedure, but even if I make use of temporary tables to get the data to the report (with the report also printing from a temp table), I still get the same error.
There is definately something wrong with these two functions, because the RUN and RUNMODAL functions works fine.
Charl
It seems that the posting routine creates a new record for the posted return, using the info from the unposted return record.
Once the posting routine finishes, the unposted record gets deleted. Now, this doesn't seem to be a problem for printed reports, but an error occurs when you try to run the SAVEASHTML or SAVEASXML functions. I even created a dataport which I tried to run using the RUN and RUNMODAL functions. Both caused the same error.
So, my solution : just add the deleted record back into the table again, run my report, then delete it again.
Bada bing! Problem solved!!
:roll:
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n