All good things come in threes, as they say. So here is 3.
Codeunit 50000:
OnRun()
ShipMethod.INIT;
ShipMethod.INSERT;
ShipMethod.INSERT; // This duplicate statement has been put here intentionally
Codeunit 50001:
OnRun()
IF CODEUNIT.RUN(50000) THEN
MESSAGE('OK')
ELSE
MESSAGE('LASTERRORTEXT: %1', GETLASTERRORTEXT);
First "from the bare head", but test it in NAV! Both in classic and RTC. For the latter:
- easiest: run codeunit 50001 from NAV 2013 DE
- on NAV 2009: you have to create a page with an action that executes codeunit 50001
Note
Variable ShipMethod in codeunit 50000 is linked to the Shipment Method table (10).