Sometimes you need to make some customizations to default reports. A natural behavior would be saving the report in the 50000 range. For documents like Sales Invoice you can simply change the Report Selections, but what if you need to change for example “Detail Trial Balance” (Report 4) or “Whse. – Posted Receipt” (Report 7308).
The “Detailed Trail Balance” is called from several places like the MenuSuite and the “G/L Account List” page. When it comes to printing the “Whse. – Posted Receipt” you need to make multiple modifications like Codeunit “Warehouse Document-Print” and “Whse.-Post Receipt + Pr. Pos.”.
Modifying all these places is not that interesting to do. You can simply comment the default code and call the new 50000 report instead. Or you can also do it the PRS way by disabling the default code by calling “IF CodeunitxyzHook.OnBeforePrintReport THEN”. And then run the custom report in your hook with an EXIT(FALSE) as last code.