Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

fetching ledger dimension main account for purchase order line accounting distribution through X++

(0) ShareShare
ReportReport
Posted on by 640

Hello All,

I'm creating a PO thorugh X++, Once the PO line is created, creating the accounting distribution record for the particular PO line.

But, during the creation of accounting distribution, I need to pass the Ledger dimension - Main account column value for accounting distribution, the way standard behaves/works.

It works on certain rules based on Category, Category relation & other records which are available on 'Posting' form for Purchase order.

Does anyone have idea about how do I fetch the main account values the way standard works.

Thanks in advance.

Regards,

Kedar

  • Kedar Dande Profile Picture
    640 on at
    RE: fetching ledger dimension main account for purchase order line accounting distribution through X++

    Hi Manish,

    Thanks for your response and help.

    During my analysis I found the same and using method present in InventPosting.

  • Verified answer
    Community Member Profile Picture
    on at
    RE: fetching ledger dimension main account for purchase order line accounting distribution through X++

    Hi Kedar,

    you will need Vendor posting profile and Items posting as well I believe.

    You can find the main account for Vendor like :

    mainAccount = LedgerDimensionFacade::getMainAccountFromLedgerDimension(VendLedgerAccounts::summaryLedgerDimension(VendAccount)).MainAccountId;

    Get dimensions :

    while select DefaultDimension, DisplayValue, Name
                            from defaultDimensionView
                            where defaultDimensionView.DefaultDimension == purchTable.DefaultDimension
                            {
                                dimValueContract = new DimensionAttributeValueContract();
                                dimValueContract.parmName(defaultDimensionView.Name);
                                dimValueContract.parmValue(defaultDimensionView.DisplayValue);
                                dimensionList.addEnd(dimValueContract);
                            }

    For item posting accounts you can use methods like 
    InventPosting::findByRelationsFromParameter() or InventPosting::findByAccountTypeAndItemCode()

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,110 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans