Saturday, October 19, 2013

How to Write Log File using CAL code - Dynamics NAV

Hi All
How to create a log file in Dynamics NAV try below steps, this sample code create a new log file (Log) in C:\
  • Create a new codeunit
  • Create following variables
  • Name                 DataType    Subtype    Length
    TestFile              File       
    TestStream        OutStream 
  • Paste below code at OnRun() save and run the codeunit     



TestFile.CREATE('C:\Log.txt');
TestFile.WRITEMODE(TRUE);
TestFile.OPEN('C:\log.txt');
TestFile.CREATEOUTSTREAM(TestStream);
TestStream.WRITETEXT (‘Success');
TestFile.CLOSE;
Message('Log Created Successfully')

Thanks
Marshal. J

No comments:

Post a Comment