web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

How can I get location code and varient code in itemLedgerEntries API

(0) ShareShare
ReportReport
Posted on by 15

Hi

 

I am using API itemLedgerEntries and when I am extracting this report from business central it provides two extra columns i.e Variant_Code and Location_code.

How can I get these two in itemLedgerEntries API.

I have the same question (0)
  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,161 Moderator on at

    If you want to achieve that you need to develop a custom API as described here:

    docs.microsoft.com/.../devenv-develop-custom-api

  • Suggested answer
    YUN ZHU Profile Picture
    97,970 Super User 2026 Season 1 on at

    Hi, Unfortunately, there is nothing you can do.

    As shown below, API page type cannot be extended by creating a page extension object. Instead, you must create a new API by adding a page object.

    pastedimage1655858237006v1.png

    So, you will need to follow the link provided by Inge and create a new API page to do so.

    Here is the standard itemLedgerEntries page code that you use, hope it helps you.

    page 30069 "APIV2 - Item Ledger Entries"
    {
        APIVersion = 'v2.0';
        EntityCaption = 'Item Ledger Entry';
        EntitySetCaption = 'Item Ledger Entries';
        DelayedInsert = true;
        DeleteAllowed = false;
        Editable = false;
        EntityName = 'itemLedgerEntry';
        EntitySetName = 'itemLedgerEntries';
        InsertAllowed = false;
        ModifyAllowed = false;
        PageType = API;
        SourceTable = "Item Ledger Entry";
        Extensible = false;
        ODataKeyFields = SystemId;
    
        layout
        {
            area(content)
            {
                repeater(Group)
                {
                    field(id; SystemId)
                    {
                        Caption = 'Id';
                        Editable = false;
                    }
                    field(entryNumber; "Entry No.")
                    {
                        Caption = 'Entry No.';
                        Editable = false;
                    }
                    field(itemNumber; "Item No.")
                    {
                        Caption = 'Item No.';
                    }
                    field(postingDate; "Posting Date")
                    {
                        Caption = 'Posting Date';
                    }
                    field(entryType; "Entry Type")
                    {
                        Caption = 'Entry Type';
                    }
                    field(sourceNumber; "Source No.")
                    {
                        Caption = 'Source No.';
                    }
                    field(sourceType; "Source Type")
                    {
                        Caption = 'Source Type';
                    }
                    field(documentNumber; "Document No.")
                    {
                        Caption = 'Document No.';
                    }
                    field(documentType; "Document Type")
                    {
                        Caption = 'Document Type';
                    }
                    field(description; Description)
                    {
                        Caption = 'Description';
                    }
                    field(quantity; Quantity)
                    {
                        Caption = 'Quantity';
                    }
                    field(salesAmountActual; "Sales Amount (Actual)")
                    {
                        Caption = 'Sales Amount (Actual)';
                    }
                    field(costAmountActual; "Cost Amount (Actual)")
                    {
                        Caption = 'Cost Amount (Actual)';
                    }
                    field(lastModifiedDateTime; SystemModifiedAt)
                    {
                        Caption = 'Last Modified Date';
                    }
                }
            }
        }
    
        actions
        {
        }
    }

    Thanks.

    ZHU

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,161 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,046 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 932 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans