Tuesday, October 28, 2014

Fields that will be mapped in "Match Automatically" function of Bank Account Reconciliations

Following is the priority and the logic of how the "Match Automatically" function works in Bank Account Reconciliations in Dynamics NAV 2013

Priority
Bank Statement
Bank Account Ledger
Comment
1
Statement Amount
Remaining Amount
Will match if the amounts are identical
2
Description
Description,External Document No, Document No
Will match if the description text is identical or almost the same in any of the three fields
Payer Information
Description,External Document No, Document No
Will match if the payer information is identical or almost the same in any of the three fields
Transaction Information
Description,External Document No, Document No
Will match if the transaction information is identical or almost the same in any of the three fields
3
Transaction Date
Posting Date
Will match if the dates are identical or within the span of days specified in the "Transaction Date Toerance (Days)" field


Thank you and Regards,
Tharanga Chandrasekara 

Monday, October 27, 2014

How to clean Dynamics NAV 2013 debugger breakpoints

If you have so many debugger breakpoints where you can't go to each and disable then use this following TSQL code. 

 USE [NAVDatabase];   
 delete from dbo.[Debugger Breakpoint];  
 delete from dbo.[Session Event];  


Thank you and Regards,

Tharanga Chandrasekara 

Sunday, October 26, 2014

Control Add-in - Part 01

Have you ever wondered how to extend Dynamics NAV RTC to a different level and how to add extra functionality to Dynamics NAV within its own framework ?? Take a look at below images. (Taken from MSDN)
Dd983814.Local_-303088430_nav_controladdin_gauge_example(en-us,NAV.60).png

You can do this with the use of Control Add-in. Control Add-in allow you to extend RoleTailored client with custom functionality. Control Add-in is a custom control or a visual element which helps to modify or display data in RTC (RoleTailored client)It allows to extend Dynamics NAV to a different level. 
Microsoft introduced this functionality together with Dynamics NAV 2009 SP 01 and they called is as client extensibility application programming interface (API). The client extensibility API is provided in the Microsoft.Dynamics.Framework.UI.Extensibility.dll assembly. This gets installed with the RoleTailored client. By default, the path to the assembly is C:\Program Files\Microsoft Dynamics NAV\60\RoleTailored Client.

Windows Client Control Add-in Model

Following is the illustration of Microsoft Dynamics NAV windows client architecture. 

RoleTailored client control add-in model


You need to install the add-in assemblies on the computer that is running the Microsoft Dynamics NAV windows client and not in the computer that is running the Microsoft Dynamics NAS server. Control add-ins are instantiated by using metadata that is in the database, and not like the pages that are instantiated by the C/AL code.

Interfaces Overview

The following table describes the interfaces that you can implement in a control add-in.
Interface
Description
Data Binding interface
Displays data from the Microsoft Dynamics NAV database.
Event Interface
Selected public events in a control add-in that convert into C/AL triggers on a page that sends data back to the Microsoft Dynamics NAV Server.
Methods and Properties
Selected public methods and properties in a control add-in that can be called from C/AL triggers on a page.
Site Interface
Provides information about a control add-in and allows the control add-in to call functionality inside the Microsoft Dynamics NAV framework, such as retrieving metadata (visible, caption, and so on). This interface is implemented by the default definition interfaces and base classes of the client extensibility API.





















From next blog post I will take you through a demo of how to create a control add-in.


Click here for original article.

Thank you and Regards,
Tharanga Chandrasekara 

Saturday, October 25, 2014

Event : What's new on Microsoft Dynamics 2013 R2

On 24th September 2014 at Cinnamon LakesideZILLIONe Business Solution Sri Lanka hosted a gathering for Microsoft Dynamics NAV users. 
During the discussion we introduces Dynamics NAV 2013 R2 and new features comparing with Dynamics NAV 2009. Existing clients were really excited about the new look of the NAV 2013 R2 and new features. 
They were really excited about the assembly management and new dashboards of Dynamics NAV 2013 R2.
Laptops and tabs were setup outside the gathering to provide the first hand experience to the users
During the gathering
Everyone was excited about the product

Thank you and Regards,
Tharanga Chandrasekara 

Event : A cocktail evening of Microsoft Dynamics NAV 2013 R2

On 25th September 2014 at 8 Degrees North, Cinnamon LakesideZILLIONe Business Solution Sri Lanka hosted a cocktail evening for new prospects. During the gathering we introduces Dynamics NAV 2013 R2 to invitees and had a wonderful Q&A session with them. 

It was a great evening with lot of new chit chat about the product and everyone of them were excited about the new features and specially on the demo we did on our new add-on modules (customize dashboard and alert management system). 


 8 Degrees North, Cinnamon Lakeside
Demo stations were setup in the event so that users can have first hand experience

Just before the event start

Add-on module was the main attraction point
CEO of ZILLIONe Business Solution, addressing the gathering
Q&A Session
  
Finally we had a boat ride in the Beira Lake before we say good night to our new clients.


Thank you and Regards,
Tharanga Chandrasekara 

1st ever Sri Lankan Microsoft Silver competency partner for ERP - ZILLIONe Business Solution Sri Lanka

ZILLIONe Business Solution Sri Lanka achieves another milestone by becoming the 1st ever Sri Lankan Microsoft Silver competency partner for ERP


Proud to be a part of the journey! 

Thank you and Regards,
Tharanga Chandrasekara

Manage and control number of active user loggins

Even though client license says it is for 10 users there are some chances more than 10 users can access the system at the same time. I have faced this situation many times and we didn't had a option to control No. of user loggins. 

To achieve and control the number of user loggins I have written a small and silly code segment which check number of active users logged to NAV database and then check it with the actual users allowed. Then next user will not allowed to access the system if the number of allowed users are exceeded with the current level.

Here goes the code,

 OBJECT Table 79 Company Information  
 {  
  OBJECT-PROPERTIES  
  {  
   Date=14-10-25;  
   Time=[ 3:29:45 PM];  
   Modified=Yes;  
   Version List=NAVW16.00;  
  }  
  PROPERTIES  
  {  
   CaptionML=ENU=Company Information;  
  }  
  FIELDS  
  {  
   { 1  ;  ;Primary Key     ;Code10    ;CaptionML=ENU=Primary Key }  
   { 2  ;  ;Name        ;Text50    ;CaptionML=ENU=Name }  
   { 3  ;  ;Name 2       ;Text50    ;CaptionML=ENU=Name 2 }  
   { 4  ;  ;Address       ;Text50    ;CaptionML=ENU=Address }  
   { 5  ;  ;Address 2      ;Text50    ;CaptionML=ENU=Address 2 }  
   { 6  ;  ;City        ;Text30    ;OnValidate=BEGIN  
                                 PostCode.ValidateCity(City,"Post Code");  
                                END;  
                           OnLookup=BEGIN  
                                PostCode.LookUpCity(City,"Post Code",TRUE);  
                               END;  
                           CaptionML=ENU=City }  
   { 7  ;  ;Phone No.      ;Text30    ;ExtendedDatatype=Phone No.;  
                           CaptionML=ENU=Phone No. }  
   { 8  ;  ;Phone No. 2     ;Text30    ;ExtendedDatatype=Phone No.;  
                           CaptionML=ENU=Phone No. 2 }  
   { 9  ;  ;Telex No.      ;Text30    ;CaptionML=ENU=Telex No. }  
   { 10 ;  ;Fax No.       ;Text30    ;CaptionML=ENU=Fax No. }  
   { 11 ;  ;Giro No.      ;Text20    ;CaptionML=ENU=Giro No. }  
   { 12 ;  ;Bank Name      ;Text50    ;CaptionML=ENU=Bank Name }  
   { 13 ;  ;Bank Branch No.   ;Text20    ;CaptionML=ENU=Bank Branch No. }  
   { 14 ;  ;Bank Account No.  ;Text30    ;CaptionML=ENU=Bank Account No. }  
   { 15 ;  ;Payment Routing No. ;Text20    ;CaptionML=ENU=Payment Routing No. }  
   { 17 ;  ;Customs Permit No. ;Text10    ;CaptionML=ENU=Customs Permit No. }  
   { 18 ;  ;Customs Permit Date ;Date     ;CaptionML=ENU=Customs Permit Date }  
   { 19 ;  ;VAT Registration No.;Text20    ;OnValidate=VAR  
                                 VATRegNoFormat@1000 : Record 381;  
                                BEGIN  
                                 VATRegNoFormat.Test("VAT Registration No.","Country/Region Code",'',DATABASE::"Company Information");  
                                END;  
                           CaptionML=ENU=VAT Registration No. }  
   { 20 ;  ;Registration No.  ;Text20    ;CaptionML=ENU=Registration No. }  
   { 21 ;  ;Telex Answer Back  ;Text20    ;CaptionML=ENU=Telex Answer Back }  
   { 22 ;  ;Ship-to Name    ;Text50    ;CaptionML=ENU=Ship-to Name }  
   { 23 ;  ;Ship-to Name 2   ;Text50    ;CaptionML=ENU=Ship-to Name 2 }  
   { 24 ;  ;Ship-to Address   ;Text50    ;CaptionML=ENU=Ship-to Address }  
   { 25 ;  ;Ship-to Address 2  ;Text50    ;CaptionML=ENU=Ship-to Address 2 }  
   { 26 ;  ;Ship-to City    ;Text30    ;OnValidate=BEGIN  
                                 PostCode.ValidateCity("Ship-to City","Ship-to Post Code");  
                                END;  
                           OnLookup=BEGIN  
                                PostCode.LookUpCity("Ship-to City","Ship-to Post Code",TRUE);  
                               END;  
                           CaptionML=ENU=Ship-to City }  
   { 27 ;  ;Ship-to Contact   ;Text50    ;CaptionML=ENU=Ship-to Contact }  
   { 28 ;  ;Location Code    ;Code10    ;TableRelation=Location WHERE (Use As In-Transit=CONST(No));  
                           CaptionML=ENU=Location Code }  
   { 29 ;  ;Picture       ;BLOB     ;CaptionML=ENU=Picture;  
                           SubType=Bitmap }  
   { 30 ;  ;Post Code      ;Code20    ;TableRelation="Post Code";  
                           OnValidate=BEGIN  
                                 PostCode.ValidatePostCode(City,"Post Code");  
                                END;  
                           OnLookup=BEGIN  
                                PostCode.LookUpPostCode(City,"Post Code",TRUE);  
                               END;  
                           ValidateTableRelation=No;  
                           TestTableRelation=No;  
                           CaptionML=ENU=Post Code }  
   { 31 ;  ;County       ;Text30    ;CaptionML=ENU=County }  
   { 32 ;  ;Ship-to Post Code  ;Code20    ;TableRelation="Post Code";  
                           OnValidate=BEGIN  
                                 PostCode.ValidatePostCode("Ship-to City","Ship-to Post Code");  
                                END;  
                           OnLookup=BEGIN  
                                PostCode.LookUpPostCode("Ship-to City","Ship-to Post Code",TRUE);  
                               END;  
                           ValidateTableRelation=No;  
                           TestTableRelation=No;  
                           CaptionML=ENU=Ship-to Post Code }  
   { 33 ;  ;Ship-to County   ;Text30    ;CaptionML=ENU=Ship-to County }  
   { 34 ;  ;E-Mail       ;Text80    ;ExtendedDatatype=E-Mail;  
                           CaptionML=ENU=E-Mail }  
   { 35 ;  ;Home Page      ;Text80    ;ExtendedDatatype=URL;  
                           CaptionML=ENU=Home Page }  
   { 36 ;  ;Country/Region Code ;Code10    ;TableRelation=Country/Region;  
                           CaptionML=ENU=Country/Region Code }  
   { 37 ;  ;Ship-to Country/Region Code;Code10 ;TableRelation=Country/Region;  
                           CaptionML=ENU=Ship-to Country/Region Code }  
   { 38 ;  ;IBAN        ;Code50    ;OnValidate=BEGIN  
                                 CheckIBAN(IBAN);  
                                END;  
                           CaptionML=ENU=IBAN }  
   { 39 ;  ;SWIFT Code     ;Code20    ;CaptionML=ENU=SWIFT Code }  
   { 40 ;  ;Industrial Classification;Text30  ;CaptionML=ENU=Industrial Classification }  
   { 41 ;  ;IC Partner Code   ;Code20    ;CaptionML=ENU=IC Partner Code }  
   { 42 ;  ;IC Inbox Type    ;Option    ;OnValidate=BEGIN  
                                 IF "IC Inbox Type" = "IC Inbox Type"::Database THEN  
                                  "IC Inbox Details" := '';  
                                END;  
                           CaptionML=ENU=IC Inbox Type;  
                           OptionCaptionML=ENU=File Location,Database;  
                           OptionString=File Location,Database }  
   { 43 ;  ;IC Inbox Details  ;Text250    ;OnLookup=VAR  
                                CmDlgMgt@1001 : Codeunit 412;  
                                i@1000 : Integer;  
                                FileName@1002 : Text[1024];  
                               BEGIN  
                                TESTFIELD("IC Partner Code");  
                                CASE "IC Inbox Type" OF  
                                 "IC Inbox Type"::"File Location":  
                                  BEGIN  
                                   IF "IC Inbox Details" = '' THEN BEGIN  
                                    FileName := STRSUBSTNO('%1.xml',"IC Partner Code");  
                                    "IC Inbox Details" := CmDlgMgt.OpenFile(Text001,FileName,4,'*.xml|*.xml',1)  
                                   END ELSE BEGIN  
                                    FileName := "IC Inbox Details" + STRSUBSTNO('\%1.xml',"IC Partner Code");  
                                    "IC Inbox Details" := CmDlgMgt.OpenFile(Text001,FileName,4,'*.xml|*.xml',1);  
                                   END;  
                                   IF STRLEN("IC Inbox Details") > 4 THEN BEGIN  
                                    i := STRLEN("IC Inbox Details") - 4;  
                                    WHILE (i > 1) AND ("IC Inbox Details"[i] <> '\') DO  
                                     i := i - 1;  
                                    IF i > 1 THEN  
                                     "IC Inbox Details" := COPYSTR("IC Inbox Details",1,i - 1);  
                                   END;  
                                  END;  
                                END;  
                               END;  
                           CaptionML=ENU=IC Inbox Details }  
   { 44 ;  ;Abbreviated Name  ;Text4     ;CaptionML=ENU=Abbreviated Name }  
   { 45 ;  ;Show Abbreviated Name;Boolean   ;CaptionML=ENU=Show Abbreviated Name }  
   { 5700;  ;Responsibility Center;Code10    ;TableRelation="Responsibility Center".Code;  
                           ValidateTableRelation=Yes;  
                           CaptionML=ENU=Responsibility Center }  
   { 5791;  ;Check-Avail. Period Calc.;DateFormula;  
                           CaptionML=ENU=Check-Avail. Period Calc. }  
   { 5792;  ;Check-Avail. Time Bucket;Option  ;CaptionML=ENU=Check-Avail. Time Bucket;  
                           OptionCaptionML=ENU=Day,Week,Month,Quarter,Year;  
                           OptionString=Day,Week,Month,Quarter,Year }  
   { 7600;  ;Base Calendar Code ;Code10    ;TableRelation="Base Calendar";  
                           CaptionML=ENU=Base Calendar Code }  
   { 7601;  ;Cal. Convergence Time Frame;DateFormula;  
                           InitValue=1Y;  
                           CaptionML=ENU=Cal. Convergence Time Frame }  
   { 50000; ;Session Available  ;Integer    }  
  }  
  KEYS  
  {  
   {  ;Primary Key               ;Clustered=Yes }  
  }  
  FIELDGROUPS  
  {  
  }  
  CODE  
  {  
   VAR  
    PostCode@1000 : Record 225;  
    Text000@1001 : TextConst 'ENU=The number you entered is not a valid IBAN.';  
    Text001@1002 : TextConst 'ENU=File Location for IC files';  
    Text002@1003 : TextConst 'ENU=Before you can use Online Map, you must fill in the Online Map Setup window.\See Setting Up Online Map in Help.';  
   PROCEDURE CheckIBAN@1(IBANCode@1000 : Code[100]);  
   VAR  
    Modulus97@1001 : Integer;  
    I@1002 : Integer;  
   BEGIN  
    IF IBANCode = '' THEN  
     EXIT;  
    IBANCode := DELCHR(IBANCode);  
    Modulus97 := 97;  
    IF (STRLEN(IBANCode) <= 5) OR (STRLEN(IBANCode) > 34) THEN  
     IBANError;  
    ConvertIBAN(IBANCode);  
    WHILE STRLEN(IBANCode) > 6 DO  
     IBANCode := CalcModulus(COPYSTR(IBANCode,1,6),Modulus97) + COPYSTR(IBANCode,7);  
    EVALUATE(I,IBANCode);  
    IF (I MOD Modulus97) <> 1 THEN  
     IBANError;  
   END;  
   LOCAL PROCEDURE ConvertIBAN@4(VAR IBANCode@1000 : Code[100]);  
   VAR  
    I@1002 : Integer;  
   BEGIN  
    IBANCode := COPYSTR(IBANCode,5) + COPYSTR(IBANCode,1,4);  
    I := 0;  
    WHILE I < STRLEN(IBANCode) DO BEGIN  
     I := I + 1;  
     IF ConvertLetter(IBANCode,COPYSTR(IBANCode,I,1),I) THEN  
      I := 0;  
    END;  
   END;  
   LOCAL PROCEDURE CalcModulus@3(Number@1000 : Code[10];Modulus97@1001 : Integer) : Code[10];  
   VAR  
    I@1002 : Integer;  
   BEGIN  
    EVALUATE(I,Number);  
    I := I MOD Modulus97;  
    IF I = 0 THEN  
     EXIT('');  
    EXIT(FORMAT(I));  
   END;  
   LOCAL PROCEDURE ConvertLetter@5(VAR IBANCode@1000 : Code[100];Letter@1001 : Code[1];LetterPlace@1002 : Integer) : Boolean;  
   VAR  
    Letter2@1003 : Code[2];  
   BEGIN  
    IF (Letter >= 'A') AND (Letter <= 'Z') THEN BEGIN  
     CASE Letter OF  
      'A': Letter2 := '10';  
      'B': Letter2 := '11';  
      'C': Letter2 := '12';  
      'D': Letter2 := '13';  
      'E': Letter2 := '14';  
      'F': Letter2 := '15';  
      'G': Letter2 := '16';  
      'H': Letter2 := '17';  
      'I': Letter2 := '18';  
      'J': Letter2 := '19';  
      'K': Letter2 := '20';  
      'L': Letter2 := '21';  
      'M': Letter2 := '22';  
      'N': Letter2 := '23';  
      'O': Letter2 := '24';  
      'P': Letter2 := '25';  
      'Q': Letter2 := '26';  
      'R': Letter2 := '27';  
      'S': Letter2 := '28';  
      'T': Letter2 := '29';  
      'U': Letter2 := '30';  
      'V': Letter2 := '31';  
      'W': Letter2 := '32';  
      'X': Letter2 := '33';  
      'Y': Letter2 := '34';  
      'Z': Letter2 := '35';  
     END;  
     IF LetterPlace = 1 THEN  
      IBANCode := Letter2 + COPYSTR(IBANCode,2)  
     ELSE BEGIN  
      IF LetterPlace = STRLEN(IBANCode) THEN  
       IBANCode := COPYSTR(IBANCode,1,LetterPlace - 1) + Letter2  
      ELSE  
       IBANCode :=  
        COPYSTR(IBANCode,1,LetterPlace - 1) + Letter2 + COPYSTR(IBANCode,LetterPlace + 1);  
     END;  
     EXIT(TRUE);  
    END;  
    IF (Letter >= '0') AND (Letter <= '9') THEN  
     EXIT(FALSE);  
    IBANError;  
   END;  
   LOCAL PROCEDURE IBANError@12();  
   BEGIN  
    ERROR(Text000);  
   END;  
   PROCEDURE DisplayMap@7();  
   VAR  
    MapPoint@1001 : Record 800;  
    MapMgt@1000 : Codeunit 802;  
   BEGIN  
    IF MapPoint.FIND('-') THEN  
     MapMgt.MakeSelection(DATABASE::"Company Information",GETPOSITION)  
    ELSE MESSAGE(Text002);  
   END;  
   BEGIN  
   END.  
  }  
 }  
 OBJECT Form 1 Company Information  
 {  
  OBJECT-PROPERTIES  
  {  
   Date=14-10-25;  
   Time=[ 3:30:36 PM];  
   Modified=Yes;  
   Version List=NAVW16.00;  
  }  
  PROPERTIES  
  {  
   Width=16170;  
   Height=8140;  
   CaptionML=ENU=Company Information;  
   InsertAllowed=No;  
   DeleteAllowed=No;  
   SourceTable=Table79;  
   OnOpenForm=VAR  
          MapMgt@1000 : Codeunit 802;  
         BEGIN  
          RESET;  
          IF NOT GET THEN BEGIN  
           INIT;  
           INSERT;  
          END;  
          IF NOT MapMgt.TestSetup THEN  
           CurrForm.MapPoint.VISIBLE(FALSE);  
         END;  
  }  
  CONTROLS  
  {  
   { 1  ;TabControl  ;220 ;220 ;15730;6930 ;HorzGlue=Both;  
                          VertGlue=Both;  
                          PageNamesML=ENU=General,Communication,Payments,Shipping, User Session }  
   { 2  ;TextBox   ;3850 ;990 ;5500 ;440 ;ParentControl=1;  
                          InPage=0;  
                          SourceExpr=Name }  
   { 3  ;Label    ;440 ;990 ;3300 ;440 ;ParentControl=2;  
                          InPage=0 }  
   { 4  ;TextBox   ;3850 ;1540 ;5500 ;440 ;ParentControl=1;  
                          InPage=0;  
                          SourceExpr=Address }  
   { 5  ;Label    ;440 ;1540 ;3300 ;440 ;ParentControl=4;  
                          InPage=0 }  
   { 6  ;TextBox   ;3850 ;2090 ;5500 ;440 ;ParentControl=1;  
                          InPage=0;  
                          SourceExpr="Address 2" }  
   { 7  ;Label    ;440 ;2090 ;3300 ;440 ;ParentControl=6;  
                          InPage=0 }  
   { 10 ;TextBox   ;3850 ;3850 ;2750 ;440 ;ParentControl=1;  
                          InPage=0;  
                          SourceExpr="Phone No." }  
   { 11 ;Label    ;440 ;3850 ;3300 ;440 ;ParentControl=10;  
                          InPage=0 }  
   { 14 ;TextBox   ;3850 ;4510 ;2750 ;440 ;ParentControl=1;  
                          InPage=0;  
                          SourceExpr="VAT Registration No." }  
   { 15 ;Label    ;440 ;4510 ;3300 ;440 ;ParentControl=14;  
                          InPage=0 }  
   { 33 ;PictureBox  ;9570 ;990 ;6160 ;3960 ;HorzGlue=Both;  
                          VertGlue=Both;  
                          ParentControl=1;  
                          InPage=0;  
                          SourceExpr=Picture }  
   { 8  ;TextBox   ;6710 ;2640 ;2640 ;440 ;ParentControl=1;  
                          InPage=0;  
                          NextControl=42;  
                          SourceExpr=City }  
   { 34 ;TextBox   ;3850 ;2640 ;2750 ;440 ;ParentControl=1;  
                          InPage=0;  
                          NextControl=8;  
                          SourceExpr="Post Code" }  
   { 46 ;Label    ;440 ;2640 ;3300 ;440 ;ParentControl=34;  
                          CaptionML=ENU=Post Code/City }  
   { 42 ;TextBox   ;3850 ;3190 ;2750 ;440 ;ParentControl=1;  
                          InPage=0;  
                          SourceExpr="Country/Region Code" }  
   { 45 ;Label    ;440 ;3190 ;3300 ;440 ;ParentControl=42 }  
   { 76 ;TextBox   ;3850 ;5170 ;2750 ;440 ;ParentControl=1;  
                          InPage=0;  
                          SourceExpr="Industrial Classification" }  
   { 77 ;Label    ;440 ;5170 ;3300 ;440 ;ParentControl=76 }  
   { 86 ;CommandButton;6710 ;3190 ;440 ;440 ;Name=MapPoint;  
                          ParentControl=1;  
                          InPage=0;  
                          ShowCaption=No;  
                          Bitmap=53;  
                          ToolTipML=ENU=Display Map;  
                          OnPush=BEGIN  
                              DisplayMap;  
                             END;  
                              }  
   { 87 ;TextBox   ;3850 ;5830 ;1320 ;440 ;ParentControl=1;  
                          InPage=0;  
                          SourceExpr="Abbreviated Name" }  
   { 88 ;Label    ;440 ;5830 ;3300 ;440 ;ParentControl=87 }  
   { 89 ;CheckBox   ;3850 ;6380 ;440 ;440 ;ParentControl=1;  
                          InPage=0;  
                          ShowCaption=No;  
                          SourceExpr="Show Abbreviated Name" }  
   { 90 ;Label    ;440 ;6380 ;3300 ;440 ;ParentControl=89 }  
   { 50 ;TextBox   ;3850 ;990 ;2750 ;440 ;ParentControl=1;  
                          InPage=1;  
                          SourceExpr="Phone No." }  
   { 53 ;Label    ;440 ;990 ;3300 ;440 ;ParentControl=50 }  
   { 54 ;TextBox   ;3850 ;1540 ;2750 ;440 ;ParentControl=1;  
                          InPage=1;  
                          SourceExpr="Fax No." }  
   { 55 ;Label    ;440 ;1540 ;3300 ;440 ;ParentControl=54 }  
   { 56 ;TextBox   ;3850 ;2200 ;2750 ;440 ;ParentControl=1;  
                          InPage=1;  
                          SourceExpr="E-Mail" }  
   { 57 ;Label    ;440 ;2200 ;3300 ;440 ;ParentControl=56 }  
   { 58 ;TextBox   ;3850 ;2750 ;2750 ;440 ;ParentControl=1;  
                          InPage=1;  
                          SourceExpr="Home Page" }  
   { 59 ;Label    ;440 ;2750 ;3300 ;440 ;ParentControl=58 }  
   { 9  ;CommandButton;6710 ;2750 ;440 ;440 ;ParentControl=1;  
                          InPage=1;  
                          ShowCaption=No;  
                          Bitmap=20;  
                          ToolTipML=ENU=Hyperlink;  
                          OnPush=BEGIN  
                              TESTFIELD("Home Page");  
                              HYPERLINK("Home Page");  
                             END;  
                              }  
   { 12 ;CommandButton;6710 ;2200 ;440 ;440 ;ParentControl=1;  
                          InPage=1;  
                          ShowCaption=No;  
                          Bitmap=21;  
                          ToolTipML=ENU=New Mail Message;  
                          OnPush=BEGIN  
                              Mail.OpenNewMessage("E-Mail");  
                             END;  
                              }  
   { 78 ;TextBox   ;3850 ;3410 ;2750 ;440 ;ParentControl=1;  
                          InPage=1;  
                          SourceExpr="IC Partner Code" }  
   { 79 ;Label    ;440 ;3410 ;3300 ;440 ;ParentControl=78 }  
   { 80 ;TextBox   ;3850 ;3960 ;2750 ;440 ;ParentControl=1;  
                          InPage=1;  
                          SourceExpr="IC Inbox Type" }  
   { 81 ;Label    ;440 ;3960 ;3300 ;440 ;ParentControl=80 }  
   { 82 ;TextBox   ;3850 ;4510 ;5500 ;440 ;ParentControl=1;  
                          InPage=1;  
                          SourceExpr="IC Inbox Details" }  
   { 83 ;Label    ;440 ;4510 ;3300 ;440 ;ParentControl=82 }  
   { 16 ;TextBox   ;3850 ;990 ;5500 ;440 ;ParentControl=1;  
                          InPage=2;  
                          SourceExpr="Bank Name" }  
   { 17 ;Label    ;440 ;990 ;3300 ;440 ;ParentControl=16 }  
   { 22 ;TextBox   ;3850 ;2640 ;2750 ;440 ;ParentControl=1;  
                          InPage=2;  
                          SourceExpr="Payment Routing No." }  
   { 23 ;Label    ;440 ;2640 ;3300 ;440 ;ParentControl=22 }  
   { 24 ;TextBox   ;3850 ;3300 ;2750 ;440 ;ParentControl=1;  
                          InPage=2;  
                          SourceExpr="Giro No." }  
   { 25 ;Label    ;440 ;3300 ;3300 ;440 ;ParentControl=24 }  
   { 20 ;TextBox   ;3850 ;2090 ;2750 ;440 ;ParentControl=1;  
                          InPage=2;  
                          SourceExpr="Bank Account No." }  
   { 21 ;Label    ;440 ;2090 ;3300 ;440 ;ParentControl=20 }  
   { 18 ;TextBox   ;3850 ;1540 ;2750 ;440 ;ParentControl=1;  
                          InPage=2;  
                          SourceExpr="Bank Branch No." }  
   { 19 ;Label    ;440 ;1540 ;3300 ;440 ;ParentControl=18 }  
   { 72 ;TextBox   ;3850 ;3960 ;2750 ;440 ;ParentControl=1;  
                          InPage=2;  
                          SourceExpr="SWIFT Code" }  
   { 73 ;Label    ;440 ;3960 ;3300 ;440 ;ParentControl=72 }  
   { 74 ;TextBox   ;3850 ;4510 ;5500 ;440 ;ParentControl=1;  
                          InPage=2;  
                          SourceExpr=IBAN }  
   { 75 ;Label    ;440 ;4510 ;3300 ;440 ;ParentControl=74 }  
   { 47 ;TextBox   ;12980;990 ;2750 ;440 ;ParentControl=1;  
                          InPage=3;  
                          SourceExpr="Location Code" }  
   { 48 ;Label    ;9570 ;990 ;3300 ;440 ;ParentControl=47 }  
   { 35 ;TextBox   ;3850 ;990 ;5500 ;440 ;ParentControl=1;  
                          InPage=3;  
                          SourceExpr="Ship-to Name" }  
   { 36 ;Label    ;440 ;990 ;3300 ;440 ;ParentControl=35 }  
   { 37 ;TextBox   ;3850 ;1540 ;5500 ;440 ;ParentControl=1;  
                          InPage=3;  
                          SourceExpr="Ship-to Address" }  
   { 38 ;Label    ;440 ;1540 ;3300 ;440 ;ParentControl=37 }  
   { 39 ;TextBox   ;3850 ;2090 ;5500 ;440 ;ParentControl=1;  
                          InPage=3;  
                          SourceExpr="Ship-to Address 2" }  
   { 40 ;Label    ;440 ;2090 ;3300 ;440 ;ParentControl=39 }  
   { 43 ;TextBox   ;3850 ;3850 ;5500 ;440 ;ParentControl=1;  
                          InPage=3;  
                          SourceExpr="Ship-to Contact" }  
   { 44 ;Label    ;440 ;3850 ;3300 ;440 ;ParentControl=43 }  
   { 49 ;TextBox   ;6710 ;2640 ;2640 ;440 ;ParentControl=1;  
                          InPage=3;  
                          NextControl=60;  
                          SourceExpr="Ship-to City" }  
   { 51 ;TextBox   ;3850 ;2640 ;2750 ;440 ;ParentControl=1;  
                          InPage=3;  
                          NextControl=49;  
                          SourceExpr="Ship-to Post Code" }  
   { 52 ;Label    ;440 ;2640 ;3300 ;440 ;ParentControl=51;  
                          CaptionML=ENU=Ship-to Post Code/City }  
   { 13 ;TextBox   ;12980;1540 ;2750 ;440 ;ParentControl=1;  
                          InPage=3;  
                          SourceExpr="Responsibility Center" }  
   { 41 ;Label    ;9570 ;1540 ;3300 ;440 ;ParentControl=13 }  
   { 60 ;TextBox   ;3850 ;3190 ;2750 ;440 ;ParentControl=1;  
                          InPage=3;  
                          SourceExpr="Ship-to Country/Region Code" }  
   { 61 ;Label    ;440 ;3190 ;3300 ;440 ;ParentControl=60 }  
   { 62 ;TextBox   ;12980;2090 ;2750 ;440 ;ParentControl=1;  
                          InPage=3;  
                          SourceExpr="Check-Avail. Period Calc." }  
   { 63 ;Label    ;9570 ;2090 ;3300 ;440 ;ParentControl=62 }  
   { 64 ;TextBox   ;12980;2640 ;2750 ;440 ;ParentControl=1;  
                          InPage=3;  
                          SourceExpr="Check-Avail. Time Bucket" }  
   { 65 ;Label    ;9570 ;2640 ;3300 ;440 ;ParentControl=64 }  
   { 67 ;TextBox   ;12980;3190 ;2750 ;440 ;ParentControl=1;  
                          InPage=3;  
                          DrillDown=No;  
                          SourceExpr="Base Calendar Code" }  
   { 68 ;Label    ;9570 ;3190 ;3300 ;440 ;ParentControl=67 }  
   { 69 ;TextBox   ;12980;3740 ;1700 ;440 ;Name=Customized Calendar;  
                          Editable=No;  
                          ParentControl=1;  
                          InPage=3;  
                          DrillDown=Yes;  
                          CaptionML=ENU=Customized Calendar;  
                          SourceExpr=CalendarMgmt.CustomizedCalendarExistText(CustomizedCalendar."Source Type"::Company,'','',"Base Calendar Code");  
                          OnDrillDown=BEGIN  
                                 CurrForm.SAVERECORD;  
                                 TESTFIELD("Base Calendar Code");  
                                 CalendarMgmt.ShowCustomizedCalendar(CustomizedCalEntry."Source Type"::Company,'','',"Base Calendar Code");  
                                END;  
                                }  
   { 71 ;Label    ;9790 ;3740 ;3080 ;440 ;ParentControl=69;  
                          InPage=3;  
                          CaptionML=ENU=Customized Calendar }  
   { 84 ;TextBox   ;12980;4290 ;1700 ;440 ;ParentControl=1;  
                          InPage=3;  
                          SourceExpr="Cal. Convergence Time Frame" }  
   { 85 ;Label    ;9570 ;4290 ;3300 ;440 ;ParentControl=84 }  
   { 1000000004;TextBox;3850 ;1320 ;1700 ;440 ;ParentControl=1;  
                          InPage=4;  
                          SourceExpr="Session Available" }  
   { 1000000005;Label ;440 ;1320 ;3300 ;440 ;ParentControl=1000000004 }  
   { 26 ;CommandButton;4070 ;7370 ;2200 ;550 ;HorzGlue=Right;  
                          VertGlue=Bottom;  
                          Default=Yes;  
                          PushAction=LookupOK;  
                          InvalidActionAppearance=Hide }  
   { 27 ;CommandButton;6490 ;7370 ;2200 ;550 ;HorzGlue=Right;  
                          VertGlue=Bottom;  
                          Cancel=Yes;  
                          PushAction=LookupCancel;  
                          InvalidActionAppearance=Hide }  
   { 28 ;MenuButton  ;11330;7370 ;2200 ;550 ;HorzGlue=Right;  
                          VertGlue=Bottom;  
                          CaptionML=ENU=&Picture;  
                          Menu=MENUITEMS  
                          {  
                           { ID=29;  
                            Ellipsis=Yes;  
                            CaptionML=ENU=Import;  
                            OnPush=BEGIN  
                                PictureExists := Picture.HASVALUE;  
                                IF Picture.IMPORT('*.BMP',TRUE) = '' THEN  
                                 EXIT;  
                                IF PictureExists THEN  
                                 IF NOT CONFIRM(Text001,FALSE) THEN  
                                  EXIT;  
                                CurrForm.SAVERECORD;  
                               END;  
                                }  
                           { ID=30;  
                            Ellipsis=Yes;  
                            CaptionML=ENU=E&xport;  
                            OnPush=BEGIN  
                                IF Picture.HASVALUE THEN  
                                 Picture.EXPORT('*.BMP',TRUE);  
                               END;  
                                }  
                           { ID=31;  
                            CaptionML=ENU=Delete;  
                            OnPush=BEGIN  
                                IF Picture.HASVALUE THEN  
                                 IF CONFIRM(Text002,FALSE) THEN BEGIN  
                                  CLEAR(Picture);  
                                  CurrForm.SAVERECORD;  
                                 END;  
                               END;  
                                }  
                          }  
                          }  
   { 32 ;CommandButton;13750;7370 ;2200 ;550 ;HorzGlue=Right;  
                          VertGlue=Bottom;  
                          PushAction=FormHelp }  
   { 66 ;MenuButton  ;8910 ;7370 ;2200 ;550 ;HorzGlue=Right;  
                          VertGlue=Bottom;  
                          CaptionML=ENU=&Company;  
                          Menu=MENUITEMS  
                          {  
                           { ID=70;  
                            PushAction=RunObject;  
                            CaptionML=ENU=Responsibility Centers;  
                            RunObject=Form 5714 }  
                           { ID=91;  
                            MenuItemType=Separator }  
                           { ID=92;  
                            CaptionML=ENU=Online Map;  
                            OnPush=BEGIN  
                                DisplayMap;  
                               END;  
                                }  
                          }  
                          }  
  }  
  CODE  
  {  
   VAR  
    Text001@1000 : TextConst 'ENU=Do you want to replace the existing picture?';  
    Text002@1001 : TextConst 'ENU=Do you want to delete the picture?';  
    CustomizedCalEntry@1007 : Record 7603;  
    CustomizedCalendar@1005 : Record 7602;  
    CalendarMgmt@1004 : Codeunit 7600;  
    Mail@1002 : Codeunit 397;  
    PictureExists@1003 : Boolean;  
   BEGIN  
   END.  
  }  
 }  
 OBJECT Codeunit 50096 Session Management  
 {  
  OBJECT-PROPERTIES  
  {  
   Date=14-08-05;  
   Time=[ 5:06:04 PM];  
   Modified=Yes;  
   Version List=;  
  }  
  PROPERTIES  
  {  
   OnRun=BEGIN  
       //checkSession;  
      END;  
  }  
  CODE  
  {  
   PROCEDURE checkSession@1000000001() loginAllowed : Boolean;  
   VAR  
    recSessions01@1000000000 : Record 2000000009;  
    recSessions02@1000000001 : Record 2000000009;  
    WindowsShell@1000000002 : Automation "{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} 1.0:{72C24DD5-D70A-438B-8A42-98424B88AFB8}:'Windows Script Host Object Model'.WshShell";  
    recCompany@1000000003 : Record 79;  
    recDatabase@1000000004 : Record 2000000048;  
    dbName@1000000005 : Text[30];  
   BEGIN  
    recDatabase.RESET;  
    recDatabase.SETFILTER(recDatabase."My Database",'%1',TRUE);  
    IF recDatabase.FINDFIRST THEN BEGIN  
      dbName := recDatabase."Database Name";  
    END;  
    loginAllowed := TRUE;  
    recSessions01.RESET;  
    recSessions01.SETFILTER(recSessions01."User ID",'<>%1','sa');  
    recSessions01.SETRANGE(recSessions01."Database Name",'%1',dbName);  
    recCompany.RESET;  
    IF recCompany.FINDFIRST THEN BEGIN  
      IF recSessions01.COUNT > recCompany."Session Available" THEN BEGIN  
       IF CONFIRM ('Available login sessions have been exceeded',FALSE,FALSE) THEN BEGIN  
         CREATE(WindowsShell);  
         WindowsShell.SendKeys('%{F4}');  
         CLEAR(WindowsShell);  
       END ELSE BEGIN  
         CREATE(WindowsShell);  
         WindowsShell.SendKeys('%{F4}');  
         CLEAR(WindowsShell);  
       END;  
      END;  
    END;  
   END;  
   BEGIN  
   END.  
  }  
 }  

Import this codeunit and other objects and then compile. 

Go to company information form and set the number of active users you want to have for your company and then go to Codeunit 01 and then modify it to call the "checkSession" function for every new loggin. Compile and save the code. 

So from next loggin this would work and if the number of set users are exceed with the current active users, then that loggin will not go through and will result in closing the application automatically. 

Setting number of active users in company information table will not do work because then client can change it anytime he want. I think you can figure out a way to avoid that or to modify this code accordingly. 

Thank you and Regards,
Tharanga Chandrasekara


Length of G/L Account name in Microsoft Dynamics NAV

I was reading Vjeko.com and I found this article about Length of the G/L account. 
May be you already know this and may be not. Therefore I thought to share it with you all again. 

In earlier versions of Dynamics NAV (before NAV 2013) default length of the G/L Account Name in the G/L Account table was 30 Text. 
Dynamics NAV 2009 SP 01
With the introduction of Dynamics NAV 2013, Microsoft has changed this to text 50. 
Dynamics NAV 2013
This may sound very minor thing if you never had a customer who never want to change the name of the G/L account. I have experienced this several times, where my client do not want to change or short the name of the G/L account at any cost. So to cater their requirement we had to modify various objects. 

And with the new version of Microsoft Dynamics NAV 2013, length of the description of all the master tables has been set to text 50.

Click here to refer the original article.

Thank you and Regards,
Tharanga Chandrasekara

How to kill a session in Microsoft Dynamics NAV 2013 using session page in the windows client.

If you want to kill a session by force then use following method. There are few other methods available to achieve the same output, but this is one of the easiest methods.
1. First open the Microsoft Dynamics NAV Development environment. 
2. Open Object designer (Shift + F12)
3. Go to Page 9506 (Session List)
4. Create a new action and name it as "Kill Session"
5. Go to C/AL code editor and enter below code in the "OnAction" trigger.
 IF CONFIRM ('Do you want to kill the session ?") THEN   
   STOPSESSION("Session ID");  
6. Save and compile the page.
7. Run page 9506 and select the session you want to kill 
8. Hit the "Kill Session" button.

That is it! 

Thank you and Regards,
Tharanga Chandrasekara

How to Shutdown SQL Server without interrupting existing users.

Is there a way to shutdown SQL server without interrupting to existing users? Yes you can
I am sure you have opened Window Services or SQL Server configuration manager many times before. Have you ever notice that when you right click on the SQL Server it gives you 5 options. One of this options does the trick for you. 

Option that does the trick is 'Pause".


Once you pause the service it will NOT allow for any new connections to be made with SQL service; however it will allow existing users to do their work until they cut off the connection with the SQL Service.  
Once all the users are logged off from the service you can safely shutdown your SQL Server. 


Thank you and Regards,
Tharanga Chandrasekara


Thursday, October 23, 2014

Error : The transaction cannot be completed because it will cause inconsistencies - NAV 2009 SP 01 | NAV 2009 R2

Today one of our client complained that he can't unapply a payment, at first we thought he was doing it wrong. So we remotely logged to their system and asked him to unapply the entry. 
Here comes the error..

To find the problem and a solution I started to surf. I found 2 fine articles and I have used both these article to provide the solution for this issue. 


How to find why this is happening and which entry is actually triggering this error. 


First created a new codeunit using following code,

 OBJECT Codeunit 50000 Single Instance CU
{
  OBJECT-PROPERTIES
  {
    Date=14-10-23;
    Time=12:54:04 PM;
    Modified=Yes;
    Version List=MOD01;
  }
  PROPERTIES
  {
    SingleInstance=Yes;
    OnRun=BEGIN
             IF NOT StoreToTemp THEN BEGIN
              StoreToTemp := TRUE;
            END ELSE
              FORM.RUNMODAL(0,TempGLEntry);
          END;
  }
  CODE
  {
    VAR
      TempGLEntry@1000000000 : TEMPORARY Record 17;
      StoreToTemp@1000000001 : Boolean;

    PROCEDURE InsertGL@1000000000(GLEntry@1000000000 : Record 17);
    BEGIN
      IF StoreToTemp THEN BEGIN
        TempGLEntry := GLEntry;
        IF NOT TempGLEntry.INSERT THEN BEGIN
           TempGLEntry.DELETEALL;
           TempGLEntry.INSERT;
       END;
      END;
    END;
    BEGIN
    END.
  }
}


And in Codeunit 12 add the following code in function "FinishCodeunit()
 FinishCodeunit()  
 WITH GenJnlLine DO BEGIN  
  IF GLEntryTmp.FIND('-') THEN BEGIN  
   REPEAT  
    GLEntry := GLEntryTmp;  
    IF GLSetup."Additional Reporting Currency" = '' THEN BEGIN  
     GLEntry."Additional-Currency Amount" := 0;  
     GLEntry."Add.-Currency Debit Amount" := 0;  
     GLEntry."Add.-Currency Credit Amount" := 0;  
    END;  
    GLEntry.INSERT;  
    //Modification 01 Start  
    SingleCU.InsertGL(GLEntry);  
    //Modification 01 End  
    IF NOT InsertFAAllocDim(GLEntry."Entry No.") THEN  

Once you completed the creating of new object and modification to the codeunit 12, follow the below steps,
1. Run the Single "Single Instance CU" ONLY ONCE 
2. Then try to unapply the entry which generate the above error. 
3. Then once again run the "Single Instance CU" and you will see the actual transaction that generate the error.  

How to fix this error.
In order to fix this you need to modify 3 codeunits. 
  •  Codeunit 12 - "Gen. Jnl.-Post Line"
  •  Codeunit 226 - "CustEntry-Apply Posted Entries"
  •  Codeunit 227 - "VendEntry-Apply Posted Entries"

1. Change the code in the UnapplyCustLedgEntry function in the Gen. Jnl.-Post Line codeunit (12) as follow:
Existing code

 NextDtldLedgEntryEntryNo := NextDtldLedgEntryEntryNo + 1;  
       DtldCVLedgEntryBuf.TRANSFERFIELDS(NewDtldCustLedgEntry);  
      //Delete the following line.  
      GenJnlLine."Source Currency Code" := DtldCustLedgEntry2."Currency Code";  
      IF GLSetup."Additional Reporting Currency" <> DtldCVLedgEntryBuf."Currency Code" THEN  
       DtldCVLedgEntryBuf."Additional-Currency Amount" :=  
        CalcAddCurrForUnapplication(DtldCVLedgEntryBuf."Posting Date",DtldCVLedgEntryBuf."Amount (LCY)")  

Replacement code
  NextDtldLedgEntryEntryNo := NextDtldLedgEntryEntryNo + 1;  
      DtldCVLedgEntryBuf.TRANSFERFIELDS(NewDtldCustLedgEntry);  
      IF GLSetup."Additional Reporting Currency" <> DtldCVLedgEntryBuf."Currency Code" THEN  
       DtldCVLedgEntryBuf."Additional-Currency Amount" :=  
        CalcAddCurrForUnapplication(DtldCVLedgEntryBuf."Posting Date",DtldCVLedgEntryBuf."Amount (LCY)")  

2. Change the code in the UnapplyVendLedgEntry function in the Gen. Jnl.-Post Line codeunit (12) as follow:
Existing code

  NextDtldLedgEntryEntryNo := NextDtldLedgEntryEntryNo + 1;  
      DtldCVLedgEntryBuf.TRANSFERFIELDS(NewDtldVendLedgEntry);  
      //Delete the following line.  
      GenJnlLine."Source Currency Code" := DtldVendLedgEntry2."Currency Code";  
      IF GLSetup."Additional Reporting Currency" <> DtldCVLedgEntryBuf."Currency Code" THEN  
       DtldCVLedgEntryBuf."Additional-Currency Amount" :=  
        CalcAddCurrForUnapplication(DtldCVLedgEntryBuf."Posting Date",DtldCVLedgEntryBuf."Amount (LCY)")  
 ...  

Replacement code
   NextDtldLedgEntryEntryNo := NextDtldLedgEntryEntryNo + 1;  
      DtldCVLedgEntryBuf.TRANSFERFIELDS(NewDtldVendLedgEntry);  
      IF GLSetup."Additional Reporting Currency" <> DtldCVLedgEntryBuf."Currency Code" THEN  
       DtldCVLedgEntryBuf."Additional-Currency Amount" :=  
        CalcAddCurrForUnapplication(DtldCVLedgEntryBuf."Posting Date",DtldCVLedgEntryBuf."Amount (LCY)")  
 ...  

3. Change the code in the PostUnApplyCustomer function in the CustEntry-Apply Posted codeunit (226) as follow:
Existing code
 GenJnlLine."Source Type" := GenJnlLine."Source Type"::Customer;  
      GenJnlLine."Source No." := "Customer No.";  
      GenJnlLine."Source Code" := SourceCodeSetup."Unapplied Sales Entry Appln.";  
      //Delete the following line.  
      GenJnlLine."Source Currency Code" := DtldCustLedgEntry2."Currency Code";  
      GenJnlLine."System-Created Entry" := TRUE;  
      Window.OPEN(Text008);  
      GenJnlPostLine.UnapplyCustLedgEntry(GenJnlLine,DtldCustLedgEntry2);  

Replacement code
 GenJnlLine."Source Type" := GenJnlLine."Source Type"::Customer;  
      GenJnlLine."Source No." := "Customer No.";  
      GenJnlLine."Source Code" := SourceCodeSetup."Unapplied Sales Entry Appln.";  
      GenJnlLine."System-Created Entry" := TRUE;  
      Window.OPEN(Text008);  
      GenJnlPostLine.UnapplyCustLedgEntry(GenJnlLine,DtldCustLedgEntry2);  

4. Change the code in the PostUnApplyVendor function in the VendEntry-Apply Posted Entries codeunit (227) as follow:
Existing code

  GenJnlLine."Source Type" := GenJnlLine."Source Type"::Vendor;  
      GenJnlLine."Source No." := "Vendor No.";  
      GenJnlLine."Source Code" := SourceCodeSetup."Unapplied Purch. Entry Appln.";  
      //Delete the following line.  
      GenJnlLine."Source Currency Code" := DtldVendLedgEntry2."Currency Code";  
      GenJnlLine."System-Created Entry" := TRUE;  
      Window.OPEN(Text008);  
      GenJnlPostLine.UnapplyVendLedgEntry(GenJnlLine,DtldVendLedgEntry2);  

Replacement code
  GenJnlLine."Source Type" := GenJnlLine."Source Type"::Vendor;  
      GenJnlLine."Source No." := "Vendor No.";  
      GenJnlLine."Source Code" := SourceCodeSetup."Unapplied Purch. Entry Appln.";  
      GenJnlLine."System-Created Entry" := TRUE;  
      Window.OPEN(Text008);  
      GenJnlPostLine.UnapplyVendLedgEntry(GenJnlLine,DtldVendLedgEntry2);  

** You must have Microsoft Dynamics NAV 2009 Service Pack 1 installed to apply this hotfix.

********************** You cannot remove this hotfix. **********************  

Click here to get the link to hot Fix 
Click here to get the article about the first section 

Thank you and Regards,
Tharanga Chandrasekara