NAV 4.0 Export Data in XML File using XMLPort

dipakpatel2505dipakpatel2505 Member Posts: 169
edited 2014-11-18 in Navision Attain
Dear All,

In Nav 4.0, I have trying to export Customer List in XML file Format using XMLPort and Codeunit.

I am facing problem and not able to export data in XML file in Nav 4.0. Navision crashes when I try to export data in XML file using code as below: I have also attached XML Port design snapshot.

I have tries same code in Navision 2009 R2 and it has export XML File successfully. Is it XML Port Limitation in Nav 4.0 that it can not export data in XML Format. Any suggestion/help to solve my problem is appriciate.
Codeunit : OnRun() Trigger

IF EXISTS('D:\Test\Customer.xml') THEN


XMLFileName := 'D:\Test\Customer.xml';

FileOpened := TestFile.OPEN(XMLFileName);


MESSAGE('XML Customer Export Complete.');


  • manisharma31manisharma31 Member Posts: 285
    Did you find any solution for this issue.
    We are facing the same issue.
  • KishormKishorm Member Posts: 912
    Is your code the same as Dipak's? If so then try deleting the following line of code...
    FileOpened := TestFile.OPEN(XMLFileName);

    ...I'm not sure if that is the problem or not (maybe it opens the file in read only mode) but it shouldn't really be there.

    If that doesn't fix it then show us the code you are using and highlight which line of code is causing the crash (you can use the debugger to step through the code).
Sign In or Register to comment.