Intrastat is reported to the government and should display the transactions (quantity) that are made between borders, which mean transactions from the Danish company to and from other countries. This means that if you report that an item is traded for instance, Germany, in January, the transaction should under no circumstances be included in the instrastat journal for February.
The transaction should only be included one time, even though the value of the transaction goes up or down, because of an item charge.Currently also for the month when the item charge is registered a new intrastat journal line is created. This problem occurs in the following products:-
The Danish version of Microsoft Dynamics NAV 2009 R2
-
The Danish version of Microsoft Dynamics NAV 2009 Service Pack 1 (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:-
Change the code in the Get Item Ledger Entries report (594) as follows:
Existing code 1...
IF IntrastatJnlLine2.FINDFIRST THEN CurrReport.SKIP; // Delete the following line. TestILE("Item Ledger Entry"); // End of the deleted line. TotalInvoicedQty := 0; TotalAmt := 0; ...Replacement code 1
...
IF IntrastatJnlLine2.FINDFIRST THEN CurrReport.SKIP; // Add the following lines. IF NOT HasCrossedBorder("Item Ledger Entry") THEN CurrReport.SKIP; // End of the added lines. TotalInvoicedQty := 0; TotalAmt := 0; ...Existing code 2
...
IF "Country/Region".GET("Item Ledger Entry"."Country/Region Code") THEN IF "Country/Region"."EU Country/Region Code" = '' THEN CurrReport.SKIP; TestILE("Item Ledger Entry"); InsertValueEntryLine; END; END; ...Replacement code 2
...
IF "Country/Region".GET("Item Ledger Entry"."Country/Region Code") THEN IF "Country/Region"."EU Country/Region Code" = '' THEN CurrReport.SKIP; // Add the following line. IF HasCrossedBorder("Item Ledger Entry") THEN // End of the added lines. CurrReport.SKIP; InsertValueEntryLine; END; END; ... -
Change the code in the CheckILE function in the Get Item Ledger Entries report (594) as follows:
Existing code 1...
EXIT(AverageQty >= 0); END; // Delete the following line. LOCAL PROCEDURE CheckILE@4(CountryRegionCode@1000 : Code[20]); // End of the deleted line. VAR CountryRegion@1001 : Record 9; BEGIN ...Replacement code 1
...
EXIT(AverageQty >= 0); END; // Add the following line. LOCAL PROCEDURE CountryOfOrigin@4(CountryRegionCode@1000 : Code[20]) : Boolean; // End of the added line. VAR CountryRegion@1001 : Record 9; BEGIN ...Existing code 2
...
IF ("Item Ledger Entry"."Country/Region Code" IN [CompanyInfo."Country/Region Code",'']) = (CountryRegionCode IN [CompanyInfo."Country/Region Code",'']) THEN // Delete the following line. CurrReport.SKIP; // End of the deleted line. IF CountryRegionCode <> '' THEN BEGIN CountryRegion.GET(CountryRegionCode); IF CountryRegion."Intrastat Code" = '' THEN ...Replacement code 2
...
IF ("Item Ledger Entry"."Country/Region Code" IN [CompanyInfo."Country/Region Code",'']) = (CountryRegionCode IN [CompanyInfo."Country/Region Code",'']) THEN // Add the following line. EXIT(FALSE); // End of the added line. IF CountryRegionCode <> '' THEN BEGIN CountryRegion.GET(CountryRegionCode); IF CountryRegion."Intrastat Code" = '' THEN ...Existing code 3
...
IF CountryRegionCode <> '' THEN BEGIN CountryRegion.GET(CountryRegionCode); IF CountryRegion."Intrastat Code" = '' THEN // Delete the following lines. CurrReport.SKIP; END; END; // End of the deleted lines. PROCEDURE TestILE@5(ItemLedgEntry@1000 : Record 32); VAR ItemLedgEntry2@1003 : Record 32; Location@1002 : Record 14; ...Replacement code 3
...
IF CountryRegionCode <> '' THEN BEGIN CountryRegion.GET(CountryRegionCode); IF CountryRegion."Intrastat Code" = '' THEN // Add the following lines. EXIT(FALSE); END; EXIT(TRUE); END; // End of the added lines. PROCEDURE HasCrossedBorder@5(ItemLedgEntry@1000 : Record 32) : Boolean; VAR ItemLedgEntry2@1003 : Record 32; Location@1002 : Record 14; ... -
Change the code in the TestILE function in the Get Item Ledger Entries report (594) as follows:
Existing code 1...
IF ("Country/Region Code" = CompanyInfo."Country/Region Code") OR ("Country/Region Code" = '') THEN // Delete the following line. CurrReport.SKIP; // End of the deleted line. IF "Applies-to Entry" = 0 THEN BEGIN ItemLedgEntry2.SETCURRENTKEY("Item No.","Posting Date"); ItemLedgEntry2.SETRANGE("Item No.","Item No."); ...Replacement code 1
...
IF ("Country/Region Code" = CompanyInfo."Country/Region Code") OR ("Country/Region Code" = '') THEN // Add the following line. EXIT(FALSE); // End of the added line. IF "Applies-to Entry" = 0 THEN BEGIN ItemLedgEntry2.SETCURRENTKEY("Item No.","Posting Date"); ItemLedgEntry2.SETRANGE("Item No.","Item No."); ...Existing code 2
...
IF (ItemLedgEntry2."Country/Region Code" <> CompanyInfo."Country/Region Code") AND (ItemLedgEntry2."Country/Region Code" <> '') THEN CurrReport.SKIP; END; "Entry Type" = "Entry Type"::Transfer: BEGIN ...Replacement code 2
...
IF (ItemLedgEntry2."Country/Region Code" <> CompanyInfo."Country/Region Code") AND (ItemLedgEntry2."Country/Region Code" <> '') THEN EXIT(FALSE); END; "Entry Type" = "Entry Type"::Transfer: BEGIN ...Existing code 3
...
IF ("Country/Region Code" = CompanyInfo."Country/Region Code") OR ("Country/Region Code" = '') THEN CurrReport.SKIP; IF "Transfer Order No." = '' THEN BEGIN Location.GET("Location Code"); IF (Location."Country/Region Code" <> '') AND ...Replacement code 3
...
IF ("Country/Region Code" = CompanyInfo."Country/Region Code") OR ("Country/Region Code" = '') THEN EXIT(FALSE); IF "Transfer Order No." = '' THEN BEGIN Location.GET("Location Code"); IF (Location."Country/Region Code" <> '') AND ...Existing code 4
...
IF (Location."Country/Region Code" <> '') AND (Location."Country/Region Code" <> CompanyInfo."Country/Region Code") THEN CurrReport.SKIP; END ELSE BEGIN ItemLedgEntry2.SETRANGE("Transfer Order No.","Transfer Order No."); ItemLedgEntry2.SETFILTER("Country/Region Code",'%1 | %2','',CompanyInfo."Country/Region Code"); ...Replacement code 4
...
IF (Location."Country/Region Code" <> '') AND (Location."Country/Region Code" <> CompanyInfo."Country/Region Code") THEN EXIT(FALSE); END ELSE BEGIN ItemLedgEntry2.SETRANGE("Transfer Order No.","Transfer Order No."); ItemLedgEntry2.SETFILTER("Country/Region Code",'%1 | %2','',CompanyInfo."Country/Region Code"); ...Existing code 5
...
Include := TRUE; UNTIL Include OR (ItemLedgEntry2.NEXT = 0); IF NOT Include THEN CurrReport.SKIP; END; END; "Location Code" <> '': ...Replacement code 5
...
Include := TRUE; UNTIL Include OR (ItemLedgEntry2.NEXT = 0); IF NOT Include THEN EXIT(FALSE); END; END; "Location Code" <> '': ...Existing code 6
...
"Location Code" <> '': BEGIN Location.GET("Location Code"); CheckILE(Location."Country/Region Code"); END; ELSE BEGIN IF "Entry Type" = "Entry Type"::Purchase THEN ...Replacement code 6
...
"Location Code" <> '': BEGIN Location.GET("Location Code"); IF NOT CountryOfOrigin(Location."Country/Region Code") THEN EXIT(FALSE); END; ELSE BEGIN IF "Entry Type" = "Entry Type"::Purchase THEN ...Existing code 7
...
END; ELSE BEGIN IF "Entry Type" = "Entry Type"::Purchase THEN CheckILE(CompanyInfo."Ship-to Country/Region Code"); IF "Entry Type" = "Entry Type"::Sale THEN CheckILE(CompanyInfo."Country/Region Code"); END; END; END; ...Replacement code 7
...
END; ELSE BEGIN IF "Entry Type" = "Entry Type"::Purchase THEN IF NOT CountryOfOrigin(CompanyInfo."Ship-to Country/Region Code") THEN EXIT(FALSE); IF "Entry Type" = "Entry Type"::Sale THEN IF NOT CountryOfOrigin(CompanyInfo."Country/Region Code") THEN EXIT(FALSE); END; END; END; ... -
Change the code in the HasCrossedBorder function in the Get Item Ledger Entries report (594) as follows:
Existing code...
END; END; END; END; ...Replacement code
...
END; END; END; EXIT(TRUE) END; PROCEDURE InsertValueEntryLine@6();...
Prerequisites
You must have one of the following products installed to apply this hotfix:
-
The Danish version of Microsoft Dynamics NAV 2009 R2
-
The Danish 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.