Options

Prepayment invoice Error : Currency Code " does not exist

cyuwonocyuwono Member Posts: 28
Hi There,


I am having a hard time to post an invoice that has prepayment invoice on it. Every time i tried to post the invoice , it says that "Currency Code " does not exist" . After that I tested posting an order that does not have prepayment invoice attached to it, the posting process went successfully without any problem.

I tried to debug the program and i found that when RealizeGainLoss(GenJnlLine,SalesLine) is calling Currency.GET(SalesLine."Currency Code"); that where I got the error.


I also searched, the error message, on google and I found this http://dynamicsuser.net/forums/p/32722/196025.aspx and I double check my LCY Code and it says CAD and also there is no CAD currency code in the currency table. does anyone know the answer/fix for this issue ?

Thank you !


Carlos

Codeunit 442 Sales-Post Prepayments\RealizeGainLoss(GenJnlLine,SalesLine)
Codeunit 80 Sales-Post\PrepayRealizeGainLoss(SalesLine)
Codeunit 80 Sales-Post\OnRun()
Codeunit 81 Sales-Post (Yes/No)\Code()
Codeunit 81 Sales-Post (Yes/No)\OnRun()
Form 42 Sales Order\<Control75> - OnPush()


Codeunit 80 Sales-Post\PrepayRealizeGainLoss(SalesLine)
...
       IF SalesLine.FINDSET THEN
          REPEAT
            IF SalesLine."Purch. Order Line No." <> 0 THEN
              UpdateAssocLines(SalesLine);
            IF (SalesLine."Prepayment %" <> 0)  THEN BEGIN
              IF "Currency Code" <> '' THEN BEGIN
                TempPrePayDeductLCYSalesLine := SalesLine;
                IF TempPrePayDeductLCYSalesLine.FIND THEN
                  SalesLine."Prepmt. Amount Inv. (LCY)" := SalesLine."Prepmt. Amount Inv. (LCY)" -
                    TempPrePayDeductLCYSalesLine."Prepmt. Amount Inv. (LCY)";
              END ELSE
                SalesLine."Prepmt. Amount Inv. (LCY)" := SalesLine."Prepmt. Amount Inv. (LCY)" - SalesLine."Prepmt Amt to Deduct";
              PrepayRealizeGainLoss(SalesLine);   <<<<<< ERROR  ERROR  ERROR  ERROR
            END;

...



RealizeGainLoss(GenJnlLine,SalesLine)
IF (SalesLine."Gen. Bus. Posting Group" <> GenPostingSetup."Gen. Bus. Posting Group") OR
   (SalesLine."Gen. Prod. Posting Group" <> GenPostingSetup."Gen. Prod. Posting Group")
THEN
  GenPostingSetup.GET(SalesLine."Gen. Bus. Posting Group",SalesLine."Gen. Prod. Posting Group");
GenPostingSetup.TESTFIELD("Sales Prepayments Account");

GenJnlLine."Account Type" := GenJnlLine."Account Type"::"G/L Account";
GenJnlLine."Account No." := GenPostingSetup."Sales Prepayments Account";
GenJnlLine."System-Created Entry" := TRUE;
GenJnlLine.Amount := SalesLine."Prepmt. Amount Inv. (LCY)";
Currency.GET(SalesLine."Currency Code");  <<<<<<  ERROR ERROR  ERROR  ERROR

....

Carlos Yuwono

