Prevent Report Combine Shipments from stopping when error

poppinspoppins Member Posts: 647
edited 2015-05-08 in NAV Three Tier
Hi everyone,

I need to make standard report 295 "Combine Shipments" work like standard report 296 "Batch Post Sales Orders", meaning if there is an error, the treatment does not stop and the error mesage is not displayed.
How shall I proceed about that?

Thanks in advance :mrgreen:

Comments

  • poppinspoppins Member Posts: 647
    At least, can anyone tell me how codeunits like codeunit 80 or 90 work on error handling (when error they don't stop but move to the next order)?
  • Jan_VeenendaalJan_Veenendaal Member Posts: 206
    Actually codeunits 80 and 90 DO stop on error. It is the calling process that continues (like report 296 Batch Post Sales Orders) , using the IF CODEUNIT.RUN ... construct:
    IF IsApprovedForPostingBatch THEN
      IF SalesPost.RUN("Sales Header") THEN BEGIN
        CounterOK := CounterOK + 1;
    
    Jan Veenendaal
  • poppinspoppins Member Posts: 647
    Actually codeunits 80 and 90 DO stop on error. It is the calling process that continues (like report 296 Batch Post Sales Orders) , using the IF CODEUNIT.RUN ... construct:
    IF IsApprovedForPostingBatch THEN
      IF SalesPost.RUN("Sales Header") THEN BEGIN
        CounterOK := CounterOK + 1;
    
    Yes I know :mrgreen:
    May be I didn't explain what I need clearly, but this is what I want, I want the calling process to continue with no error message shown...
    How can I perform that?
  • Jan_VeenendaalJan_Veenendaal Member Posts: 206
    So all you need to do is create a process that selects all records to be processed, and let that process call your codeunit (this only works for codeunits) for each record:
    use IF CODEUNIT.RUN(CODEUNIT::MyCodeunit, Rec) THEN ...
    or use IF MyCodeunit,RUN(Rec) THEN ...

    And it will work. You might want to use GETLASTERRORTEXT / CLEARLASTERROR commands to be able to store the errormessages you get during the process.
    Jan Veenendaal
Sign In or Register to comment.