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, ...
Suggested Answer

legder account need to update in PO product receipt in AX 2012 R3

(0) ShareShare
ReportReport
Posted on by 56

hi all,

PO- Product receipt

I have created a PO. Confirmed and then Product receipt. It is done

Product receipt journal - Voucher - 

3187.J1.jpg

In the place of ledger account 135101 , I wants to update to ledger account 135018

To do this , I wrote in below class and method

Class - PurchPackingSlipJournalPost 

Method - UpdateJournalLine 

purchTables = PurchTable::find(purchTable.PurchId);

    if(purchTables.MiscPurchaseOrder == NoYes::Yes)
    {
        markupTables = MarkupTable::find(purchTables.ModuleType, purchTables.MarkupCode);

        if (PurchParameters::find().MiscPO== NoYes::Yes)
        {
            ledgerDimensionMerged = DimensionDefaultingService::serviceCreateLedgerDimension(markupTables.VendorLedgerDimension, purchTables.DefaultDimension);
        }
        else
        {
            ledgerDimensionMerged = DimensionDefaultingService::serviceCreateLedgerDimension(markupTables.VendorLedgerDimension);//, this.defaultDimension());
        }
    }
    else
    {
        ledgerDimensionMerged = DimensionDefaultingService::serviceCreateLedgerDimension(formletterProvider.ledgerDimensionLineAmount());//, this.defaultDimension());
    }

It is not showing the ledger account 135018 but in Markup table it is showing the ledger account 135018 and also I passed parameter

ledgerDimensionMerged = DimensionDefaultingService::serviceCreateLedgerDimension(markupTables.VendorLedgerDimension, purchTables.DefaultDimension);

Still it is showing ledger account 135101 after PO product receipt.

7701.J2.jpg

Is my above class , method and code is correct ?

Kindly let me know how to achieve this.

Please give me more shed on this.

thanks!

I have the same question (0)
  • @rp@n Profile Picture
    56 on at

    can anyone help me on this please

  • Suggested answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hi @rp@n,

    I would recommend that you make a manual ledger adjustment for your account 135101.

    Trying to manipulate the data by code might not only result in technical issues with the valuation and pricing of your item but also your auditors might make problems.

    What stops you from posting a manual correction transaction e.g. in a GL journal?

    Best regards,

    Ludwig

  • @rp@n Profile Picture
    56 on at

    Sorry Ludwig, not understand. 

    Kindly elaborate please 

  • Suggested answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hi @rp@n,

    You cannot simply adjust and change a purchase price variance transaction this way.

    This might create a mess in inventory valuation and accounting.

    Please talk with your colleagues who recorded the transaction and ask them to correct it via the user interface, i.e. in the AX2012 R3 without applying any code.

    Best regards,

    Ludwig

  • @rp@n Profile Picture
    56 on at

    Thanks Ludwig,

    As you said  "You cannot simply adjust and change a purchase price variance transaction this way".

    You mean to say is it impossible?

    Please give me more shed on this

  • @rp@n Profile Picture
    56 on at

    Hi Ludwig,

    Is it impossible to do through code , which i am trying to achieve? Is it only possible through manual?

    Kindly elaborate me please

  • @rp@n Profile Picture
    56 on at

    Hi Ludwig,

    Kindly elaborate me please whether its possible or not through code.

  • Suggested answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Good morning @rp@n,

    With making a code adjustment almost everything is possible.

    Yet, I would consider this (a) as illegal from an accounting / auditing perspective and (b) risky, as it might mess up your inventory valuations and result in subsequent issues that require additional corrections.

    Your accounting colleagues can make a manual correction in the AX client and I would recommend that you reach out to them and ask them to make this manual adjustment.

    Best regards,

    Ludwig

  • @rp@n Profile Picture
    56 on at

    Thanks Ludwig for your quick response.

    This is new requirement from customer . So, I am working on this.

    Anyhow I have to do this.

    As technical view, is my code is correct ? And the class and method? Which I mentioned above 

    Please give me more shed on this 

  • @rp@n Profile Picture
    56 on at

    Ludwig,

    I have also done code in 

    Class - InventoryMovement

    Method - UpdateLedgerAdjust

    if (this.mustBeBookedOperations())
            {
                purchLine = buffer as PurchLine;
                purchTable = PurchTable::find(purchLine.PurchId);
                markupTable = MarkupTable::find(purchTable.ModuleType, purchTable.MarkupCode);
    
                if(purchTable.MiscPurchaseOrder == NoYes::Yes)
                {
                    ledgerVoucherTransObject = LedgerVoucherTransObject::newTransactionAmountDefault(
                                                ledgerVoucherObject,
                                                this.postingOperations(),
                                                DimensionDefaultingService::serviceCreateLedgerDimension(
                                                markupTable.VendorLedgerDimension,
                                                (PurchParameters::find().MiscPO == NoYes::Yes && !PurchTable.IsLRCChargeCode(purchTable.HCLMarkupCode))? purchTable.DefaultDimension : this.defaultDimension()),
                                                CompanyInfo::standardCurrency(),
                                                -_costAmount,
                                                currencyExchHelper);
                }
                else
                {
                    ledgerVoucherTransObject = LedgerVoucherTransObject::newTransactionAmountDefault(
                                                ledgerVoucherObject,
                                                this.postingOperations(),
                                                DimensionDefaultingService::serviceCreateLedgerDimension(this.accountOperations(),this.defaultDimension()),
                                                CompanyInfo::standardCurrency(),
                                                -_costAmount,
                                                currencyExchHelper);
                }
    
            }

    Please give me more shed on this.

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 635

#2
André Arnaud de Calavon Profile Picture

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

#3
CP04-islander Profile Picture

CP04-islander 356

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans