How to store the error messages in Navision while posting PO

abhishekpareekabhishekpareek Member Posts: 150
Hi All,

i have a scenario.I am developing a functionality to automate the PO Posting Process.
The process witll update the PO dynamically from another database and will post the PO automatically without user intervention.The PO psoting will be done continuously thorugh NAS.
Now it may happen that while posting the PO to receipts and invoice,some PO will not post and some PO will post.
The calling will be like this for the codeunits:

New codeunit:Call Create PO->will call Purch. Post.

Query:Whether it is possible that all the error message that will come while some PO is not posted can be traced dynamically by and store in the table?

I want to store the error messages in the temporary table so that users can see the error to find out the reasons for failure of posting.

Thanks in advance!

Regards,
Abhishek

Comments

  • garakgarak Member Posts: 3,263
    if you use for posting the PO the NAS and you use NAV >5 then you can use the function: GETLASTERRORTEXT() (search for this also the forum or / nd read the online help.

    If you use NAV <= 5 the messages will be stored into the windows eventlog.

    so, there is this idea:

    So if u use if not codeunit.run then codeunit.run <- this wrotes the error into the eventlog.
    So you can something do like this viewtopic.php?f=5&t=14129 to store the error message into the event log.
    than you get the last event from NAV (for example with WSH) from the eventlog viewtopic.php?f=23&t=9286.


    don't forgett, that the NAS doesn't like confirms and Dialogwindows. So if you use the posting codeunit also for users with guids and for the NAS you must set a

    if GuiAllowed then begin <- if this is not Set (it's false for NAS) the NAS stops working because he can't display this GUI
    Window.open('sfds')
    .....
    end;

    Regards
    Do you make it right, it works too!
  • abhishekpareekabhishekpareek Member Posts: 150
    Thanks a lot!Get last error solve my problem.

    Regards,
    Abhishek
  • garakgarak Member Posts: 3,263
    Please, no problem
    Do you make it right, it works too!
Sign In or Register to comment.