Applies ToDynamics NAV 2009

Symptoms

An incorrect document type is used when you import LSV DD (direct debit) files and rejected payments exist in the Swiss version of Microsoft Dynamics NAV 2009. When a payment was canceled, the document type is still set to payment. However, you cannot post those entries because of the incorrect sign of the amount. Follow the steps in the code changes section to solve this issue. This problem occurs in the following products:

  • The Swiss version of Microsoft Dynamics NAV 2009 R2

  • The Swiss version of Microsoft Dynamics NAV 2009 SP1

Resolution

Hotfix information

A supported hotfix is now available from Microsoft. However, it is only intended to correct the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft Dynamics NAV 2009 service pack or the next Microsoft Dynamics NAV version that contains this hotfix. Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Technical Support Professional for Microsoft Dynamics and related products determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Installation information

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. Note Before you install this hotfix, verify that all Microsoft Dynamics NAV client users are logged off the system. This includes Microsoft Dynamics NAV Application Server (NAS) services. You should be the only client user who is logged on when you implement this hotfix.To implement this hotfix, you must have a developer license.We recommend that the user account in the Windows Logins window or in the Database Logins window be assigned the "SUPER" role ID. If the user account cannot be assigned the "SUPER" role ID, you must verify that the user account has the following permissions:

  • The Modify permission for the object that you will be changing.

  • The Execute permission for the System Object ID 5210 object and for the System Object ID 9015 object.

Note You do not have to have rights to the data stores unless you have to perform data repair.

Code changes

Note Always test code fixes in a controlled environment before you apply the fixes to your production computers. To resolve this problem, follow these steps:

  1. Change the code in Global Variables in the LSVMgt Codeunit (3010831) as follows:Existing code

    ...Text11500@1150080 : TextConst 'ENU=Could not find Transaction No. %1 in Debit Direct Order No. %2.';      FileMgt@1150042 : Codeunit 419;      FileSystemObject@1150081 : Automation "{420B2830-E718-11CF-893D-00A0C9054228} 1.0:{0D43FE01-F093-11CF-8940-00A0C9054228}:'Microsoft Scripting Runtime'.FileSystemObject";    PROCEDURE ReleaseCustLedgEntries@1(_GenJnlLine@1150000 : Record 81);    BEGIN...

    Replacement code

    ...Text11500@1150080 : TextConst 'ENU=Could not find Transaction No. %1 in Debit Direct Order No. %2.';      FileMgt@1150042 : Codeunit 419;      FileSystemObject@1150081 : Automation "{420B2830-E718-11CF-893D-00A0C9054228} 1.0:{0D43FE01-F093-11CF-8940-00A0C9054228}:'Microsoft Scripting Runtime'.FileSystemObject";// Add the following line.IsCancellationExist@1150082 : Boolean;// End of the added line.    PROCEDURE ReleaseCustLedgEntries@1(_GenJnlLine@1150000 : Record 81);    BEGIN...
  2. Change the code in ImportDebitDirectFile function in the LSVMgt Codeunit (3010831) as follows:Existing code 1

    ...FeeAmount := 0;      TotalRecRecords := 0;      TotalRecRecordsRev := 0;      // Journal name for no serie      GlBatchName.GET(ActGenJnlLine."Journal Template Name",ActGenJnlLine."Journal Batch Name");...

    Replacement code 1

    ...FeeAmount := 0;      TotalRecRecords := 0;      TotalRecRecordsRev := 0;// Add the following line.IsCancellationExist := FALSE;// End of the added line.      // Journal name for no serie      GlBatchName.GET(ActGenJnlLine."Journal Template Name",ActGenJnlLine."Journal Batch Name");...

    Existing code 2

    ...// Split File line into fields// Delete the following lines.FileID := COPYSTR(Line,1,3);IF FileID <> '036' THENERROR(Text049 + Text011);TA := COPYSTR(Line,36,2);IF NOT (TA = '97') THEN BEGINTotalRecord := FALSE;EVALUATE(InvoiceAmt,COPYSTR(Line,54,13));EVALUATE(yyCR,COPYSTR(Line,4,2));EVALUATE(mmCR,COPYSTR(Line,6,2));EVALUATE(ddCR,COPYSTR(Line,8,2));IF yyCR > 98 THENPostDate := DMY2DATE(ddCR,mmCR,1900 + yyCR)ELSEPostDate := DMY2DATE(ddCR,mmCR,2000 + yyCR);DebitDirectOrderNo := COPYSTR(Line,34,2);EVALUATE(DebitDirectRecordNo,COPYSTR(Line,38,6));EVALUATE(RejectionCode,COPYSTR(Line,543,2));Currency := COPYSTR(Line,51,3);// DEBIT DIRECTLsvJour.RESET;LsvJour.SETRANGE("Credit Date",PostDate);LsvJour.SETRANGE("DebitDirect Orderno.",DebitDirectOrderNo);IF NOT LsvJour.FIND('+') THENERROR(Text059,DebitDirectOrderNo,PostDate);LsvJournalLine.RESET;//CH0001.beginLsvJournalLine.SETCURRENTKEY("LSV Journal No.","Transaction No.");LsvJournalLine.SETRANGE("LSV Journal No.",LsvJour."No.");//LsvJournalLine.SETRANGE("Line No.",DebitDirectRecordNo);LsvJournalLine.SETRANGE("Transaction No.",DebitDirectRecordNo);//LsvJournalLine.FIND('-');IF NOT LsvJournalLine.FINDFIRST THEN BEGINd.CLOSE;ERROR(Text11500, DebitDirectRecordNo, DebitDirectOrderNo);END;//CH0001.endInInvoiceNo := LsvJournalLine."Applies-to Doc. No.";// END DEBIT DIRECT// Process transaction of credit recordCASE TA OF'81':  // CreditBEGINTransaction := Transaction::Credit;LsvJournalLine."LSV Status" := LsvJournalLine."LSV Status"::Open;LsvJournalLine."DD Rejection Reason" := LsvJournalLine."DD Rejection Reason"::" ";LsvJournalLine.MODIFY;IF LSVSetup.READPERMISSION THEN BEGINClosedByESR(InInvoiceNo);END;END;'84':  // Cancellation "Storno"BEGINIF RejectionCode <> 2 THENTransaction := Transaction::CorrectionELSETransaction := Transaction::Cancellation;LsvJournalLine."LSV Status" := LsvJournalLine."LSV Status"::Rejected;LsvJournalLine."DD Rejection Reason" := RejectionCode;LsvJournalLine.MODIFY;END;ELSE ERROR(Text023 + Text011);END;END ELSE BEGINTotalRecord := TRUE;EVALUATE(TempAmount,COPYSTR(Line,60,13));CreditAmount := CreditAmount + TempAmount / 100;EVALUATE(TempAmount,COPYSTR(Line,82,13));RejectionAmount := RejectionAmount + TempAmount / 100;EVALUATE(TempAmount,COPYSTR(Line,104,13));ReversalAmount := ReversalAmount + TempAmount / 100;EVALUATE(TempAmount,COPYSTR(Line,120,11));FeeAmount := FeeAmount + TempAmount / 100;// Credit CountEVALUATE(TempAmount,COPYSTR(Line,54,6));TotalRecRecords := TotalRecRecords + TempAmount;// Rejection CountEVALUATE(TempAmount,COPYSTR(Line,76,6));TotalRecRecordsRev := TotalRecRecordsRev + TempAmount;// Reversal CountEVALUATE(TempAmount,COPYSTR(Line,98,6));TotalRecRecordsRev := TotalRecRecordsRev + TempAmount;END;// END OF SPLITIF NOT (TotalRecord) AND (Transaction <> Transaction::Correction) THEN BEGIN// End of the deleted lines.          // Insert GL line          GenJournalLine.INIT;          GenJournalLine."Journal Template Name" := ActGenJnlLine."Journal Template Name";...

    Replacement code 2

    ...// Split File line into fields// Add the following lines.FileID := COPYSTR(Line,1,3);IF FileID <> '036' THENERROR(Text049 + Text011);TA := COPYSTR(Line,36,2);IF NOT (TA = '97') THEN BEGINTotalRecord := FALSE;EVALUATE(InvoiceAmt,COPYSTR(Line,54,13));EVALUATE(yyCR,COPYSTR(Line,4,2));EVALUATE(mmCR,COPYSTR(Line,6,2));EVALUATE(ddCR,COPYSTR(Line,8,2));IF yyCR > 98 THENPostDate := DMY2DATE(ddCR,mmCR,1900 + yyCR)ELSEPostDate := DMY2DATE(ddCR,mmCR,2000 + yyCR);DebitDirectOrderNo := COPYSTR(Line,34,2);EVALUATE(DebitDirectRecordNo,COPYSTR(Line,38,6));EVALUATE(RejectionCode,COPYSTR(Line,543,2));Currency := COPYSTR(Line,51,3);// DEBIT DIRECTLsvJour.RESET;LsvJour.SETRANGE("Credit Date",PostDate);LsvJour.SETRANGE("DebitDirect Orderno.",DebitDirectOrderNo);IF NOT LsvJour.FIND('+') THENERROR(Text059,DebitDirectOrderNo,PostDate);LsvJournalLine.RESET;//CH0001.beginLsvJournalLine.SETCURRENTKEY("LSV Journal No.","Transaction No.");LsvJournalLine.SETRANGE("LSV Journal No.",LsvJour."No.");//LsvJournalLine.SETRANGE("Line No.",DebitDirectRecordNo);LsvJournalLine.SETRANGE("Transaction No.",DebitDirectRecordNo);//LsvJournalLine.FIND('-');IF NOT LsvJournalLine.FINDFIRST THEN BEGINd.CLOSE;ERROR(Text11500, DebitDirectRecordNo, DebitDirectOrderNo);END;//CH0001.endInInvoiceNo := LsvJournalLine."Applies-to Doc. No.";// END DEBIT DIRECT// Process transaction of credit recordCASE TA OF'81':  // CreditBEGINTransaction := Transaction::Credit;LsvJournalLine."LSV Status" := LsvJournalLine."LSV Status"::Open;LsvJournalLine."DD Rejection Reason" := LsvJournalLine."DD Rejection Reason"::" ";LsvJournalLine.MODIFY;IF LSVSetup.READPERMISSION THEN BEGINClosedByESR(InInvoiceNo);END;END;'84':  // Cancellation "Storno"BEGINIF RejectionCode <> 2 THENTransaction := Transaction::CorrectionELSETransaction := Transaction::Cancellation;LsvJournalLine."LSV Status" := LsvJournalLine."LSV Status"::Rejected;LsvJournalLine."DD Rejection Reason" := RejectionCode;LsvJournalLine.MODIFY;END;ELSEERROR(Text023 + Text011);END;END ELSE BEGINTotalRecord := TRUE;EVALUATE(TempAmount,COPYSTR(Line,60,13));CreditAmount := CreditAmount + TempAmount / 100;EVALUATE(TempAmount,COPYSTR(Line,82,13));RejectionAmount := RejectionAmount + TempAmount / 100;EVALUATE(TempAmount,COPYSTR(Line,104,13));ReversalAmount := ReversalAmount + TempAmount / 100;EVALUATE(TempAmount,COPYSTR(Line,120,11));FeeAmount := FeeAmount + TempAmount / 100;// Credit CountEVALUATE(TempAmount,COPYSTR(Line,54,6));TotalRecRecords := TotalRecRecords + TempAmount;// Rejection CountEVALUATE(TempAmount,COPYSTR(Line,76,6));TotalRecRecordsRev := TotalRecRecordsRev + TempAmount;// Reversal CountEVALUATE(TempAmount,COPYSTR(Line,98,6));TotalRecRecordsRev := TotalRecRecordsRev + TempAmount;END;// END OF SPLITIF NOT (TotalRecord) AND (Transaction <> Transaction::Correction) THEN BEGIN// End of the added lines.          // Insert GL line          GenJournalLine.INIT;          GenJournalLine."Journal Template Name" := ActGenJnlLine."Journal Template Name";...

    Existing code 3

    ...GenJournalLine.INIT;          GenJournalLine."Journal Template Name" := ActGenJnlLine."Journal Template Name";          GenJournalLine."Journal Batch Name" := ActGenJnlLine."Journal Batch Name";          LastLineNo := LastLineNo + 10000;          GenJournalLine."Line No." := LastLineNo;          GenJournalLine."Document No." := NextDocNo;...

    Replacement code 3

    ... GenJournalLine.INIT;          GenJournalLine."Journal Template Name" := ActGenJnlLine."Journal Template Name";          GenJournalLine."Journal Batch Name" := ActGenJnlLine."Journal Batch Name";// Add the following lines.GenJournalLine."Posting Date" := PostDate;GenJournalLine."Account Type" := GenJournalLine."Account Type"::Customer;IF Transaction = Transaction::Cancellation THEN BEGINIsCancellationExist := TRUE;GenJournalLine."Document Type" := GenJournalLine."Document Type"::Refund;NextDocNo := NoSeriesMgt.GetNextNo(GlBatchName."No. Series",PostDate,FALSE);END ELSEGenJournalLine."Document Type" := GenJournalLine."Document Type"::Payment;// End of the added lines.     LastLineNo := LastLineNo + 10000;          GenJournalLine."Line No." := LastLineNo;          GenJournalLine."Document No." := NextDocNo;...

    Existing code 4

    ...LastLineNo := LastLineNo + 10000;          GenJournalLine."Line No." := LastLineNo;          GenJournalLine."Document No." := NextDocNo;// Delete the following lines.GenJournalLine."Posting Date" := PostDate;GenJournalLine."Account Type" := GenJournalLine."Account Type"::Customer;GenJournalLine."Document Type" := GenJournalLine."Document Type"::Payment;// End of the deleted lines.          GeneralLedgerSetup.GET;          IF GeneralLedgerSetup."LCY Code" <> Currency THEN...

    Replacement code 4

    ... LastLineNo := LastLineNo + 10000;          GenJournalLine."Line No." := LastLineNo;          GenJournalLine."Document No." := NextDocNo;// Add the following lines.IF Transaction = Transaction::Cancellation THENNextDocNo := NoSeriesMgt.GetNextNo(GlBatchName."No. Series",PostDate,FALSE);// End of the added lines.          GeneralLedgerSetup.GET;          IF GeneralLedgerSetup."LCY Code" <> Currency THEN...

    Existing code 5

    ... IF CustLedgerEntry.FIND('-') THEN            GenJournalLine.VALIDATE("Account No.",CustLedgerEntry."Customer No.");// Delete the following lines.GenJournalLine."Applies-to Doc. Type" := GenJournalLine."Applies-to Doc. Type"::Invoice;GenJournalLine."Applies-to Doc. No." := InInvoiceNo;// End of the deleted lines.          IF GenJournalLine."Currency Code" <> CustLedgerEntry."Currency Code" THEN            GenJournalLine.VALIDATE("Currency Code",CustLedgerEntry."Currency Code");...

    Replacement code 5

    ... IF CustLedgerEntry.FIND('-') THEN            GenJournalLine.VALIDATE("Account No.",CustLedgerEntry."Customer No.");// Add the following lines.IF Transaction <> Transaction::Cancellation THEN BEGINGenJournalLine."Applies-to Doc. Type" := GenJournalLine."Applies-to Doc. Type"::Invoice;GenJournalLine."Applies-to Doc. No." := InInvoiceNo;END;// End of the added lines.          IF GenJournalLine."Currency Code" <> CustLedgerEntry."Currency Code" THEN            GenJournalLine.VALIDATE("Currency Code",CustLedgerEntry."Currency Code");...

    Existing code 6

    ...// *** Bal account per line or as combined entry// Delete the following line.IF MultiplePostingDates THEN BEGIN// End of the deleted line.        // Bal Account per line        IF GenJournalLine.FIND('-') THEN          REPEAT...

    Replacement code 6

    ...// *** Bal account per line or as combined entry// Add the following line.IF MultiplePostingDates OR IsCancellationExist THEN BEGIN// End of the added line.        // Bal Account per line        IF GenJournalLine.FIND('-') THEN          REPEAT...

Prerequisites

You must have one of the following products installed to apply this hotfix:

  • The Swiss version of Microsoft Dynamics NAV 2009 R2

  • The Swiss version of Microsoft Dynamics NAV 2009 SP1

Removal information

You cannot remove this hotfix.

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Usefor other considerations.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.