Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

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

Posted on by 5,901

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!

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: legder account need to update in PO product receipt in AX 2012 R3

    Hi @rp@n ,

    I recommend you to talk to your customer, as well as the financial consultant of this project. They should talk to the financial auditor of the customer and get a written approval before messing up with historical transactions. Please show this discussion to the decision makers of your customer - since they are ultimately responsible if something illegal is done.

  • Suggested answer
    ergun sahin Profile Picture
    ergun sahin 8,812 Super User 2024 Season 1 on at
    RE: legder account need to update in PO product receipt in AX 2012 R3

    Where you wrote it is correct. You can look at the postline of the same class or PurchPackingSlipJournalCreate should have a method called createJournalLine. You can check there.

    You can go in reverse and debug the insert of the table and see where it changed.

    You can do the post process yourself, not using the standard structure.

    But I think we should not solve this request with code. No matter how careful you are, garbage records will remain and will confuse accounts.

  • Ludwig Reinhard Profile Picture
    Ludwig Reinhard Microsoft Employee on at
    RE: legder account need to update in PO product receipt in AX 2012 R3

    Personally, I would consider this as falsification of your data and would recommend not changing a posted voucher this way.

    Maybe some other community members can help you with your code.

    All the best,

    Ludwig

  • @rp@n Profile Picture
    @rp@n 5,901 on at
    RE: legder account need to update in PO product receipt in AX 2012 R3

    What changes are required in my code.

    Can anyone reply me on this please. 

  • @rp@n Profile Picture
    @rp@n 5,901 on at
    RE: legder account need to update in PO product receipt in AX 2012 R3

    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.

  • @rp@n Profile Picture
    @rp@n 5,901 on at
    RE: legder account need to update in PO product receipt in AX 2012 R3

    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 

  • Suggested answer
    Ludwig Reinhard Profile Picture
    Ludwig Reinhard Microsoft Employee on at
    RE: legder account need to update in PO product receipt in AX 2012 R3

    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
    @rp@n 5,901 on at
    RE: legder account need to update in PO product receipt in AX 2012 R3

    Hi Ludwig,

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

  • @rp@n Profile Picture
    @rp@n 5,901 on at
    RE: legder account need to update in PO product receipt in AX 2012 R3

    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
    @rp@n 5,901 on at
    RE: legder account need to update in PO product receipt in AX 2012 R3

    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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans