I’m new to Navision and have been given the wonderful task of editing reports however I am having difficulty adding fields to reports which do not exist in the field menu (in sections)…I’m hoping someone can help?
I’m trying to add a field (‘Reason Code’) to the ‘Item Register Quantity’ report however ‘Reason code’ does not appear on the field menu, how do i go about adding this to the report.
Which table does the report use? If “Reason Code” is not a field in that table, you will have to retrieve the value some place else, and store the value in a variable that you can assign to a text box. You will have to add some C/AL code to do that.
Just had a quick look at the two tables that you mentioned, but haven’t been able to find the field REASON CODE that you want. There is a field called RETURN REASON CODE - not sure if this is what you want?!?
However, how new to Navision are you? Because for instance, the REASON CODE field (F73) does exist against the Sales Shipment Header table (T110), and shipments do have related entries in the Item Ledger Entry table which is in your report. So maybe what you need to do is in your report, while going through the item ledger entries, lookup the related document (my example above would be to look in table 110), get the record and then return the source code back into a variable and then print that in the section.
Item Ledger Entry
Entry No. Item No. Posting Date Entry Type Source No. Document No.
62944 12345 01/05/08 Sale CUST001 SHP67890
When I come across this item ledger entry, do the following (as I know it’s a shipment, but you will need to have some logic built to decide what table to lookup);
SalesShipmentHeader.SETRANGE(“Sell-to Customer No.”, ‘CUST001’);
IF SalesShipmentHeader.FIND(’-’) THEN
ReasonCode := SalesShipmentHeader.“Reason Code”;
Note: ReasonCode is a variable of the same type and subtype as the field Reason Code in the Sales Shipment Header