Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Problem with Application Worksheet - Cannot Apply to Purchase Receipt

Posted on by Microsoft Employee

I have a problem.

Business Issue

Customer posted purchase invoice and purchase receipt with wrong currency code and didn't realize this until they had already posted some sales invoices from that purchase receipt.

Our Idea

I had been planning to post a new purchase invoice and purchase receipt with the correct currency code and then unapply the sales shipments from the wrong purchase receipt and then apply the shipments to the correct purchase receipt using the application worksheet.

The problem

I unapply the sales shipment from the incorrect purchase receipt (no problem). Then, I select the correct purchase receipt and click Unapplied Entries, select the correct purchase receipt and click OK. (Technical detail... at this point the OnQueryClosePage trigger executes... At this point I get the error "You cannot perform this action because entries for item XXX are unapplied in the Application Worksheet by user XXX.”

My Question

I already realize that if the Application Wksh. User ID is filled into the User table then this error will happen at certain situations. I am wondering why this error happens in my situation...

My screenshots

Screenshot1.jpg

Screenshot2.jpg

Screenshot3.jpg

Screenshot4.jpg

Screenshot5.jpg

Screenshot6.jpg

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Problem with Application Worksheet - Cannot Apply to Purchase Receipt

    You need to reverse the purchase by posting a Credit Memo with items transactions and post a correct one with new items transactions, using a correct currency code.


    Yes, this is what we did. Thanks for your help!


    or use application entry to play with item transactions application.
    This is the approach that we used.

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Problem with Application Worksheet - Cannot Apply to Purchase Receipt

    Okay, my coworker helped me debug the code and here was the problem (drumroll)... if Automatic Cost Adjustment (in Inventory Setup) is not equal to Never then you WILL be able to unapply the sales shipment from an incorrect purchase receipt but after it is unapplied, you will NOT be able to apply it to the correct purchase receipt (it will get an error).

    This looks like a design flaw...

    when clicking on OK from application worksheet, the OnQueryClosePage trigger will fire.

    //OnQueryClosePage (from object page 521)

    IF Apply.AnyTouchedEntries THEN BEGIN
      IF NOT CONFIRM(Text003) THEN
        EXIT(FALSE);
      Reapplyall;
      UnblockItems;
    END;
    EXIT(TRUE);

    From ReapplyAll the code will go to CostAdjust function in Codeunit 22

    //LOCAL ReapplyAll()

    Apply.RedoApplications;
    Apply.CostAdjust;
    Apply.ClearApplicationLog;

    From CostAdjust function in Codeunit 22:

    //CostAdjust()

    InvtSetup.GET;
    InventoryPeriod.IsValidDate(Opendate);
    IF InvtSetup."Automatic Cost Adjustment" <>
       InvtSetup."Automatic Cost Adjustment"::Never
    THEN BEGIN
      IF Opendate <> 0D THEN
        Opendate := CALCDATE('<+1D>',Opendate);
      InvtAdjmt.SetProperties(TRUE,InvtSetup."Automatic Cost Posting");
      InvtAdjmt.MakeMultiLevelAdjmt;
    END;

    I will not explain all the code that it goes to from here (it goes to codeunit 5895), but eventually the code will make its way to PostItem function in codeunit 22 where it will call the CheckBlockedByApplWorksheet function which will return an error. The error will make it impossible to apply the sales shipment to the correct purchase receipt.

    Here is what I did to solve the problem: I temporarily set the field Automatic Cost Adjustment to Never before I used the application worksheet. Then I was able to use the application worksheet with no errors. After I applied the sales shipment to the correct purchase receipt for all items, the user posted a purchase credit memo will no problems. Then we set automatic cost adjustment back to Always and ran the Adjust Cost Item Entries batch job. We checked the Item Ledger entries and Value Entries and everything seems fine.

  • Verified answer
    Alexander Ermakov Profile Picture
    Alexander Ermakov 28,094 on at
    RE: Problem with Application Worksheet - Cannot Apply to Purchase Receipt

    Theodore,

    Posting an item purchase with an incorrect currency code is a nasty user error for NAV users :-).

    I have few questions re your process. To my mind, if users had posted the purchase receipt with incorrect currency code, this means that the cost of the goods has been formed incorrectly, as well as the payables to the supplier. You need to correct that also.

    As an option, you can consider the following scenario: You need to reverse the purchase by posting a Credit Memo with items transactions and post a correct one with new items transactions, using a correct currency code. However, since your items are already sold, there will be no item transactions you can apply this CM to, thus you would need also to first reverse a Sales Order and return items to the warehouse, and only then post a purchase CM, or use application entry to play with item transactions application. This is quite inconvenient for the users, thus there might be a workaround:

    Users can calculate manually the difference between the posted purchase order and the correct purchase order with correct currency code. For the amount of this difference they post a new financial Purchase Order using item charges, which they allocate to the incorrect purchase order. Doing this, they will correct both item cost and the payables to supplier.

    However, you need to be careful, perhaps you would need to form a correct payable in a correct currency, in order to revaluate that. In this case, you can in addition form another financial credit memo to reverse the financial purchases with incorrect currency code and post a correct one with a correct currency code.

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

Featured topics

Product updates

Dynamics 365 release plans