Script to email report from custom program - report incomplete

Sort:
You are not authorized to post a reply.
Author
Messages
AnnH
Basic Member
Posts: 7
Basic Member
    Emailing a report from a custom program but the report is incomplete even though the script call is at the very end.  I need to close the report file manually but CLOSE REPORT-FILE returns compile error.  We have gotten by this in scheduled jobs by calling the script from a token but this report is processed on demand and I can't tie a token to it as the user may process the job under another name.  Is there a Lawson API that will clear the report buffer and close the report?  Thanks, Ann
    jaherb
    Veteran Member
    Posts: 164
    Veteran Member
      I had to do something like this a long time ago and do not have the specific example. However the way I handled this was to create a secondary print file, where I directed the report print lines to. Using this method you need to manually open and close this file. After this secondary print file is closed then you should be able to run your script to email it out.
      AnnH
      Basic Member
      Posts: 7
      Basic Member
        Thanks, I may try that, it sounds like something I may have done in the past. I know I dealt with this at another location and I hate that I can't remember what I did...!
        jaherb
        Veteran Member
        Posts: 164
        Veteran Member
          Yes... I can't recall all the detail, but I know it works. I need to create an actual example and keep it on hand, rather than trying to figure it out each time. The notes I have on it are as follows...

          To create a secondary print file, to eliminate the banner page when printing special forms, you will need to do the following:

          In workdef, define your new file with File Record = "Yes" and File Media = "Printer". Define the record as 132 bytes in length.

          In the PD, add an open statement for the new print file. The open should be located prior to performing the routine that will write to the new file. Also add a close statement just after that same routine.

          In the .rpt, add a $PRINTFILE parameter, followed by the print file name, just after the $REPORT card for the report you are creating.

          By doing this, you will create two print files, both will be visible in the print manager. PA330 makes use of this function and can be referenced as an example.

          You are not authorized to post a reply.