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

Notifications

Announcements

No record found.

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,105 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
    95,309 Super User 2025 Season 2 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,175

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,476 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,435 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans