This article applies to Microsoft Dynamics NAV for the Greek (gr) region.
Symptoms
Assume that you have the Greek Office Language Pack installed. When you create more than eight segment lines in a segment in the Greek version of Microsoft Dynamics NAV 2009, an "Invalid Merge Field" error from Word automation occurs.
This problem occurs in the following products:
-
The Greek version of Microsoft Dynamics NAV 2009 R2
-
The Greek version of Microsoft Dynamics NAV 2009 Service Pack 1
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, 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:
-
Create a new function in the WordManagement codeunit (5054) as follows:
LOCAL PROCEDURE InsertCharSet(MergeFileName@1000000000 : Text[260]) : Text[250];
VAR
NewLine : Text[250];
f: File;
f2: File;
b: Integer;
MergeFileNameServer: Text[250];
IF NOT ISSERVICETIER THEN
BEGIN
IF EXISTS(MergeFileName+'$') THEN
ERASE(MergeFileName+'$');
WITH f DO BEGIN
TEXTMODE(TRUE);
WRITEMODE(FALSE);
OPEN(MergeFileName);
END;
WITH f2 DO BEGIN
TEXTMODE(TRUE);
WRITEMODE(TRUE);
CREATE(MergeFileName+'$');
END;
END
ELSE
BEGIN
MergeFileNameServer := RBAutoMgt.ServerTempFileName(Text029,'.HTM');
UPLOAD(Text021, '', Text032, MergeFileName, MergeFileNameServer);
WITH f DO BEGIN
TEXTMODE(TRUE);
WRITEMODE(FALSE);
OPEN(MergeFileNameServer);
END;
WITH f2 DO BEGIN
TEXTMODE(TRUE);
WRITEMODE(TRUE);
CREATE(MergeFileNameServer+'$');
END;
END;
REPEAT
b:=f.READ(NewLine);
IF NewLine='<html>' THEN
NewLine:= '<HTML><META charset=windows-1253>';
f2.WRITE(NewLine);
UNTIL f.POS>=f.LEN;
f.CLOSE;
f2.CLOSE;
IF ISSERVICETIER THEN
BEGIN
ERASE(MergeFileNameServer);
RENAME(MergeFileNameServer+'$', MergeFileNameServer);
DOWNLOAD(MergeFileNameServer,Text035,'',Text032,MergeFileName);
END
ELSE
BEGIN
ERASE(MergeFileName);
RENAME(MergeFileName+'$', MergeFileName);
END;
EXIT (MergeFileName); -
Change the four digit code in the following line in the InsertCharSet function in the WordManagement codeunit (5054):
NewLine:= '<HTML><META charset=windows-1253>';
Note "1253" is the correct code to use where the Microsoft Dynamics NAV client language is Greek (GR). Change this four digit code to the Windows charset code for your Microsoft Dynamics NAV client language. For example, "1257" is the correct code for Latvian (LV).
To obtain a full list of the Windows Character sets, visit the following website:
http://msdn.microsoft.com/en-us/library/aa752010(v=vs.85).aspx -
Change the code in the CreateWordAttachment function in the WordManagement codeunit (5054) as follows:
Existing code...
IF ISCLEAR(wrdApp) THEN
CREATE(wrdApp,FALSE,TRUE);
Attachment."File Extension" := GetWordDocExt(wrdApp.Version);
wrdDoc := wrdApp.Documents.Add;
wrdDoc.MailMerge.MainDocumentType := 0; // 0 = wdFormLetters
ParamInt := 7; // 7 = HTML
wrdDoc.MailMerge.OpenDataSource(MergeFileName,ParamInt);
...Replacement code
...
IF ISCLEAR(wrdApp) THEN
CREATE(wrdApp,FALSE,TRUE);
Attachment."File Extension" := GetWordDocExt(wrdApp.Version);
wrdDoc := wrdApp.Documents.Add;
wrdDoc.MailMerge.MainDocumentType := 0; // 0 = wdFormLetters
ParamInt := 7; // 7 = HTML
// Add the following line.
MergeFileName:=InsertCharSet(MergeFileName);
wrdDoc.MailMerge.OpenDataSource(MergeFileName,ParamInt);
... -
Change the code in OpenWordAttachment the function in the WordManagement codeunit (5054) as follows:
Existing code...
IF ISCLEAR(wrdMergefile) THEN
CREATE(wrdMergefile,FALSE,TRUE);
MergeFileName := RBAutoMgt.ClientTempFileName(Text029,'.HTM');
CreateHeader(wrdMergefile,TRUE,MergeFileName);
IF ISCLEAR(wrdApp) THEN
CREATE(wrdApp,FALSE,TRUE);
...Replacement code
...
IF ISCLEAR(wrdMergefile) THEN
CREATE(wrdMergefile,FALSE,TRUE);
MergeFileName := RBAutoMgt.ClientTempFileName(Text029,'.HTM');
CreateHeader(wrdMergefile,TRUE,MergeFileName);
// Add the following line.
MergeFileName:=InsertCharSet(MergeFileName);
IF ISCLEAR(wrdApp) THEN
CREATE(wrdApp,FALSE,TRUE);
... -
Change the code in the ExecuteMerge function in the WordManagement codeunit (5054) as follows:
Existing code...
wrdDoc := wrdApp.Documents.Open(MainFileName);
wrdDoc.MailMerge.MainDocumentType := 0;
Window.UPDATE(6,Text013);
ParamInt := 7; // 7 = HTML
wrdDoc.MailMerge.OpenDataSource(MergeFileName,ParamInt);
Window.UPDATE(6,STRSUBSTNO(Text014,TempDeliverySorter."Correspondence Type"));
...Replacement code
...
wrdDoc := wrdApp.Documents.Open(MainFileName);
wrdDoc.MailMerge.MainDocumentType := 0;
Window.UPDATE(6,Text013);
ParamInt := 7; // 7 = HTML
// Add the following line.
MergeFileName:=InsertCharSet(MergeFileName);
wrdDoc.MailMerge.OpenDataSource(MergeFileName,ParamInt);
Window.UPDATE(6,STRSUBSTNO(Text014,TempDeliverySorter."Correspondence Type"));
... -
Change the code in the ShowMergedDocument function in the WordManagement codeunit (5054) as follows:
Existing code...
ParamInt := 7; // 7 = HTML
wrdDoc.MailMerge.OpenDataSource(MergeFileName,ParamInt);
ParamInt := 9999998; // 9999998 = wdToggle
wrdDoc.MailMerge.ViewMailMergeFieldCodes(ParamInt);
END;
WordHandler(wrdDoc,Attachment,WordCaption,IsTemporary,MainFileName,IsInherited);
CLEAR(wrdMergefile);
CLEAR(wrdDoc);
CLEAR(wrdApp);
DeleteFile(MergeFileName);
...Replacement code
...
ParamInt := 7; // 7 = HTML
// Add the following line.
MergeFileName:=InsertCharSet(MergeFileName);
wrdDoc.MailMerge.OpenDataSource(MergeFileName,ParamInt);
ParamInt := 9999998; // 9999998 = wdToggle
wrdDoc.MailMerge.ViewMailMergeFieldCodes(ParamInt);
END;
WordHandler(wrdDoc,Attachment,WordCaption,IsTemporary,MainFileName,IsInherited);
CLEAR(wrdMergefile);
CLEAR(wrdDoc);
CLEAR(wrdApp);
DeleteFile(MergeFileName);
...
Prerequisites
You must have the one of the following products installed to apply this hotfix:
-
The Greek version of Microsoft Dynamics NAV 2009 R2
-
The Greek version of Microsoft Dynamics NAV 2009 Service Pack 1
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 Use for other considerations.