Skip to content

Issue writing AL code to create new dataset for sales invoice in D365 Business Central #3993

Description

  • AL Extension Version: 2048254
  • Server Version: US Dynamics NAV 12.3 (23730)

I have a very simple dataset that I created to be used for a customized sales invoice form. It starts with the sales invoice header, joins to the sales invoice line table and also pulls information from a couple of other tables.

I am trying to add the lot number that was shipped to the customer to the dataset but am having trouble doing this. Has anyone done this before or can anyone help me finish the code below?

report 50101 "Manual Invoice"
{
DefaultLayout = RDLC;
RDLCLayout = 'Manual Invoice Form.rdl';

dataset
{
    dataitem("Sales Invoice Header"; "Sales Invoice Header")
    {

        RequestFilterFields = "No.";
        column(No_; "No.")
        {

        }
        column(Sell_to_Customer_No_; "Sell-to Customer No.")
        {

        }
        column(Sell_to_Contact_No_; "Sell-to Contact No.")
        {

        }
        column(Sell_to_Customer_Name; "Sell-to Customer Name")
        {

        }
        column(Document_Date; "Document Date")
        {

        }
        column(Shipment_Date; "Shipment Date")
        {

        }
        column(Order_No_; "Order No.")
        {

        }
        column(Bill_to_Contact; "Bill-to Contact")
        {

        }
        column(Bill_to_Address; "Bill-to Address")
        {

        }
        column(Bill_to_Address_2; "Bill-to Address 2")
        {

        }
        column(Bill_to_City; "Bill-to City")
        {

        }
        column(Bill_to_County; "Bill-to County")
        {

        }
        column(Bill_to_Post_Code; "Bill-to Post Code")
        {

        }
        column(Posting_Description; "Posting Description")
        {

        }
        column(External_Document_No_; "External Document No.")
        {

        }
        column(Package_Tracking_No_; "Package Tracking No.")
        {

        }
        column(Shipping_Agent_Code; "Shipping Agent Code")
        {

        }
        column(Shortcut_Dimension_2_Code; "Shortcut Dimension 2 Code")
        {

        }
        column(Salesperson_Code; "Salesperson Code")
        {

        }
        column(Due_Date; "Due Date")
        {

        }
        column(Payment_Terms_Code; "Payment Terms Code")
        {

        }
        column(Amount; Amount)
        {

        }
        column(Remaining_Amount; "Remaining Amount")
        {

        }
        column(Amount_Including_VAT; "Amount Including VAT")
        {

        }
        column(LiftTime; LiftTime)
        {

        }
        dataitem("Shipping Agent"; "Shipping Agent")
        {
            DataItemLinkReference = "Sales Invoice Header";
            DataItemLink = "Code" = field ("Shipping Agent Code");
            column(ShippingAgentName; Name)
            {

            }
        }

        dataitem("Sales Invoice Line"; "Sales Invoice Line")
        {
            DataItemLinkReference = "Sales Invoice Header";
            DataItemLink = "Document No." = field ("No.");

            column(Document_No_; "Document No.")
            {

            }
            column(ItemNo_; "No.")
            {

            }

            column(Line_No_; "Line No.")
            {

            }
            column(Description; Description)
            {

            }
            column(Description_2; "Description 2")
            {

            }
            column(Unit_Cost; "Unit Cost")
            {
                DecimalPlaces = 2 : 2;
            }
            column(Unit_Price; "Unit Price")
            {
                DecimalPlaces = 2 : 2;
            }
            column(Quantity; Quantity)
            {

            }
            column(Quantity__Base_; "Quantity (Base)")
            {

            }
            column(GrossQty; GrossQty)
            {

            }
            column(OriginState; OriginState)
            {

            }
            column(Type_InvLine; Type)
            {

            }
            column(Location_Code; "Location Code")
            {

            }
            column(Appl__from_Item_Entry; "Appl.-from Item Entry")
            {

            }
            column(Appl__to_Item_Entry; "Appl.-to Item Entry")
            {

            }
            dataitem(Item; Item)
            {
                DataItemLinkReference = "Sales Invoice Line";
                DataItemLink = "No." = field ("No.");

                column(Type_ItemCard; Type)
                {

                }
                column(Gen__Prod__Posting_Group; "Gen. Prod. Posting Group")
                {

                }
            }
            dataitem(Location; Location)
            {
                DataItemLinkReference = "Sales Invoice Line";
                DataItemLink = "Code" = field ("Location Code");
                column(LocationName_; "Name")
                {

                }
                column(Code; Code)
                {

                }

            }

            dataitem("Item Ledger Entry"; "Item Ledger Entry")
            {
                DataItemLinkReference = "Sales Invoice Line";
                DataItemLink = "Document No." = field ("Shipment No."), "Item No." = field ("No.");
                column(Lot_No_; "Lot No.")
                {

                }

            }


        }


    }

}

requestpage
{
    SaveValues = true;
    ShowFilter = true;
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions