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 :
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

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    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()

  • Kedar Dande Profile Picture
    640 on at

    Hi Manish,

    Thanks for your response and help.

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

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 512 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 386

#3
Adis Profile Picture

Adis 259 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans