Hi, Scenario: Before starting Posting of a P.O., i would initialize some fields for few items in Item Table and after completion of Posting process, re-intialize the same items with another value or zero. *If the Posting process is successful, we can put the code in related codeunit to do the job. But Issues involved: I need to re-initialize the fields in case the Posting process stops at any place due to any run-time error also. As we know a run-time error can occur many places. Requirement is: How to return the control to a particular place/function on abrupt termination of the Posting process execution . Constraint: I don’t want to use any Timer Controls. Regards
Look report 296 ( Batch Post Sales Orders). This report run Codeunit 90, and intercept errors. Look at form.runmodal help. You can open a form with a specific control. Exemple: if not cPurcOrder.run(rPurcahOrder)then begin rItem.get(xx) end else begin CurrForm.“No.”.ACTIVATE; end;
Hi Agustin, I have been through the report/code but don’t think it helps solve my problem. Why: Imagine the code below is run (report 296): IF SalesPost.RUN(“Sales Header”) THEN BEGIN If we follow thru’ in CU 80 if we assume that any of the details on which testfield is applied isn’t existing(code below): WITH SalesHeader DO BEGIN TESTFIELD(“Document Type”); TESTFIELD(“Sell-to Customer No.”); TESTFIELD(“Bill-to Customer No.”); TESTFIELD(“Posting Date”); The processing halts there permanently due to run-time error and control is discarded here and not returned to the report from which it was invoked. What i need exactly is, if an error occurs at any point of time at any place due to some data/info. missing or not defined, the control must be returned back to one pre-defined place to run some procedure. To put it more clearly, if i have a Message defined in Report 296; Message(‘You are going to run Sales Header’); Let’s assume it’s executed once and when running CU 80, Posting Date isn’t defined i want the program to not stop here but go and execute/display my Message again. *The constraint is problem can occur at any place and many conditions so how to address it? I hope i’m clear. Regards Edited by - Rahimuddin on 2002 Jul 30 16:01:14
Look report 296, 297 or 298. In each report, if Sales headers are correctely posted, counter window is increased. If there’s no customer, item, vat group, etc., report 296 don’t increase counter. Do you modify codeunit 80? Do you delete final commit? You can run report 296 via: sales & Receivables, Orders, Posting, buton, Post Batch You can run report 297 via: sales & Receivables, Invoices, Posting, buton, Post Batch You can run report 298 via: sales & Receivables, Credit memo, Posting buton, Post Batch In Object designer, look Codeunit.run and press Help (F1). It returns boolean.