How to Automatically Email PDF Files
Editor’s Note: No, this is NOT “Spamming 101”. Your users will actually appreciate seeing these
emails in their inbox each morning. show us here how to
remove the extra steps of distributing reports that your EnterpriseOne applications produce in
PDF format. Whether the report is generated from the client side or the server side, the
technique demonstrated here will automatically email the PDF files to the appropriate email
address. This paper was also published in the March-April, 2004 issue of the JDEtips Journal.
The authors were kind enough to provide us with source code for these routines, but it was too
long to include in the Journa, so here is the "long version", which includes the code.
Abstract
We describe a method for emailing PDF files from a UBE with no technical or user intervention
required. We describe the two different techniques for achieving this aim according to whether the
UBE runs on a local fat client or on a server. We attempt to extend the solution by discussing
areas for improvement.
Introduction
PeopleSoft EnterpriseOne software provides business functions that allow PDF files to be
emailed to a particular user or group of users. These business functions work very well for the
situation where the PDF file name is known in advance. The name can be passed, along with a
number of other parameters such as recipient email address, into the business function and the
end result is a successfully emailed PDF.
In most cases, however, it would be far more desirable to not have to pass actual PDF file names
to the business function, but rather have a given UBE automatically email its PDF with no user
intervention required. Then, jobs that run overnight on a server could email the PDF file to all
necessary recipients with their necessary reports by the next morning.
Although preferable to having to "name that PDF", this situation is challenging because typically,
the PDF is only generated once the UBE completes. Since the PDF name is a complex string,
there seems to be no easy way of associating a PDF name with the UBE job that produced it.
This article describes a technique we have successfully implemented at our company for having
the PDF file emailed correctly, every time from within the UBE that generated it. The technique
works whether the originating UBE is running locally or on a server. The distinction between local
and server jobs is important here because the two require entirely different methods.
Overview
We implemented a two-stage approach to the automation of sending emails. In the first stage, the
name of the PDF file that will be sent is determined and written, with the addressee(s), sender’s
address, and message text, to a file that we called F56EMAIL.
Copyright © 2004 by Klee Associates, Inc. Page 2
www.JDEtips.com
How to Automatically Email PDF Files
In the second step, those unprocessed records in F56EMAIL derived from the LOCAL source are
processed by a UBE that we called R56EMAIL. The unprocessed records derived from the
Server source are processed by a different UBE, which we called R56EMAILS. Both R56EMAIL
and R56EMAILS use the information on the table F56EMAIL, together with the standard business
function B0500190, to execute the actual e-mail of the document. We needed two different UBEs
because complications arise when trying to process a UBE called from within another UBE. The
complication is typically appreciable on the server and so we decided to separate the processing
to deal with it.
Once processed a simple flag on the F56EMAIL record is switched on, and the sent date for the
record is updated, thus ensuring that the record will not be erroneously resent on the next
execution of the UBE. Figure 1 illustrates the overall process.
How to Automatically Email PDF Files
Business Function Structure
When implementing automatic emailing of PDF files, it is necessary to place a call to just one
Named Event Rule (NER) within the UBE whose PDF is to be emailed.
This NER is really a “wrapper” NER, which we called N56EMF. The purpose of this NER is to
determine whether the UBE job is running locally or on a server. Depending on the outcome of
this question, one of two Named Event Rules is called from within N56EMF. It is the job of these
called NERs to determine the PDF information and write to F56EMAIL.
We discuss in detail below how to answer the question of whether the job is running locally.
Overview of technique for a UBE running locally
This technique relies on the fact that a UBE running locally will initiate the creation of a LOG file
at inception. The LOG file’s name is identical to that of the forthcoming PDF file except for the file
extension. This LOG file is created independently of whether the logging options are set for the
UBE. Since the .log file is written to the PrintQueue folder of the B7 directory, it is possible to
retrieve the name of this LOG file using standard business functions while the UBE is actually
running. It is then a straightforward exercise to swap the file extension from .LOG to .PDF and
write the result to F56EMAIL.
Therefore by implementing the wrapper NER into the UBE’s header section, we can use the
principle of .log file generation to have the UBE write a record into F56EMAIL that will correspond
to the PDF file produced by that UBE. Of course, we can control addressee, message text,
subject, etc., as separate fields that are also written on the F56EMAIL record.
Overview of technique for a UBE running on a server
This technique relies on the fact that a UBE running on a server will create a record in table
F986110 while the job is running. You can search for such a record in F986110 because the
UBE name, version, date and time of submission, and the user who submitted the UBE, are all
known.
The wrapper NER will perform the functionality of searching for the UBE record in F986110; if
such a record is found, then the wrapper NER will call the server NER, as opposed to the Local
NER described above. The purpose of the server NER is to concatenate the PrintQueue path
directory to the name of the UBE PDF file found on F986110 and write this information, together
with the process ID, into F56EMAIL.
How to Automatically Email PDF Files
Detailed Email Process Description:
As part of our solution, we created a table to hold the email repository information (see Table 1 -
F56EMAIL Email Repository, for the table format) and a couple of named event rules. A
“wrapper” Named Event Rule performs email address formatting, determines if the job is running
locally or on the server, and inserts into the email repository table. This NER will be executed
from the UBE we wish to email.
NER - Send Email Wrapper
1. This is called from a report or report driver passing the following: address book number,
report name and report version, email message, email subject, from email address, email
attachment name, and the server host name.
2. The address book number should be set up in the F0101 Address Book table and the F01151
Electronic Address table.
3. If the email address is not set up in F01151, the email address field will be populated with
“Email Address not found”.
4. Once the email address is retrieved from in F01151, make sure it is in the correct format of
First Name_Last Name@Company Name.com. In our case, we use Lotus Notes and some of
our email addresses are set up with a blank between the first and last name and backslashes
before the company name. We used business function B0400520 Replace Character with
String to replace the blanks with underscores and backslashes with @. This is required since
the C compiler will not accept certain characters.
5. After the email address is reformatted, the NER determines if the UBE job is running locally
or on the server. This is achieved by reading the F986110 Job Control Status Master to
determine if the job is running on the server. The Business Function B9861101 F986110 DS
OVERRIDE is executed using passed server host name (e.g.,CORP-JDE-DV for
development server) since this table is mapped.
6. Read through this table using system values of today’s date, user, login environment, passed
in server host name, job status <> ‘D’ and Object Type = ‘UBE’, first by performing a select
and follow with a fetch next.
7. Loop through F986110 and return job status, server job number, process ID, and report
(FNDFUF2) – RXXXXX_Version_Jobnumber_PDF).
8. Make sure the returned status is not equal to E (error) or H (hold).
9. If the report is found as a record on F986110, then it is considered to be a server job and the
NER N56EMAILS, which writes to the F56EMAIL Email Repository Table for server jobs, will
be executed.
10. If the report is not found to be running on the server, it is considered to be a local job and the
NER N56EMAIL to write to F56EMAIL Email Repository Table for local jobs will be executed.
Copyright © 2004 by Klee Associates, Inc. Page 6
www.JDEtips.com
How to Automatically Email PDF Files
11. Call Business Function B9861101 F986110 DS OVERRIDE using passing a blank to remove
the override.
12. .If the job is running locally, the Local email NER is executed; otherwise, the Server email
NER is executed.
NER – Email for Local Jobs
1. The UBE name and version are passed into an NER. They are concatenated with the Date
and System time in typical EnterpriseOne format as follows:
Rxxxxxx_VersionName_Date_Time.log – this is the trial name which will be used to find the
true log file name. A typical trial name you need to strive for might be
R550001_V000001_D1030304_T113501.log. This is an example of the format used by
EnterpriseOne for its PDF files when running local UBEs.
2. The important point to remember, however, is that JDE sticks another 3 digits at the end of
the T portion. This makes a determination of the true file name difficult. That’s why you have
to start with a trial name and modify it.
3. Then use the trial file name to determine the true file name. To do this, use the trial name and
enter a loop to subtract one second per loop cycle from the trial name time portion – the T
portion just before .log.
4. In order to find the true file name, you’ll need to stick the B7\Printqueue piece in front of your
trial name. The easiest way to do this is to call the “Retrieve One World Path Information”
business function and retrieve back the value of the “File or Path to Find” parameter.
5. Now using your qualified trial file name, use the “Find a File that matches a string with
wildcard” business function. Your trial file name should contain an “*” after the time portion
and before the .log extension for this to work. If you’re successful, the business function will
return the true .log file name. You can then swap the .log to .pdf and you now have the PDF
file name. If not successful, go back round the loop and subtract another second from the
time portion. The cycle is necessary because you don’t know exactly when EnterpriseOne
time-stamped the .log file. Remember: once the seconds drop below 0 you need to add 59
and subtract 1 from the minute portion. It’s an exercise in string manipulation for the ER
programmer.
6. The data is inserted into the Email Repository Table and marked as a local record.
NER – Email for Server JobsFor Server Jobs, the report format is different. It is Report_Version_Job Number_PDF.pdf. It
also has to be concatenated with the directory name it resides on. For example, in our case
the jobs reside on E:\JDEdwardsOneWorld\ddp\B7333_SP21\PrintQueue\. This path has to
be concatenated with the Report_Version_Job Number_PDF.pdf before it can be used in the
business function Send HRM Email.
The job number, process ID,report format from F986110 is passed into this server NER along
with the path. The path and the report format are concatenated and inserted into the Email
Repository table F56EMAIL as a server record.
R56EMAIL – Email Recipient for Local UBE
How to Automatically Email PDF Files
This report reads the Email Repository table and selects unprocessed local email records
and emails the report by calling business function B0500190 Send Email – HRM.
If the email is unsuccessful, an error is returned from the business function and the report will
not be emailed. (See below). If it is successful, the report is emailed and record is marked
as processed.
R56EMALS - Email Recipient From Server UBE
This report reads the Email Repository table and selects unprocessed server email records
and emails report by calling business function B0500190 Send Email – HRM. In addition, this
report will replace the asterisks with back slashes where the path was specified as noted in
the NER Email for Server Jobs.
If the email is unsuccessful, an error is returned from the business function and the report will
not be emailed. (See below). If it is successful, the report is emailed and record is marked
as processed.
This contains processing options for email overriding; if left blank, then the Attention email
values from F56EMAIL will get used for emailing. This is for testing purposes.
The F56EMAIL Email Repository Table contains the following:
Email Address to
Email Address from (must be an email address)
Email Message
Email Subject
Email Attachment
(the actual report)
For Local:
UBE + Version + Date + Time +.pdf
For Server:
:\JDEwardsOneWorld\ddp\B7333_SP21\PrintQueue +
UBE + Version + System Job Number + PDF + .pdf
Name of the
Attachment Literal Attachment Name + .pdf
Email UBE such as R55CONTN
Email Process Flag ‘0’ not processed, ‘1’ processed
Email Process
Date set from current date when email sent correctly
Email Local or
Server L for Local, S for Server
Process Id for Server Jobs retrieved from F986110
Job Number for Server Jobs retrieved from F986110
Host for Server Jobs retrieved from F986110
User Reserved
Code set to ‘1’ for jobs with driver UBE in R56EMAILS
Table 1 – F56EMAIL Repository Table
Error Reporting
As a result of running R56EMAIL or R563EMAILS – after running report
Copyright © 2004 by Klee Associates, Inc. Page 8
www.JDEtips.com
How to Automatically Email PDF Files
BSFN – Send Email – HRM will return errors if not processed:
Error code returned by function
0 = no errors
1 = From-address is blank
2 = To-address is blank
4 = Subject is blank
16 = Attachment file does not exist (if cIncludeAttach = 1) – will be set to 1
32 = Error returned by API JDE_SendEMailSMTP
Emailing to Group Lists
You can send to Mail-lists. To do so, replace any spaces in the name with underscores. For
example the Mail-list:
Maillist - Corp It PC Lan Group
would be sent as:
maillist_-_corp_it_pc_lan_group@domainnamecom
Use all lower case as good measure (not all systems recognize uppercase).
Note, there is no way to send to names with illegal characters (i.e. "(, ), &< %, $ etc" in them.
Only alpha, numeric, periods, underscores and dashes are allowed..
Please Note: This emailing process described in this article applies to reports without a report
driver. If a report driver is involved, additional coding and processing are needed.
Conclusion
We feel that this technique is applicable for many applications and extends the flexibility of your
UBEs. We identified certain areas where we feel the technique has room for extension or
improvement:
Currently, running the LOCAL version of a UBE requires that the secondary UBE responsible
for the actual emailing must reside on the same workstation as the UBE itself. This problem
could possibly be overcome through the use of shared drives, etc.
We feel it would be even more useful to be able to email multiple attachments at one time.
We are currently exploring ways to achieve this. The technique would be particularly
applicable, for instance, with summary and detail versions of the same report.
We have only one batch server to run UBEs. For organizations that have many such servers,
slight modifications, including a fetch against table F986111 may be required in order to
correctly identify the server on which the UBE has run.
Copyright © 2004 by Klee Associates, Inc. Page 9
www.JDEtips.com
How to Automatically Email PDF Files
Michael Walsh
Michael has over 20 years IT experience and seven years experience working with the JDE
product both with the World and One World versions. He has developed a deep technical
understanding of the JDEdwards OneWorld architecture and enjoys the challenge of putting his
technical expertise to task with difficult business related issues. Prior to working for his current
company, Michael worked for several years with a large consulting company where he had
exposure to a wide variety of clients all with very different business scenarios.
Mike.Walsh@JDEtips.com
Christine Cangialosi
Christine has over 20 years experience working in IT. She worked as a Technical Consultant for
JD Edwards for five years and for a business partner of JD Edwards implementing both the World
and One World products. In addition, Christine worked for clients of JD Edwards before joining
JDE. She possesses a deep technical understanding of the One World product coupled with
strong knowledge of the Sales Order and Financial Modules. Christine.Cangialosi@JDEtips.com
The use of JDE is granted to Klee Associates, Inc. by permission from J.D. Edwards World Source Company.
The information on this Website and in our publications is the copyrighted work of Klee Associates, Inc. and is owned by
Klee Associates, Inc.
NO WARRANTY: This documentation is delivered as is, and Klee Associates, Inc. makes no warranty as to its accuracy
or use. Any use of this documentation is at the risk of the user. Although we make every good faith effort to ensure
accuracy, this document may include technical or other inaccuracies or typographical errors. Klee Associates, Inc.
reserves the right to make changes without prior notice.
NO AFFILIATION: Klee Associates, Inc. and this publication are not affiliated with or endorsed by J.D. Edwards &
Company. J.D. Edwards software referenced on this site is furnished under license agreements between J.D. Edwards &
Company and their customers and can be used only within the terms of such agreements. J.D. Edwards is a registered
trademark of J.D. Edwards & Company. JDE and OneWorld are registered trademarks of J.D. Edwards World Source
Company. WorldSoftware is a trademark of J.D. Edwards World Source Company. Klee Associates, Inc. and this
publication are not affiliated with or endorsed by PeopleSoft, Inc. PeopleSoft, the PeopleSoft logo, PeopleTools,
PS/nVision, PeopleCode, PeopleBooks, PeopleSoft EnterpriseOne, and PeopleSoft World are registered trademarks of
PeopleSoft, Inc.
All other company and product names used herein may be trademarks or registered trademarks of their respective
owners.
Attachments:
N56EMF —Send Email Wrapper
N56EMAIL— Send and Email with Attachments
N56EMALS —Send Email when Job Executed on Server
R56EMAIL & R56EMAILS —Call Samples
F56EMAIL —E-mail Repository – Table Definition
How to Automatically Email PDF Files
Listing of ER for Named ER: N56EMF
=======================================================================
NAMED ER: Send Email Wrapper
=======================================================================
evt_LineNumberID_IDLN
evt_EditEmailAddress_DS80
evt_Counter_MATH01
evt_Test_EV01
evt_FirstTime_EV01
evt_ObjectType_FUNO
evt_UserId_USER
evt_EnvironmentName_ENHV
evt_DateLastActivity_ACTDATE
evt_DateJobSubmitted_SBMDATE
evt_JobstatusOW_JOBSTS
evt_SubmittedReport_FNDFUF2
evt_ServerProcessID_PROCESSID
evt_ServerJobNumber_JOBNBR
0001 VA evt_FirstTime_EV01 = " "
0002 VA evt_LineNumberID_IDLN = "0"
Perform a Fetch to F01151 using passed in address Book Number to retrieve E-Mail address
0051 // Determine if the Report is Running locally or on the Server
0052 //
0053 //
0054 VA evt_DateJobSubmitted_SUBDATE = SL DateToday
0055 VA evt_DateLastActivity_ACTDATE = SL DateToday
0056 VA evt_EnvironmentName_ENHV = SL LoginEnvironment
0057 VA evt_UserId_USER = SL UserID
0058 VA evt_ObjectType_FUNO = "UBE"
0059 VA evt_JobstatusOW_JOBSTS = "D"
0060 VA evt_SubmittedReport_FNDFUF2 = " "
0061 //
0062 // Get the Server by using the envrionment
0063 // as of 10/23/03 is a processing option from driver report
0067 // perform override
0068 F986110 DS OVERRIDE
BF szExecutionHostName -> szDatabasepath
0069 //
0070 VA evt_ServerProcessID_PROCESSID = "0"
0071 F986110.Select
VA evt_JobstatusOW_JOBSTS != TK Job Status
VA evt_EnvironmentName_ENHV = TK Environment Name
Copyright © 2004 by Klee Associates, Inc. Page 11
www.JDEtips.com
How to Automatically Email PDF Files
VA evt_UserId_USER = TK User ID
VA evt_DateJobSubmitted_SBMDATE = TK Date - Job Submitted
BF szExecutionHostName = TK Execution Host Name
VA evt_ObjectType_FUNO = TK Object Type
0072 F986110.Fetch Next
VA evt_JobstatusOW_JOBSTS <- TK Job Status
VA evt_ServerJobNumber_JOBNBR <- TK Server Job Number
VA evt_ServerProcessID_PROCESSID <- TK Server Process ID
VA evt_SubmittedReport_FNDFUF2 <- TK Foundation - Future Use 2
0073 While SV File_IO_Status is equal to CO SUCCESS
0074 If VA evt_JobstatusOW_JOBSTS is not equal to "E,H"
0075 F986110.Fetch Next
VA evt_JobstatusOW_JOBSTS <- TK Job Status
VA evt_ServerJobNumber_JOBNBR <- TK Server Job Number
VA evt_ServerProcessID_PROCESSID <- TK Server Process ID
VA evt_SubmittedReport_FNDFUF2 <- TK Foundation - Future Use 2
0076 End If
0077 End While
0078 //
0079 // Remove override
0080 F986110 DS OVERRIDE
"" -> szDatabasepath
0081 //
0082 // If Variable - Submitted report is equal to Blanks, this is local
0083 If VA evt_SubmittedReport_FNDFUF2 is equal to 'Blank'
//CALL N56EMAIL
0084 Send and Email with Attachments
BF szVersion -> szVersion
BF sz56EMMSG -> sz56EMMESSAGE
BF sz56EMFROM -> sz56EMAILFROM
BF sz56EMANM -> sz56EMATTACHNAME
BF sz56EMSUBJ -> sz56EMAILSUBJECT
Copyright © 2004 by Klee Associates, Inc. Page 12
www.JDEtips.com
How to Automatically Email PDF Files
BF szEmailAddressow -> sz56EMAILADDRESS
BF sz56EMUBE -> sz56EMUBE
0085 Else
0086 BF szPath = "E:*JDEdwardsOneWorld*ddp*B7333_SP21*PrintQueue*"
//CALL N56EMALS
0087 Send Email when Job Executed on Server
BF szPath -> szPath
VA evt_SubmittedReport_FNDFUF2 -> szFoundationFutureUse2
BF sz56EMFROM -> sz56EMFROM
BF sz56EMSUBJ -> sz56EMSUBJ
BF sz56EMMSG -> sz56EMMSG
BF szEmailAddressow -> sz56EMADDR
UNDEFINED -> sz56EMATT
UNDEFINED <- mnErrorId
BF sz56EMANM -> sz56EMANM
BF sz56EMUBE -> sz56EMUBE
VA evt_ServerProcessID_PROCESSID -> mnServerProcessID
BF szExecutionHostName -> szDatabaseServerName
VA evt_ServerJobNumber_JOBNBR -> mnServerJobNumber
0088 End If
Copyright © 2004 by Klee Associates, Inc. Page 13
www.JDEtips.com
How to Automatically Email PDF Files
Listing of ER for Named ER: N56EMAIL
=======================================================================
NAMED ER: Send and Email with Attachments
=======================================================================
evt_szUnQualFileName_DS80
evt_jdYMD_DGJ
evt_szDateTime_DL01
evt_mnTime_MATH01
evt_PrintQueuePath_DL01
evt_QualFileName_DS80
evt_mnLength_MATH01
evt_mnCounter_MATH01
evt_szSaveFileName_DS80
evt_szCharTime_OBJ
evt_szSeconds_DL01
evt_cFound_EV01
evt_szFoundLog_D200
evt_cTest_EV01
evt_szAttachmentFile_DS80
evt_cProcessed_EV01
evt_jdProcessedDate_DGJ
evt_WorkStationId
evt_UserId_USER
evt_DateUpdated_UPMJ
evt_TimeLastUpdated_UPMT
evt_ProgramId_PID
evt_56EMLORS
evt_ServerJobNumber_JOBNBR
0001 //
0002 // Get the time
0003 //
0004 Get Current Date and Time
VA evt_szDateTime_DL01 <- szDateTime
0005 Get Audit Information
VA evt_UserId_USER <- szUserName
VA evt_DateUpdated_UPMJ <- jdDate
VA evt_TimeLastUpdated_UPMT <- mnTime
VA evt_WorkStationId <- szWorkstation_UserId
0006 //
0007 VA evt_mnTime_MATH01 = substr([VA evt_szDateTime_DL01],6,6 )
0008 //
0009 // Construct the unqualified file name UBE_Version_DATE_TIME
0010 //
Copyright © 2004 by Klee Associates, Inc. Page 14
www.JDEtips.com
How to Automatically Email PDF Files
0011 VA evt_szUnQualFileName_DS80 = concat([BF sz56EMUBE],"_")
0012 VA evt_szUnQualFileName_DS80 = concat([VA evt_szUnQualFileName_DS80],[BF szVersion])
0013 VA evt_szUnQualFileName_DS80 = concat([VA evt_szUnQualFileName_DS80],"_D1")
0014 VA evt_jdYMD_DGJ = SL DateToday
0015 VA evt_mnLength_MATH01 = length(date_year([VA evt_jdYMD_DGJ])-2000)
0016 If VA evt_mnLength_MATH01 is less than "2.00"
0017 VA evt_szUnQualFileName_DS80 = concat([VA evt_szUnQualFileName_DS80],"0")
0018 End If
0019 VA evt_szUnQualFileName_DS80 = concat([VA evt_szUnQualFileName_DS80],date_year([VA
evt_jdYMD_DGJ])-2000)
0020 //
0021 VA evt_mnLength_MATH01 = length(date_month([VA evt_jdYMD_DGJ]))
0022 If VA evt_mnLength_MATH01 is less than "2.00"
0023 VA evt_szUnQualFileName_DS80 = concat([VA evt_szUnQualFileName_DS80],"0")
0024 End If
0025 VA evt_szUnQualFileName_DS80 = concat([VA evt_szUnQualFileName_DS80],date_month([VA
evt_jdYMD_DGJ]))
0026 //
0027 VA evt_mnLength_MATH01 = length(date_day([VA evt_jdYMD_DGJ]))
0028 If VA evt_mnLength_MATH01 is less than "2.00"
0029 VA evt_szUnQualFileName_DS80 = concat([VA evt_szUnQualFileName_DS80],"0")
0030 End If
0031 VA evt_szUnQualFileName_DS80 = concat([VA evt_szUnQualFileName_DS80],date_day([VA
evt_jdYMD_DGJ]))
0032 //
0033 VA evt_szUnQualFileName_DS80 = concat([VA evt_szUnQualFileName_DS80],"_T")
0034 //
0035 // Loop back through time 30 seconds
0036 // to find print file
0037 //
0038 If VA evt_mnTime_MATH01 is less than "100,000.00"
0039 VA evt_szUnQualFileName_DS80 = concat([VA evt_szUnQualFileName_DS80],"0")
0040 End If
0041 VA evt_szSaveFileName_DS80 = VA evt_szUnQualFileName_DS80
0042 VA evt_mnCounter_MATH01 = "0"
0043 VA evt_cFound_EV01 = "N"
0045 While VA evt_mnCounter_MATH01 is less than or equal to "30.00"
0046 VA evt_szUnQualFileName_DS80 = concat([VA evt_szSaveFileName_DS80],[VA
evt_mnTime_MATH01])
0047 VA evt_szUnQualFileName_DS80 = concat([VA evt_szUnQualFileName_DS80],"*.log")
0048 //
0049 // Now Get the print Queue and use it to construct the complete file
0050 //
0051 Retrieve OneWorld Path Information
VA evt_PrintQueuePath_DL01 <- szFileorPathToFind
UNDEFINED X szFoundFileorPath
UNDEFINED X szAlternatePath
Copyright © 2004 by Klee Associates, Inc. Page 15
www.JDEtips.com
How to Automatically Email PDF Files
0052 VA evt_QualFileName_DS80 = concat([VA evt_PrintQueuePath_DL01],[VA
evt_szUnQualFileName_DS80])
0053 VA evt_szFoundLog_D200 = " "
0054 Find a file that matches a String with Wildcards
VA evt_QualFileName_DS80 -> szFileorPathToFind
VA evt_szFoundLog_D200 <- szFoundFileorPath
UNDEFINED X szAlternatePath
0055 If SV Error_Status is not equal to CO SUCCESS
0056 VA evt_mnTime_MATH01 = [VA evt_mnTime_MATH01]-1
0057 Convert Math_Numeric To String
VA evt_mnTime_MATH01 -> mnMathNumeric01
VA evt_szCharTime_OBJ <- szString
0058 VA evt_szSeconds_DL01 = substr([VA evt_szCharTime_OBJ],4,2 )
0059 If VA evt_szSeconds_DL01 is equal to "99"
0060 VA evt_mnTime_MATH01 = [VA evt_mnTime_MATH01]-40
0061 End If
0062 Else
0063 VA evt_cFound_EV01 = "Y"
0064 // C Cangialosi - 1/21/04 - changed seconds from 10 to 30
0065 ! VA evt_mnCounter_MATH01 = "11"
0066 VA evt_mnCounter_MATH01 = "31"
0067 End If
0068 VA evt_mnCounter_MATH01 = [VA evt_mnCounter_MATH01]+1
0069 End While
0070 //
0071 // If Log file found, then Change to pdf and write entry
0076 If VA evt_cFound_EV01 is equal to "Y"
0077 VA evt_mnCounter_MATH01 = "0"
0078 While VA evt_mnCounter_MATH01 is less than or equal to "80.00"
0079 VA evt_cTest_EV01 = substr([VA evt_szFoundLog_D200],[VA evt_mnCounter_MATH01],1)
0080 If VA evt_cTest_EV01 is equal to "."
0081 VA evt_szAttachmentFile_DS80 = substr([VA evt_szFoundLog_D200],0,([VA
evt_mnCounter_MATH01]))
0082 VA evt_szAttachmentFile_DS80 = concat([VA evt_szAttachmentFile_DS80],".pdf")
FORMAT E-MAIL Address and Write to F56EMAIL HERE
0097 End If
0098 VA evt_mnCounter_MATH01 = [VA evt_mnCounter_MATH01]+1
0099 End While
0100 End If
Copyright © 2004 by Klee Associates, Inc. Page 16
www.JDEtips.com
How to Automatically Email PDF Files
Listing of ER for Named ER: N56EMALS
=======================================================================
NAMED ER: Send Email when Job Executed on Server
=======================================================================
evt_NameofAttachmentFile_CMDS
evt_ProgramId_PID
evt_UserId_USER
evt_WorkStationId_JOBN
evt_DateUpdated_UPMJ
evt_TimeLastUpdated_UPMT
evt_EmailProcessFlag_56EMPROC
evt_EmailProcessDate_56EMPDT
evt_ServerJobNumber_JOBNBR
evt_szLORS_56EMLORS
0001 //
0002 VA evt_ProgramId_PID = "N56EMALS"
0003 Get Audit Information
VA evt_UserId_USER <- szUserName
VA evt_DateUpdated_UPMJ <- jdDate
VA evt_TimeLastUpdated_UPMT <- mnTime
VA evt_WorkStationId_JOBN <- szWorkstation_UserId
0004 //
0005 BF mnErrorId = "0"
0006 VA evt_ServerJobNumber_JOBNBR = "0"
0007 VA evt_EmailProcessDate_56EMPDT = "0"
0008 VA evt_EmailProcessFlag_56EMPROC = "0"
0009 VA evt_szLORS_56EMLORS = "S"
0010 VA evt_NameofAttachmentFile_CMDS = concat([BF szPath],[BF szFoundationFutureUse2])
0011 //
0013 F56EMAIL.Insert
BF sz56EMADDR -> TK EMAIL ADDRESS
BF sz56EMFROM -> TK E-mail From Address
BF sz56EMMSG -> TK E-Mail Message
BF sz56EMSUBJ -> TK E-Mail Subject
VA evt_NameofAttachmentFile_CMDS -> TK EMAIL ATTACHMENT
BF sz56EMANM -> TK Attachment Name
BF sz56EMUBE -> TK E-Mail UBE
Copyright © 2004 by Klee Associates, Inc. Page 17
www.JDEtips.com
How to Automatically Email PDF Files
VA evt_EmailProcessFlag_56EMPROC -> TK E-mail Processed
VA evt_EmailProcessDate_56EMPDT -> TK Processed Date
VA evt_szLORS_56EMLORS -> TK Local or Server
BF mnServerProcessID -> TK Process ID
BF mnServerJobNumber -> TK Server Job Number
BF szDatabaseServerName -> TK Execution Host Name
VA evt_ProgramId_PID -> TK Program ID
VA evt_UserId_USER -> TK User ID
VA evt_WorkStationId_JOBN -> TK Work Station ID
VA evt_DateUpdated_UPMJ -> TK Date - Updated
VA evt_TimeLastUpdated_UPMT -> TK Time - Last Updated
Copyright © 2004 by Klee Associates, Inc. Page 18
www.JDEtips.com
How to Automatically Email PDF Files
B0500190 CALL sample
Send E-Mail - HRM
VA rpt_FromEmailAddress_HLNK -> szFrom
VA rpt_ToEmailAddress_HLNK -> szTo
VA rpt_CopyEmailAddress_HLNK -> szCC
BC E-Mail Subject -> szSubject
BC E-Mail Message -> szMessageTextChar256
"1" -> cIncludeAttachmentFlag01
RV EmailAttachment -> szNameOfAttachmentFile
BC Attachment Name -> szAttachmentDisplayText
UNDEFINED -> cSendCopyOfEMailToSelfFlag01
UNDEFINED -> cSetOneWorldErrorFlag01
UNDEFINED -> cRecordOperInLogFileFlag01
UNDEFINED -> cAppenOrOverwriteLogFile01
UNDEFINED -> szNameOfLogFile
RV ErrorID <- mnErrorCodeReturned
Copyright © 2004 by Klee Associates, Inc. Page 19
www.JDEtips.com
How to Automatically Email PDF Files
Table Design
E-mail repository - F56EMAIL
Description Type Len Alias Data
Item
* 1. EMAIL ADDRESS String 40 56EMADDR
56EMADDR
2. E-mail From Address String 40 56EMFROM
56EMFROM
3. E-Mail Message String 200 56EMMSG
56EMMSG
4. E-Mail Subject String 80 56EMSUBJ
56EMSUBJ
* 5. EMAIL ATTACHMENT String 80 56EMATT
56EMATT
6. Attachment Name String 80 56EMANM
56EMANM
* 7. E-Mail UBE String 20 56EMUBE
56EMUBE
8. E-mail Processed Character
1 56EMPROC 56EMPROC
9. Processed Date Date 6 56EMPDT
56EMPDATE
*10. Local or Server String 2 56EMLORS
56EMLORS
11. Process ID Number 15 56EMPRID
56EMPROCID
*12. Server Job Number Number 15 JOBNBR
ServerJobNumber
13. Execution Host Name String 40 EXEHOST
ExecutionHostName
14. User Reserved Code String 2 URCD
UserReservedCode
15. User Reserved ReferenceString 15 URRF
UserReservedReference
16. User Reserved Number Number 8 URAB
UserReservedNumber
17. User Reserved Date Date 6 URDT
UserReservedDate
18. User Reserved Amount Number 15 URAT
UserReservedAmount
19. Program ID String 10 PID
ProgramId
20. User ID String 10 USER UserId
21. Work Station ID String 10 JOBN
WorkStationId
22. Date - Updated Date 6 UPMJ
DateUpdated
How to Automatically Email PDF Files
23. Time - Last Updated Number 6 UPMT
TimeLastUpdated
E-mail repository Indices
UBE,Address,Attachment (Primary,Unique)
E-Mail UBE 56EMUBE
E-Mail Address 56EMADDR
E-Mail Attachment 56EMATT
Server Job Number ServerJobNumber
Local or Server 56EMLORS
No comments:
Post a Comment