Skip to main content

Notifications

Business Central forum
Suggested answer

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

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.

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 69,612 Super User 2024 Season 2 on at
    RE: How can I get location code and varient code in itemLedgerEntries API

    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

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,744 Moderator on at
    RE: How can I get location code and varient code in itemLedgerEntries API

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

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

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,524 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,469 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans