Automated email of completed PDF/CSV jobs - JD … · Automated email of completed PDF/CSV jobs...
Transcript of Automated email of completed PDF/CSV jobs - JD … · Automated email of completed PDF/CSV jobs...
Automated email of completed PDF/CSV jobs
www.jdesource.com Author: John Danter Page 1 of 15
Table of Contents
1 Business Problem ............................................................................................... 2
2 Overview ......................................................................................................... 3
2.1.1. UBE output files and background into UBEs at runtime ........................................ 3 2.2 Method of obtaining the output files .................................................................... 3
3 Functional Solution ............................................................................................. 4
3.1 Proposed Flow ............................................................................................... 4 3.2 Table Design requests ...................................................................................... 5
3.2.1. Email Configuration table F550002 ............................................................... 5 3.3 Application Screen Requests .............................................................................. 5
3.3.1. Selection .............................................................................................. 5 3.3.2. Logic Required ....................................................................................... 5 3.3.3. Screen /Shots ........................................................................................ 5
3.4 Report Functional Specs ................................................................................... 5 3.4.1. Data Selection ....................................................................................... 6 3.4.2. Sequencing ........................................................................................... 6 3.4.3. Output layout ........................................................................................ 6 3.4.4. Logic required ........................................................................................ 6
4 Technical Solution .............................................................................................. 7
4.1 B550002 - *** WSJ PDF Email Address BSFN ............................................................. 8 4.1.1. Datastructure D5500002 ............................................................................ 8
4.2 F550002 - *** WSJ PDF Email Config table ............................................................... 8 Back to Top Generated on Tuesday 16 September 2014 at 07:44:28 for environment E900 Development Environment pathcode DV900 (OW Info v4.2.0.7U) .......................................... 9 4.3 F550002C - *** WSJ PDF Email Count table .............................................................. 9 4.4 P550002 – *** WSJ Emailing Config Application ........................................................ 10
4.4.1. Event Rules .......................................................................................... 10 4.5 T550002 – PO DSTR for P550002 ......................................................................... 10 4.6 R550002 – *** WSJ PDF Email UBE ........................................................................ 10
4.6.1. Event Rules .......................................................................................... 10 4.7 R550002T – *** WSJ PDF Test UBE Harness ............................................................. 11
4.7.1. Event Rules .......................................................................................... 11 4.7.2. PO Values ............................................................................................ 11
4.8 T550002U – *** WSJ PDF Email UBE DSTR PO ........................................................... 11 4.9 V550002A – *** WSJ PDF Email Config Table BSVW .................................................... 12 4.10 Data Dictionary Items ................................................................................... 12
5 Objects Affected ............................................................................................... 14
6 Assumptions .................................................................................................... 15
Automated email of completed PDF/CSV jobs
www.jdesource.com Author: John Danter Page 2 of 15
1 Business Problem
Almost ALL UBE jobs run on the E1 system will produce an output file of some sort. PDF, CSV or Text file etc. Users gain access to the completed jobs output by using the WSJ screen in E1 to see all their submitted jobs and using the row exits there in to obtain the output files.
This document deals with the issue of gaining access to these files and potentially having the E1 software configured to automatically email out completed jobs output files. PDF / CSV etc to designated users.
*** has several clients who would like the ability to be sent an E1 jobs output file or to be notified of certain processing events within the E1 system. UBE completed successfully or errors within the job etc.
These notifications will be in the form of emails that will have the completed jobs output file attached to the email.
E1 already does give you the ability to email completed jobs PDFs via the BI Publisher bolt on. This is a fairly labour intensive endeavour and is also OBNM specific. It is also more focused on and intended for media rich output. There is also another method of sending emails in E1 called OSA Output Stream Access. OSA is a very powerful feature in E1 but requires scripts to be written for a Unix platform and sadly is fairly unexplored feature in E1. Beyond the current skill set of ***.
The preferred way to send emails would be to create a solution in E1s native ER language using well tried and tested methodologies. A goal of this development is once complete, it would not involve any further development effort to give further UBE/VERS the ability to email its completed job file output.
Due to the fact the WSJ screen in E1 indicates the jobs status, it is important to note that *** can benefit from this proposed functionality by giving *** the ability monitor sensitive jobs by sweeping over the submitted jobs table looking for these jobs that may have ended in error. A designated internal *** user or team can then be notified automatically when things go wrong.
Automated email of completed PDF/CSV jobs
www.jdesource.com Author: John Danter Page 3 of 15
2 Overview
This scope of this document is to describe at a technical, object level, the method used to get certain E1 completed job output files sent via a mail server connected to E1 automatically. The approach taken here is to try and make this functionality totally achievable via configuration alone. This is to remove the need for future development effort in order to add future UBE jobs .
UBEs and VERS wishing to be emailed can simply be added to the config table.
BI Publisher is an extension of E1 that can send completed jobs via email but this process is intended for the optimisation and graphic illustration of the completed jobs ‘data’ with the aid of a rich text template.
BI Publisher is a great tool but lends itself to marketing media more than the simpler requirement needed here.
Plus BI needs too much development work at OBNM etc UBE level in order to merge the completed jobs output onto a media rich template file.
2.1.1. UBE output files and background into UBEs at runtime
ALL UBE jobs in E1 when run on the server will write a record to the WSJ table, F986110
Most UBE jobs in E1 will produce an output file of some sort. CSV, PDF, TXT or XML etc. These can be seen and accessed via the Work with Submitted Jobs screen (WSJ).
When the job is complete all the output files and logs reside in a network folder on the Unix enterprise servers print queue folder.
/App/jdedwards/e900/PrintQueue/
# E1 Batch Server E1 Environment E1 PrintQueue network address
1 ***AX-JDED1 DV900 /App/jdedwards/e900_913/PrintQueue
2 ***AX-JDED1 PY900, UT900 & OQ900 /App/jdedwards/e900/PrintQueue
3 ***AXBATCHP PD900 /App/jdedwards/e900/PrintQueue
These files can be accessed and attached to an email via the WSJ screen if downloaded and saved but this is a manual and time consuming process.
E1 does not have the DIRECT ability to email out completed jobs file however E1 does have the ability to hook into an email server and use it’s services to send emails plus seen as E1 is platform independent we can also query operating systems and manipulate network files. Combining the 2 we can get the attachment and send this via email.
2.2 Method of obtaining the output files
ALL completed UBE jobs in E1 reside on table F986110. So we will use this table to get the completed jobs PDF/CSV file off the server and attach it to an email. Field F986110.JCFNDFUF2 contains key fields OBNM_VERS_JOBNBR_PDF
Create a custom table to configure the UBE/VERS and distribution list
Create a sweeper UBE to look for configured completed jobs and gather PDFs/CSVs
Create a BSFN to email out of *** and add the completed jobs PDF/CSV
Automated email of completed PDF/CSV jobs
www.jdesource.com Author: John Danter Page 4 of 15
3 Functional Solution
3.1 Proposed Flow
The diagram below illustrates the F986110 table and the subsequent PDF/CSV output files. Each record will have a unique JOBNBR.
New scheduled UBE R550002 will read over the F986110 and store its last read JOBNBR. This will be used to process newly submitted jobs since the last run.
For each F986110 record FNDFUF2 will be broken down from OBNM_VERS_JOBNBR_PDF and then checked against F550002 for a match on OBNM VERS USER and active Y/N = Y
If a match is found we get the PDF/CSV, attach to an email and use the configured F550002 record to obtain destination email address and subject text etc
The work described here will be split into 2 main parts:
1. Create an application to allow completed jobs PDF/CSV to be emailed via configuration of a new custom table.
Allow email address to added and also the email subject and body text. Email limits per run and allow the attachment file to be renamed.
2. Create a new UBE to read over the WSJ F986110 job table and email out the completed jobs PDF/CSV
This UBE will incrementally sweep over the F986110 table looking for jobs that are completed or in error. For every job found, it will then reference the worktable above and see if emailing is required.
Automated email of completed PDF/CSV jobs
www.jdesource.com Author: John Danter Page 5 of 15
3.2 Table Design requests
Create a table to store email related values
3.2.1. Email Configuration table F550002 Create a new table in the E1 schema to store values relating to email address, email subject, email body text and email limit. This table is to allow differentiation by OBNM, VERS and USER and job status (E/D). The table should also have an active flag so we can disable/enable the emailing of certain jobs. The table may also benefit from the inclusion of MCU if site separation of shared versions is required. MCU row security can then also be added.
3.3 Application Screen Requests
Create an E1 application screen to allow the maintenance and creation of WSJ email related data.
3.3.1. Selection Create a BSVW to read over table F550002. Show ALL fields. Allow MCU row security to prevent cross site data. Allow the Find Browse form to filter on UBE VERS USER ID, Active Y/N and MCU.
3.3.2. Logic Required Allow the users branch to default into the application screen. This can be used for row security.
Job status cannot be blank as dictated by the linked UDC. USER ID cannot be blank. Send To/From emails cannot be blank. Subject cannot be blank. Allow the user to select what output file they want. CSV/PDF. Allow the user to set a limit if desired on the volume of emails a job can create per 30 min run.
3.3.3. Screen /Shots
3.4 Report Functional Specs
Design a report to read over the WSJ Bootstrap F9861110 table in 30 minute intervals.
Automated email of completed PDF/CSV jobs
www.jdesource.com Author: John Danter Page 6 of 15
It should select and read F986110 records from the last run. Therefore it will need to keep a track of the LAST read job number so it knows where to start from next run. It should select records with a job status equal to Done or Error D/E. To prevent spamming an inbox it should keep a count of the number of emails sent per unique job. The UBE should get the completed jobs file and add it as an attachment to the outbound email.
3.4.1. Data Selection
JOBSTS = D/E and UKID greater than LAST read JOBNBR
3.4.2. Sequencing
<If any data sequencing is required list it here>
3.4.3. Output layout
CSV output listing records selected for emailing. List email address etc.
3.4.4. Logic required
It is important to note the different file address of PDF and CSV files. CSV = /App/jdedwards/e900/PrintQueue/R550002_***0001_1935821_PDF.csv PDF = /App/jdedwards/e900/PrintQueue/R550002_***0001_1935821_PDF
Automated email of completed PDF/CSV jobs
www.jdesource.com Author: John Danter Page 7 of 15
4 Technical Solution
A new application P550002 will be used to create records on new table F550002.
F550002 will be able to store fields based on email subject and destination addresses. F550002 will be unique on OBNM VERS USER and JOBSTS
New UBE R550002 will read over F986110 based on JOBNBR greater than the last read job number (or first starting point) saved in next number table F00022 under TBLE = ‘F550002’
New UBE R550002 - *** WSJ PDF Email UBE will be scheduled to run every 30 minutes.
The UBE will incrementally sweep over the WSJ table looking for jobs run since the previous run of R550002.
The WSJ table also holds the name of each report UBE and Version VERS that ran in that 30 minute window. It also holds the USER ID of the user who ran the job.
We can utilize these values to look for and target specific users or specific UBE, VERS and USER combinations for designated emailing out of the E1 system.
Automated email of completed PDF/CSV jobs
www.jdesource.com Author: John Danter Page 8 of 15
4.1 B550002 - *** WSJ PDF Email Address BSFN
A simple C++ /BSFN to get the print queue address off the server
Function B550002 - *** WSJ PDF Email Address BSFN Source Language C - C Location 2 - Both Client & Server Function Parent DLL C57*** System Codes 55/55
Function Description Datastructure Category Usage Not in DLL
***GetPDFAddress *** Get PDF Address D5500002
Back to Top Generated on Tuesday 16 September 2014 at 07:39:52 for environment E900 Development Environment pathcode DV900 (OW Info v4.2.0.7U)
4.1.1. Datastructure D5500002 Datastructure D5500002 - *** WSJ PDF Email Address DSTR System Codes 55/55
Element Alias Variable Direction Required Data Type Length Decimals Description
1 CMDS szCommandString N String 256 0 Command String
Back to Top Generated on Tuesday 16 September 2014 at 07:39:52 for environment E900 Development Environment pathcode DV900 (OW Info v4.2.0.7U)
4.2 F550002 - *** WSJ PDF Email Config table
Table to store all the relevant emailing details for each OBNM VERS USER combination
Column Prefix RE System Codes 55/55 Go to Indexes
Column Alias Description Data Type Edit Type Length Decimals NN Index Edit Rule
1 OBNM Object Name String Generic Edit 10 0 0
2 VERS Version History String Generic Edit 10 0 0
3 GPUS User ID String Generic Edit 10 0 0
4 ACTIVEYN Active Flag Y/N Character Generic Edit 1 0 0 VALUE Y N 1 0
5 RPDEMAIL Report Definition Delivery EMail Address String Generic Edit 100 0 0
6 EMAILFROM Email From Field String Generic Edit 256 0 0
7 APPTSUB Appointment Subject String Generic Edit 256 0 0
8 YEMALBOD Mailto Text Body String Generic Edit 1024 0 0
9 CMDS Command String String Generic Edit 256 0 0
10 YATTNM Email Attachment Name String Generic Edit 256 0 0
11 YEMALCC Electronic Address CC String Generic Edit 256 0 0
12 YEMALBCC Electronic Address BCC String Generic Edit 256 0 0
13 YEMALLM Email Limit Integer Generic Edit 11 0 0
14 USER User ID String Generic Edit 10 0 0
15 JOBN Work Station ID String Generic Edit 10 0 0
16 UPMT Time - Last Updated Numeric Generic Edit 6 0 0
Automated email of completed PDF/CSV jobs
www.jdesource.com Author: John Danter Page 9 of 15
17 UPMJ Date - Updated Date Generic Edit 6 0 0
18 PID Program ID String Generic Edit 10 0 0 CHKOBJ *PGM
19 MCU Business Unit String Generic Edit 12 0 0 IsColumnInBusinessUnitTable
20 JOBSTS Job Status String UDC 2 0 0 UDC 98 JS
21 YERREML Error Email Address String Generic Edit 256 0 0
22 CSVFLG CSV Flag Character Generic Edit 1 0 0
Indexes Go to Columns
Index 1 - Unique (Primary/Unique)
Element Alias Description Sequence
1 OBNM Object Name A
2 VERS Version History A
3 GPUS User ID A
4 JOBSTS Job Status A
Index 2 - Active YN
Element Alias Description Sequence
1 OBNM Object Name A
2 VERS Version History A
3 GPUS User ID A
4 ACTIVEYN Active Flag Y/N A
5 JOBSTS Job Status A
Index 3 - MCU
Element Alias Description Sequence
1 MCU Business Unit A
2 OBNM Object Name A
3 VERS Version History A
4 GPUS User ID A
5 JOBSTS Job Status A
Back to Top
Generated on Tuesday 16 September 2014 at 07:44:28 for environment E900 Development Environment pathcode DV900 (OW Info v4.2.0.7U)
4.3 F550002C - *** WSJ PDF Email Count table
Table to store a count per 30 minutes for each time an email is sent out for a given OBNM VERS USER combination. This is cleared down each run
Table F550002C - *** WSJ PDF Email Count table Column Prefix RE System Codes 55/55 Go to Indexes
Column Alias Description Data Type Edit Type Length Decimals NN System NN Index Edit Rule Edit Parms
1 UKID Unique Key ID (Internal) Numeric Generic Edit 15 0 0
2 OBNM Object Name String Generic Edit 10 0 0
3 VERS Version History String Generic Edit 10 0 0
4 GPUS User ID String Generic Edit 10 0 0
5 JOBSTS Job Status String UDC 2 0 0 UDC 98 JS
6 INT01 Integer01 - EnterpriseOne Integer Generic Edit 4 0 0
Automated email of completed PDF/CSV jobs
www.jdesource.com Author: John Danter Page 10 of 15
Indexes Go to Columns
Index 1 - Unique (Primary/Unique)
Element Alias Description Sequence
1 OBNM Object Name A
2 VERS Version History A
3 GPUS User ID A
4 UKID Unique Key ID (Internal) A
5 JOBSTS Job Status A
Back to Top Generated on Tuesday 16 September 2014 at 07:50:21 for environment E900 Development Environment pathcode DV900 (OW Info v4.2.0.7U)
4.4 P550002 – *** WSJ Emailing Config Application
Application to maintain the F550002 email config records and job number starting point
Application P550002 - *** WSJ PDF Email Config Application Platform Client or Web PO Template T550002 System Codes 55/55
Form Form Name Form Type Entry Point View
W550002A Browse *** WSJ PDF Emailing Find Browse Yes V550002A
W550002B Setup Job Number Fix Inspect V00022A
W550002C check file Fix Inspect
W550002D Edit *** WSJ PDF Emailing Fix Inspect V550002A
4.4.1. Event Rules
P550002.txt
P550002.html
4.5 T550002 – PO DSTR for P550002
PO Template T550002 - *** WSJ PDF Email Config Application DSTR System Codes 55/55
Element Tab Text Alias Variable Data Type Length Decimals Description
1 *** Default Email From Field EMAILFROM szEmailFrom_EMAILFROM String 256 0 Email From Field
2 *** Default Email Limit YEMALLM n***EmailLimit_YEMALLM Integer 11 0 Email Limit
4.6 R550002 – *** WSJ PDF Email UBE
This is the UBE that will that will run every 30 minutes and reference the last run job number on F00022 for ‘F550002’ It reads over F986100 using BSVW V986110A selecting on JOBNBR > saved JOBNBR on F00022 and where JOBSTS = D/E
4.6.1. Event Rules
R550002.txt
R550002.html
Automated email of completed PDF/CSV jobs
www.jdesource.com Author: John Danter Page 11 of 15
4.7 R550002T – *** WSJ PDF Test UBE Harness
All this UBE does is override the F9861110 datasource and call R550002 to allow this to run locally in DV PY and UT. Pass in the name of the datasource DATP
4.7.1. Event Rules 00001 SetF986110DS(B9861101.SetF986110DS) "***AX-JDED1 - 900 Server Map" -> szDatabasepath [DATP] 00002 // 00003 Call UBE:R550002 Version:***0001 00004 // 00005 SetF986110DS(B9861101.SetF986110DS) <Blank> -> szDatabasepath [DATP]
4.7.2. PO Values
DV900 (LOCAL) - Versions - DV900
R550002 - *** WSJ PDF Email UBE
Processing Option ***0001 SCH0001
1. Business Unit Enter the Business Unit to select over. Leave blank for ALL *NB the MCU usually defaults from the USERs default branch
1. Emails Active Leave BLANK to send emails out via the SMTP server To STOP emails please enter '1'
Values here are only to be entered if a SPECIFIC UBE VERS or USER is to be targeted Valid options are: OBNM only OBNM VERS only OBNM VERS USER USER only Please note that if a specific selection IS to be targeted, unless there is a catch ALL version of this Emailing UBE running, the Update Job Number flag below should be set to N in this version
1a. Object Name
1b. Version History
1c. User ID
2. Update the Job Number Setting this option to 'Y' will ensure the LAST selected JOBNBR from WSJ is saved. Saving the JOBNBR means once this version is run no other version of this UBE can process OLD records. Only NEW records as the WSJ moves on throughtout the day will be picked up. An example of where this would set to N is for versions that target a specific UBE VERS USER combination Y Y
4.8 T550002U – *** WSJ PDF Email UBE DSTR PO
PO template for R550002 PO Template T550002U - *** WSJ PDF Email UBE DSTR System Codes 55/55
Element Tab Text Alias Variable Data Type
Length Decimals Description
1 *** 1. Business Unit Enter the Business Unit to select over. Leave blank for ALL *NB the MCU usually defaults from the USERs default branch
MCU szCostCenter String 12 0 Business Unit
Automated email of completed PDF/CSV jobs
www.jdesource.com Author: John Danter Page 12 of 15
2 Process 1. Emails Active Leave BLANK to send emails out via the SMTP server To STOP emails please enter '1'
EV01 cStopEmails1_EV01 Character 1 0 J.D. EnterpriseOne Event Point 01
3 Selection
2. Update the Job Number Setting this option to 'Y' will ensure the LAST selected JOBNBR from WSJ is saved. Saving the JOBNBR means once this version is run no other version of this UBE can process OLD records. Only NEW records as the WSJ moves on throughtout the day will be picked up. An example of where this would set to N is for versions that target a specific UBE VERS USER combination.
EV01 cSaveJOBNBR_EV01 Character 1 0 J.D. EnterpriseOne Event Point 01
4 Selection FUTURE USE Values here are only to be entered if a SPECIFIC UBE VERS or USER is to be targeted Valid options are: OBNM VERS USER USER only Please note that if a specific selection IS to be targeted, unless there is a catch ALL version of this Emailing UBE running, the Update Job Number flag below should be set to N in this version
5 Selection 1a. Object Name OBNM szNameObject_OBNM String 10 0 Object Name
6 Selection 1b. Version History VERS szVersion_VERS String 10 0 Version History
7 Selection 1c. User ID USER szUser_USER String 10 0 User ID
4.9 V550002A – *** WSJ PDF Email Config Table BSVW
BSVW over F550002 for P5500002
View V550002A - *** WSJ PDF Email Config table BSVW System Codes 55/55 Go to Tables
Column Table Alias Description Data Type Length Decimals
1 F550002 OBNM Object Name String 10 0
2 F550002 VERS Version History String 10 0
3 F550002 GPUS User ID String 10 0
4 F550002 ACTIVEYN Active Flag Y/N Character 1 0
5 F550002 RPDEMAIL Report Definition Delivery EMail Address String 100 0
6 F550002 EMAILFROM Email From Field String 256 0
7 F550002 APPTSUB Appointment Subject String 256 0
8 F550002 YEMALBOD Mailto Text Body String 1024 0
9 F550002 CMDS Command String String 256 0
10 F550002 YATTNM Email Attachment Name String 256 0
11 F550002 YEMALCC Electronic Address CC String 256 0
12 F550002 YEMALBCC Electronic Address BCC String 256 0
13 F550002 YEMALLM Email Limit Integer 11 0
14 F550002 USER User ID String 10 0
15 F550002 JOBN Work Station ID String 10 0
16 F550002 UPMT Time - Last Updated Numeric 6 0
17 F550002 UPMJ Date - Updated Date 6 0
18 F550002 PID Program ID String 10 0
19 F550002 MCU Business Unit String 12 0
20 F550002 JOBSTS Job Status String 2 0
21 F550002 YERREML Error Email Address String 256 0
22 F550002 CSVFLG CSV Flag Character 1 0
Go to Columns
Tables Description Prefix Index
F550002 *** WSJ PDF Email Config table RE Unique
4.10 Data Dictionary Items
Here is a list of DD items used in this solution
Data Item Name Type Length UDC
YATTNM *** Email String 256
Automated email of completed PDF/CSV jobs
www.jdesource.com Author: John Danter Page 13 of 15
Attachment Name
YEMALBCC Electronic Address BCC
String 256
YEMALBOD Mailto Text Body
String 1024
YEMALCC Electronic Address CC
String 256
YEMALLM Email Limit Integer 11
YERREML Error Email Address
String 256
Automated email of completed PDF/CSV jobs
www.jdesource.com Author: John Danter Page 14 of 15
5 Objects Affected
Below is a complete list of all the objects involved in this scope:
PROJ2724.01.01
Object Name Object Type
B550002 *** WSJ PDF Email Address BSFN BSFN
D5500002 *** WSJ PDF Email Address DSTR DSTR
F550002 *** WSJ PDF Email Config table TBLE
F550002C *** WSJ PDF Email Count table TBLE
P550002 *** WSJ PDF Email Config Application APPL
P550002|VJDE0001 P550002|VJDE0001 APPLVER
R550002 *** WSJ PDF Email UBE UBE
R550002T *** WSJ PDF Email Test UBE UBE
R550002T|***0001 *** Email PDF Test harness LOCAL UBEVER
R550002|***0001 *** Email PDF UBEVER
R550002|SCH0001
Scheduled Automatic Emailing of completed WSJ file UBEVER
T550002 *** WSJ PDF Email Config Application DSTR DSTR
T550002U *** WSJ PDF Email UBE DSTR DSTR
V550002A *** WSJ PDF Email Config table BSVW BSVW
YATTNM Email Attachment Name DD
YEMALBCC Electronic Address BCC DD
YEMALBOD Mailto Text Body DD
YEMALCC Electronic Address CC DD
YEMALLM Email Limit DD
YERREML Error Email Address DD
Any changes to standard JDE Objects may need to be reapplied in the event of an upgrade or application of an ESU.
Automated email of completed PDF/CSV jobs
www.jdesource.com Author: John Danter Page 15 of 15
6 Assumptions
The JDE INI file on the server is setup for connection to the SMTP server at ***.
The UBE R550002 is setup to run on the scheduler. Queue yet to be decided.
The scheduled user has been been access to the print queue.
The scheduled user has been granted access to the business units listed in F550002.