File handle 2009 SP1 Classic

NabucoNabuco Member Posts: 65
Hi all
Stuck in a little problem:
Creating a mail - and via a report creating a PDF-file in Temp-dir and then attach the PDF to the mail.
Mail.SEND is done

Then make the following:

Ok := FILE.EXISTS(PDFfilename);
IF Ok = TRUE THEN
FILE.ERASE(PDFfilename);

This gives an error saying that file is open in FIN.EXE
How to enable me to erase this file?

Comments

  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    Did you try CLEAR on the File variable / document automation / whatever you use to create the file?
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • ftorneroftornero Member Posts: 524
    The SMPT Automation don't release the file after send it, you need to modify the codeunit 400 (SMTP Mail) and add:

    Mail.Dispose // If you don't have this method you need an upper version

    after

    Mail.Send(....)
  • FDickschatFDickschat Member Posts: 380
    as ftornero writes:

    Mal.dll does not release the file lock. There is an updated version of mail.dll available since years but it was never integrated into the 2009 installers.

    Verson 7.1.0.0 does fix the problem of file locks but brings in new problems with character sets.
    Version 7.3.0.1 does fix the above problems and runs with several customer flawlessly.

    Another possibility, depends on your code:
    Try to separate the process which creates the pdf and the code which deletes the file:
    - report does some things
    - call 2nd report (local var) which creates the pdf
    - return to 1st report, destroy local var to second report and delete the file
    Frank Dickschat
    FD Consulting
Sign In or Register to comment.