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

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

#1
Martin Dráb Profile Picture

Martin Dráb 584 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 499 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 254 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans