Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

The value in the NumberOfEntries filed in a created SAF-T file is incorrect when you create the SAF-T file in the Portuguese version of Microsoft Dynamics NAV


View products that this article applies to.

This article applies to Microsoft Dynamics NAV for the Portuguese (pt) language locale.

↑ Back to the top


Symptoms

Assume that you create a SAF-T file in the Portuguese version of Microsoft Dynamics NAV. When you check the created .xml file, you notice that the value in the NumberOfEntries filed is incorrect. You expect the value to be the same as the number if the transactions in the database.
This problem occurs in the following products:
  • The Portuguese version of Microsoft Dynamics NAV 2009 Service Pack 1 (SP1)
  • The Portuguese version of Microsoft Dynamics NAV 2009 R2
  • The Portuguese version of Microsoft Dynamics NAV 5.0 Service Pack 1 (SP1)

↑ Back to the top


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.


↑ Back to the top




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, but 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 Navision client users are logged off the system. This includes Microsoft Navision Application Services (NAS) client users. 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 the Elements in the SAF-T PT XMLPort (13301) as follows:

    Existing code
    ...
    { [{2FBD739B-4063-4410-80DA-15187CE38CB6}];5 ;CreditAmount ;Element ;Text ;
    VariableName=EntriesSalesLnCreditAmount }

    { [{158561B4-B3C1-4D40-9FE8-2260247EFFE4}];1 ;SourceDocuments ;Element ;Text ;
    Export::OnBeforePassVariable=BEGIN
    IF TotalDocs = 0 THEN
    ...
    Replacement code
    ...
    { [{2FBD739B-4063-4410-80DA-15187CE38CB6}];5 ;CreditAmount ;Element ;Text ;
    VariableName=EntriesSalesLnCreditAmount }

    // Add the following lines.
    { [{3CD38B38-F1FA-494A-9863-2B919BF4B14B}];2 ;Journal ;Element ;Table ;
    VariableName=EntriesBlankSourceCode;
    SourceTable=Table2000000026;
    Export::OnPreXMLItem=BEGIN
    EntriesBlankSourceCode.SETRANGE(Number,1,1);
    Window.UPDATE(1,Text1110008);
    END;

    Export::OnAfterGetRecord=BEGIN
    IF NOT CheckGLRegBlankSourceCode THEN
    currXMLport.SKIP;

    ClearTempRec;

    REPEAT
    GetGLEntries;
    UNTIL TempGLReg.NEXT = 0;

    EntriesBlankJnlID := 'VAZIO';
    EntriesBlankJnlDescription := 'VAZIO';
    Window.UPDATE(2,'');
    END;
    }

    { [{4829023A-4C43-4746-B15E-55BE1C8A77BC}];3 ;JournalID ;Element ;Text ;
    VariableName=EntriesBlankJnlID }

    { [{AC925688-8EBD-4477-BE49-731F4647CF75}];3 ;Description ;Element ;Text ;
    VariableName=EntriesBlankJnlDescription }

    { [{EA486FCE-6103-4895-AE4A-A970D1AA69E5}];3 ;Transaction ;Element ;Table ;
    VariableName=EntriesBlankTr;
    SourceTable=Table2000000026;
    Export::OnPreXMLItem=BEGIN
    TempGLEntry.RESET;
    EntriesBlankTr.SETRANGE(Number,1,TempGLEntry.COUNT);
    TempGLEntry.FINDFIRST;
    END;

    Export::OnAfterGetRecord=BEGIN
    ApplyFilters;
    EntriesBlankTrID := FORMAT(FORMAT(TempGLEntry."Posting Date",0,9) + ' ' + EntriesBlankJnlID + ' ' + TempGLEntry."Document No.");
    EntriesBlankDocArchivalNumber := TempGLEntry."Document No.";
    EntriesBlankTrPeriod := FORMAT(GetPeriod(TempGLEntry."Posting Date"),0,9);
    EntriesBlankTrDate := FORMAT(NORMALDATE(TempGLEntry."Posting Date"),0,9);
    IF CLOSINGDATE(TempGLEntry."Posting Date") = TempGLEntry."Posting Date" THEN
    EntriesBlankTransactionType := 'A'
    ELSE
    EntriesBlankTransactionType := 'N';
    EntriesBlankTrDescription := EntriesBlankJnlDescription;
    EntriesBlankGLPostingDate := GetGLentryCreationDateTime(TempGLEntry."Entry No.");
    TempGLEntry.NEXT;
    END;
    }

    { [{1A2E1328-2281-4276-B7F2-93032558BF4D}];4 ;TransactionID ;Element ;Text ;
    VariableName=EntriesBlankTrID }

    { [{7238FAE0-4177-49F2-88D7-322E3479BEDF}];4 ;Period ;Element ;Text ;
    VariableName=EntriesBlankTrPeriod }

    { [{CB2AE9CA-4533-4F21-A5F0-9DB125CCE6A7}];4 ;TransactionDate ;Element ;Text ;
    VariableName=EntriesBlankTrDate }

    { [{06565DE9-009E-4CD1-9567-F869ADD6AF09}];4 ;Description ;Element ;Text ;
    VariableName=EntriesBlankTrDescription }

    { [{FC7AF546-FDA6-4409-9A11-E8C3F08B0245}];4 ;DocArchivalNumber ;Element ;Text ;
    VariableName=EntriesBlankDocArchivalNumber }

    { [{0D9858E8-71B7-4730-ACD3-208CB18E55D5}];4 ;TransactionType ;Element ;Text ;
    VariableName=EntriesBlankTransactionType }

    { [{7A0CC2BE-C3C8-4EDA-A616-C17000B3631C}];4 ;GLPostingDate ;Element ;Text ;
    VariableName=EntriesBlankGLPostingDate }

    { [{F7668B87-49B8-4CB6-8316-D1440A5E3ABA}];4 ;Line ;Element ;Table ;
    VariableName=EntriesLinedBlankDbtAmt;
    SourceTable=Table2000000026;
    Export::OnPreXMLItem=BEGIN
    TempGLEntry2.SETFILTER("Debit Amount",'<>% 1',0);
    IF NOT TempGLEntry2.FINDFIRST THEN
    currXMLport.BREAK;
    EntriesLinedBlankDbtAmt.SETRANGE(Number,1,TempGLEntry2.COUNT);
    END;

    Export::OnAfterGetRecord=BEGIN
    EntriesLnBlankDbtAmtRecordID := FORMAT(TempGLEntry2."Entry No.",0,9);
    EntriesLnBlankDbtAmtAccountID := TempGLEntry2."G/L Account No.";
    EntriesLnBlankDbtAmtSysEntDate := GetGLentryCreationDateTime(TempGLEntry2."Entry No.");
    EntriesLnBlankDbtAmtDescr := TempGLEntry2.Description;
    EntriesLnBlankDebitAmount := FORMAT(TempGLEntry2."Debit Amount",0,9);
    TempGLEntry2.NEXT;
    END;
    }

    { [{455ABAA5-310A-4999-B349-FF32D14A1968}];5 ;RecordID ;Element ;Text ;
    VariableName=EntriesLnBlankDbtAmtRecordID }

    { [{82412AE1-E33F-4DC9-837E-8E7AAEEFE2ED}];5 ;AccountID ;Element ;Text ;
    VariableName=EntriesLnBlankDbtAmtAccountID }

    { [{448EE384-AF3E-4A02-AC66-373591BC28CD}];5 ;SystemEntryDate ;Element ;Text ;
    VariableName=EntriesLnBlankDbtAmtSysEntDate }

    { [{9F8171F0-A12E-49B6-A00D-93745204EB23}];5 ;Description ;Element ;Text ;
    VariableName=EntriesLnBlankDbtAmtDescr }

    { [{1BD67E80-3CC3-41DF-86B7-7A9FF3514B36}];5 ;DebitAmount ;Element ;Text ;
    VariableName=EntriesLnBlankDebitAmount }

    { [{35FC60AD-0217-4D95-978A-FFAD08D66558}];4 ;Line ;Element ;Table ;
    VariableName=EntriesLinedBlankCrAmt;
    SourceTable=Table2000000026;
    Export::OnPreXMLItem=BEGIN
    TempGLEntry2.SETRANGE("Debit Amount");
    TempGLEntry2.SETFILTER("Credit Amount",' <>%1',0);
    IF NOT TempGLEntry2.FINDFIRST THEN
    currXMLport.BREAK;
    EntriesLinedBlankCrAmt.SETRANGE(Number,1,TempGLEntry2.COUNT);
    END;

    Export::OnAfterGetRecord=BEGIN
    EntriesLnBlankCrAmtRecordID := FORMAT(TempGLEntry2."Entry No.",0,9);
    EntriesLnBlankCrAmtAccountID := TempGLEntry2."G/L Account No.";
    EntriesLnBlankCrAmtSysEntrDate := GetGLentryCreationDateTime(TempGLEntry2."Entry No.");
    EntriesLnBlankCrAmtDescr := TempGLEntry2.Description;
    EntriesLnBlankCreditAmount := FORMAT(TempGLEntry2."Credit Amount",0,9);
    TempGLEntry2.NEXT;
    END;
    }

    { [{42970CEB-47B1-4737-9067-5D8310FCFA39}];5 ;RecordID ;Element ;Text ;
    VariableName=EntriesLnBlankCrAmtRecordID }

    { [{C236B36C-53F0-4FD1-ABCF-28828E216114}];5 ;AccountID ;Element ;Text ;
    VariableName=EntriesLnBlankCrAmtAccountID }

    { [{AEC885C8-FCE9-4C04-BBFB-B1A6B7540DDA}];5 ;SystemEntryDate ;Element ;Text ;
    VariableName=EntriesLnBlankCrAmtSysEntrDate }

    { [{D2F54DEF-3BF6-4F7F-BCB9-384A96BE514D}];5 ;Description ;Element ;Text ;
    VariableName=EntriesLnBlankCrAmtDescr }

    { [{F1DA085A-9AC4-4DB4-AC54-DA77AFE7CCAD}];5 ;CreditAmount ;Element ;Text ;
    VariableName=EntriesLnBlankCreditAmount }
    // End of the added lines.

    { [{158561B4-B3C1-4D40-9FE8-2260247EFFE4}];1 ;SourceDocuments ;Element ;Text ;
    Export::OnBeforePassVariable=BEGIN
    IF TotalDocs = 0 THEN
    ...
  2. Change the code in the SetData function in the SAF-T PT XMLPort (13301) as follows:

    Existing code
    ...
    GLEntry.RESET;
    // No. of transactions
    GetOpenGLRegister;
    // Delete the following lines.
    IF SourceCode.FINDSET THEN
    REPEAT
    IF CheckGLReg THEN
    REPEAT
    TempGLEntry3.DELETEALL;
    GLEntry2.RESET;
    GLEntry2.SETRANGE("Entry No.",TempGLReg."From Entry No.",TempGLReg."To Entry No.");
    IF GLEntry2.FINDSET THEN
    REPEAT
    TempGLEntry3.RESET;
    TempGLEntry3.SETCURRENTKEY("Document No.","Posting Date");
    TempGLEntry3.SETRANGE("Document No.",GLEntry2."Document No.");
    TempGLEntry3.SETRANGE("Posting Date",GLEntry2."Posting Date");
    IF NOT TempGLEntry3.FINDFIRST THEN BEGIN
    NoOfTransactions += 1;
    TempGLEntry3.INIT;
    TempGLEntry3.TRANSFERFIELDS(GLEntry2);
    TempGLEntry3.INSERT;
    END;
    UNTIL GLEntry2.NEXT=0;
    UNTIL TempGLReg.NEXT = 0;
    UNTIL SourceCode.NEXT = 0;
    // End of the deleted lines.

    // Sales Invoice Docs
    SalesInvoice.RESET;
    SalesInvoice.SETFILTER("Posting Date",'%1..%2',StartDate3,EndDate2);
    ...
    Replacement code
    ...
    GLEntry.RESET;
    // No. of transactions
    GetOpenGLRegister;
    // Add the following lines.
    TempGLEntry3.DELETEALL;
    IF SourceCode.FINDSET THEN
    REPEAT
    IF CheckGLReg THEN
    REPEAT
    CalcNoOfTransactions(TempGLReg."From Entry No.",TempGLReg."To Entry No.",TempGLEntry3);
    UNTIL TempGLReg.NEXT = 0;
    UNTIL SourceCode.NEXT = 0;

    IF CheckGLRegBlankSourceCode THEN
    REPEAT
    CalcNoOfTransactions(TempGLReg."From Entry No.",TempGLReg."To Entry No.",TempGLEntry3);
    UNTIL TempGLReg.NEXT = 0;
    // End of the added lines.

    // Sales Invoice Docs
    SalesInvoice.RESET;
    SalesInvoice.SETFILTER("Posting Date",'%1..%2',StartDate3,EndDate2);
    ...
  3. Change the code in the Documentation in the SAF-T PT XMLPort (13301) as follows:

    Existing code
    ...
    EXIT(FORMAT(DateParam,0,9) + 'T' + FORMAT(TimeParam,0,'<Hours24,2><Filler Character,0>:<Minutes,2>:<Seconds,2>'));
    END;

    // Delete the following lines.
    BEGIN
    END.
    }
    }
    // End of the deleted lines.
    ...
    Replacement code
    ...
    EXIT(FORMAT(DateParam,0,9) + 'T' + FORMAT(TimeParam,0,'<Hours24,2><Filler Character,0>:<Minutes,2>:<Seconds,2>'));
    END;
    // Add the following lines.
    LOCAL PROCEDURE CalcNoOfTransactions@1110021(FromEntryNo@1110000 : Integer;ToEntryNo@1110001 : Integer;VAR TempGLEntry@1110002 : Record 17);
    VAR
    GLEntry@1110003 : Record 17;
    BEGIN
    GLEntry.RESET;
    GLEntry.SETRANGE("Entry No.",TempGLReg."From Entry No.",TempGLReg."To Entry No.");
    IF GLEntry.FINDSET THEN
    REPEAT
    TempGLEntry.RESET;
    TempGLEntry.SETCURRENTKEY("Document No.","Posting Date");
    TempGLEntry.SETRANGE("Document No.",GLEntry."Document No.");
    TempGLEntry.SETRANGE("Posting Date",GLEntry."Posting Date");
    TempGLEntry.SETRANGE("Source Code",GLEntry."Source Code");
    IF NOT TempGLEntry.FINDFIRST THEN BEGIN
    NoOfTransactions += 1;
    TempGLEntry.INIT;
    TempGLEntry.TRANSFERFIELDS(GLEntry);
    TempGLEntry.INSERT;
    END;
    UNTIL GLEntry.NEXT=0;
    END;

    LOCAL PROCEDURE CheckGLRegBlankSourceCode@1110022() : Boolean;
    BEGIN
    TempGLReg.RESET;
    TempGLReg.SETFILTER("Posting Date",'%1..%2',StartDate3,CLOSINGDATE(EndDate2));
    TempGLReg.SETRANGE("Source Code",'');
    EXIT(TempGLReg.FINDFIRST);
    END;

    BEGIN
    END.
    }
    }
    // End of the added lines.
    ...

Prerequisites

You must have one of the following products installed to apply this hotfix:
  • The Portuguese version of Microsoft Dynamics NAV 2009 Service Pack 1 (SP1)
  • The Portuguese version of Microsoft Dynamics NAV 2009 R2
  • The Portuguese version of Microsoft Dynamics NAV 5.0 Service Pack 1 (SP1)


Removal information

You cannot remove this hotfix.

↑ Back to the top


Status

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

↑ Back to the top


References

VSTF DynamicsNAV SE: 263721; 263722

↑ Back to the top


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 Use for other considerations.

↑ Back to the top


Keywords: kb, kbqfe, kbmbsquickpub, kbmbsmigrate, kbmbspartner, kbsurveynew, kbmbscodefix

↑ Back to the top

Article Info
Article ID : 2620645
Revision : 1
Created on : 1/7/2017
Published on : 10/28/2011
Exists online : False
Views : 235