Comments

  • Options
    aseigleaseigle Member Posts: 207
    There are many bugs related to Prepayment Invoices that are KB articles on Partnersource. I've gotten this error when either the prepayment % or prepayment amount have been changed after a prepayment invoice is generated. Those are the first places I would look.
  • Options
    cyuwonocyuwono Member Posts: 28
    I found related article (KB939303) regarding prepayments (NA version)
    https://mbs2.microsoft.com/Knowledgebase/KBDisplay.aspx?WTNTZSMNWUKNTMMYLSVQUSPTNTNSMQPYQOZUVZRWVUZWNXQQNULVKUNWVYSVVNNL

    Not sure if MS fixed this problem on 2009 R2 version.
    Carlos Yuwono
  • Options
    Betrachter84Betrachter84 Member Posts: 62
    Check all amounts in all lines especially Prepmt. Amt. Inv. Excl. VAT. Most sure you'll find one amount which contains double the expected amount or something like -0.01 or 0.01. Adjust this amount to the line amount excl. VAT and posting should work withot any side issues. I'v experienced invoice rounding making the problem even worse meaning more likely.

    I know, this isn't a solution of the underlying problem but at least you'll be able to post the document. The one official KB i once applied was no help to it.
  • Options
    CaponeCapone Member Posts: 125
    I tried following KB979109
    Error message when you try to invoice a sales order in Microsoft Dynamics NAV 2009 Service Pack 1: "Currency Code '' does not exist"
    http://support.microsoft.com/kb/979109

    It didn't help my problem with posting the invoice. I was going to try to reopen the invoice and validate the quantities but couldnn't do that cause all the lines have been delivered.
    Hello IT, have you tried to turn it off and on?
    Have you checked the cables?
    Have you released the filters?

    http://www.navfreak.com
  • Options
    CaponeCapone Member Posts: 125
    This problem is now solved after contact with Microsoft. And the solution is what Betrachter84 wrote.

    First they gave me the following suggestion
    On the other side, I ever had a similar Support Request with the same error message, which was not solved by KB 979109.
    I would suggest to try the following (this is the code of the last W1 build of Dynamics 2009 SP1/ R2).

    Table 37 – trigger “CalcPrepaymentToDeduct”

    Old code:
    =======
    IF (Quantity - "Quantity Invoiced") <> 0 THEN BEGIN
    GetSalesHeader;
    IF SalesHeader."Prices Including VAT" THEN
    "Prepmt Amt to Deduct" :=
    ROUND(
    ROUND(
    ROUND(
    ROUND("Unit Price" * "Qty. to Invoice",Currency."Amount Rounding Precision") *
    (1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") *
    ("Prepayment %" / 100) / (1 + ("VAT %" / 100)),Currency."Amount Rounding Precision") *
    (1 + ("VAT %" / 100)),Currency."Amount Rounding Precision")
    ELSE
    "Prepmt Amt to Deduct" :=
    ROUND(
    ROUND(
    ROUND("Unit Price" * "Qty. to Invoice",Currency."Amount Rounding Precision") *
    (1 - ("Line Discount %" / 100)),Currency."Amount Rounding Precision") *
    "Prepayment %" / 100 ,Currency."Amount Rounding Precision")
    END ELSE
    "Prepmt Amt to Deduct" := 0

    New code:
    =========
    IF ("Qty. to Invoice" <> 0) AND ("Prepmt. Amt. Inv." <> 0) THEN BEGIN
    GetSalesHeader;
    "Prepmt Amt to Deduct" :=
    ROUND(
    ("Prepmt. Amt. Inv." - "Prepmt Amt Deducted") *
    "Qty. to Invoice" / (Quantity - "Quantity Invoiced"),Currency."Amount Rounding Precision")
    END ELSE
    "Prepmt Amt to Deduct" := 0

    Aparently this didn't solve the issue either but will together with KB 979109 solve so this won't happen again. What I needed to do was to solve this occurence.
    After further investigating I discovered following on the salesorder:

    SalesLine3
    Prepmt. Line Amount 29
    Prepmt. Amt. Inv. 29
    Prepmt. Amt. Incl. VAT 35,67
    Prepmt. Amount Inv. Incl. VAT 35,67
    Prepmt. Amount Inv. (LCY) -0,01

    SalesLine2
    Prepmt. Line Amount 2,46
    Prepmt. Amt. Inv. 2,46
    Prepmt. Amt. Incl. VAT 3,03
    Prepmt. Amount Inv. Incl. VAT 3,03
    Prepmt. Amount Inv. (LCY) 2,46


    SalesLine1
    Prepmt. Line Amount 1 217,04
    Prepmt. Amt. Inv. 1 217,04
    Prepmt. Amt. Incl. VAT 1 496,96
    Prepmt. Amount Inv. Incl. VAT 1 496,96
    Prepmt. Amount Inv. (LCY) 1 217,04

    It seems like the reason to why Prepmt. Amount Inv. (LCY) = -0,01 on salesline3 is because somewhere it did a missmatch agains the lines on the prepayment invoice were the value 0,01 comes from the invoice rounding.

    What I did to solve it was to change Prepmt. Amount Inv. (LCY) = Prepmt. Amt. Inv. on the on salesline3 and post it.
    Hello IT, have you tried to turn it off and on?
    Have you checked the cables?
    Have you released the filters?

    http://www.navfreak.com
Sign In or Register to comment.