Email PDF Output

Ainos

Active Member
Hi All,

I am currently working on OneWorld Xe.

I have a report let say 'A' which print vendor information. I need to run this report for different vendor and have it emailed to corresponding vendor email address. I will be running this report on server.

To send the email, I have created a driver report which will call report A for different vendor number. The issue here is I need to get Job Number for pdf location.
I tried using Launch Batch Application, but then I will not be able to send report interconnect value (for this example, I need to send the vendor address for which Report A needs to be run).

Can anybody help me with this.

Thanks in advance,

Sonia
 
Sonia,

Is it possible to pass the Vendor number using a different method, other than via report interconnect values? For example a custom UDC.
 
Hi Peter,

It will be difficult for me to use UDC because the total number of vendor is not static. And lets say if I use UDC how will my driver report come to know which PDF is for which vendor.
 
The only quite sure way I know's to get the job number is to use call driven by BSFN. Then the UBELaunch Api can be used to the job number.
Another solution, but untested on UBE, is to reproduce the Get UBE sequence on the BV/IV program. I know it work on a client but i ddin't used it on a server. If yopu tried, please give the result.
ooo.gif
 
Sonia,

if i got it right, you need the job number and location where pdf is getting
created fine, so that you can make out the report name and send it using
some bsfn??

you can use LaunchUBEEx API to launch the UBE, it will return you a job
number, using it you can make the string of Report pdf and can send it to
vendor e-mail ID.
 
Any Idea if Retrieve ComputerID & Job Number(B76A0440) can be used or not?
 
Ainos,

my kludge of a solution to this problem is to have the driver UBE write the parameters needed (Vendor Number in your case) to a database table that is then read by "Report A" when it starts. Its not elegant, it has potential issues, but it can work.
 
Good morning! I had the same situation and was able to execute the following codes to email payment information to different vendors - but it was done in B9 which should work well for XE.

What I did was create a driver program (e.g. R55DRIVER) call on the vendor detail program (e.g. R55PMT) by passing the vendor # thru a report interconnect. In the R55PMT, I added the following codes at the Report Level Event Rule Operations (you will access this within RDA by clicking on 'File', 'Event Rule Operation' and 'Edit Report Level Event Rules'):

=======================================================================
REPORT LEVEL EVENTS
=======================================================================
EVENT: End Report (future)
-----------------------------------------------------------------------
evt_JobstatusOW
evt_ProcessID
evt_JobName
evt_PathInput
evt_MachineUsage
evt_FileInput
evt_EmailSubject
evt_ServerProcessID
evt_EmailAddressTo
evt_EmailAddressFrom
evt_MachineKey
evt_Month_Chr
evt_Day_2Chr
0001 VA evt_JobstatusOW = "P"
0002 VA evt_EmailAddressFrom = "ACH Distribution System"
0003 VA evt_EmailSubject = "ACH Payment Register"
0004 Get Audit Information
VA evt_MachineKey <- szMachineKey
0005 Get UBE Output Path
SL ReportName -> szSRCNameObject_OBNM
SL LoginEnvironment -> szEnvironmentName_ENHV
VA evt_PathInput <- szPathFlatFile_NFLF
VA evt_MachineUsage <- szMachineUsage_USAGE
If VA evt_MachineUsage is equal to "20"
0006 // ***UBE was ran on a server
0007 Retrieve Process and Transaction IDs
VA evt_ServerProcessID <> mnProcessID
0008 F986110.Select
VA evt_JobstatusOW = TK Job Status
SL UserID = TK User ID
VA evt_MachineKey = TK Execution Host Name
0009 F986110.Fetch Next
VA evt_ProcessID <- TK Server Process ID
VA evt_JobName <- TK Foundation - Future Use 2
While VA evt_ProcessID is not equal to VA evt_ServerProcessID And SV File_IO_Status is not equal to CO ERROR
0010 F986110.Fetch Next
VA evt_ProcessID <- TK Server Process ID
VA evt_JobName <- TK Foundation - Future Use 2
0011 End While
0012 //
0013 VA evt_PathInput = concat([VA evt_PathInput],rtrim([VA evt_JobName],' ' ))
0014 VA evt_PathInput = concat([VA evt_PathInput],'.PDF')
0015 VA evt_FileInput = VA evt_JobName
0016 //
0017 Else
0018 // ***UBE was ran on a client
0019 //
0020 VA evt_Day_2Chr = lpad(date_day([SL DateToday ]),'0',2)
0021 VA evt_Month_Chr = lpad(date_month([SL DateToday ]),'0',2)
0022 //
0023 VA evt_FileInput = SL ReportName
0024 VA evt_FileInput = concat(rtrim([VA evt_FileInput],' ' ),'_' )
0025 VA evt_FileInput = concat(rtrim([VA evt_FileInput],' '),rtrim([SL VersionName ],' '))
0026 VA evt_FileInput = concat(rtrim([VA evt_FileInput],' '),'_D')
0027 VA evt_FileInput = concat(rtrim([VA evt_FileInput],' '),substr(date_year([SL DateToday ]),2,2 ))
0028 VA evt_FileInput = concat(rtrim([VA evt_FileInput],' '),[VA evt_Month_Chr])
0029 VA evt_FileInput = concat(rtrim([VA evt_FileInput],' '),[VA evt_Day_2Chr])
0030 VA evt_FileInput = concat(rtrim([VA evt_FileInput],' '),'_T*.PDF' )
0031 VA evt_FileInput = concat([VA evt_PathInput],[VA evt_FileInput])
0032 Find a file that matches a String with Wildcards
VA evt_FileInput -> szFileorPathToFind
VA evt_FileInput <- szFoundFileorPath
0033 VA evt_PathInput = concat([VA evt_PathInput],[VA evt_FileInput])
0034 //
0035 End If
0036 //
0037 VA evt_ElectronicAddressType = "E"
0038 VA evt_LineNumberID = "0"
0039 F01151.Select
PC Address Number (F58CLD01) = TK Address Number
VA evt_LineNumberID = TK Who's Who Line Number - ID
VA evt_ElectronicAddressType = TK Electronic Address Type
0040 F01151.Fetch Next
VA evt_VendorEmailAddress <- TK Electronic Address
If SV File_IO_Status is equal to CO SUCCESS
0041 VA evt_Subject = concat("ACH Payment Detail - Vendor #",concat([PC Address Number (F58CLD01) (AN8)],concat("_",[SL DateToday ] )))
0042 Send E-Mail - HRM
PO EmailFrom -> szFrom
VA evt_VendorEmailAddress -> szTo
PO EmailTo -> szCC
VA evt_Subject -> szSubject
<Blank> -> szMessageTextChar256
"1" -> cIncludeAttachmentFlag01
VA rpt_DirectoryPath -> szNameOfAttachmentFile
0043 End If

Note - It is important that this piece of code is placed at the Report Level ER because you want to retrieve the pdf after the entire report is completed.

I hope this helps you. Good luck!
smile.gif
 
I just realized that it would be easier to read the codes if I attached the file. Here you go -
 

Attachments

  • 109414-R55PMT.txt
    4.1 KB · Views: 627
Hi Geri,

I will try the logic you gave.

Anyways, I learnt something new here. I was not knowing that we can place ER in place other than sections.This is the first time I will be using Edit Report Level Event rule.
 
Hi Geri,

Can I do something like this:

1)Derive full Report name(along with Job Number) in Child report
2)Pass value from 1) to Driver Report through report Interconnect
3)In driver report send email.

Will this work,

Sonia
 
I think you should be able to do so because you will be passing back the pdf file pointer back to the driver section so it can attach the file to your email. Let me know if this works for you.
laugh.gif
 
Hi Geri,

I tried doing Table I/O operation on F986110 but somehow it is failing.
I don't know why it is not working,even if I only give submitted date as selection criteria, it is not working.

Can OCM mapping for F986110 be the reason why it is failing?
 
Good morning Ainos!

I don't think the OCM mapping is affecting your table I/O. Do you know how to turn your UBE logging on? If yes, you may want to see if there's any additional information you could gather from the log to determine why your Table I/O is failing. Have you also tried using this code on the "child" UBE itself to try and send the email?

If the table I/O works in the child UBE, then perhaps you are not passing the correct parameters back to the parent UBE (or calling UBE).

Good luck and hope this works. If you still have problems, could you send me your codes so I can take a quick look at it?
 
Finally I was able to figure out why Table I/O on F986110 was failing.

It sounds pretty weird, but the entry of child report in F986110 was taking place only after the status is 'D'. So instead of doing table I/O in child report, I did it in driver report. It worked!!!

Thanks Geri
 
Hi Geri
I am on XE and tried using your code, But I am not able to find business function "Get UBE Output Path"
Does it having other description in XE ? Can you please tell me the Souce Module Number for this business function

Thanks
Demi
 
Good morning Demi -

Forgot that this is a custom NER. Here are the details for this NER:

GetOutputPath ==========================================
Get UBE Output Path ========================================================
[N589801] [D589801] =========================================================

GetOutputPath <~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

evt_szEnvironmentName_ENHV [ENHV]
evt_szOutputPath_NFLF [NFLF]
evt_szNameObject_OBNM [OBNM]
evt_szUBECode_OLCD04 [OLCD04]
evt_szOLFunctionCode_FUNO [FUNO]
evt_szPathCode_PATHCD [PATHCD]
evt_szB9Path_NFLF [NFLF]
evt_szMachineUsage_USAGE [USAGE]
evt_szMachineKey_MKEY [MKEY]
0001 // ----------------------------
0002 // Initialize Vars
0003
0004 evt_szOLFunctionCode_FUNO [FUNO] = 'UBE'
0005 evt_szNameObject_OBNM [OBNM] = DS szSRCNameObject_OBNM [D589801,OBNM]
0006 evt_szEnvironmentName_ENHV [ENHV] = DS szEnvironmentName_ENHV [D589801,ENHV]
0007 If evt_szEnvironmentName_ENHV [ENHV] = <Null>
0008 evt_szEnvironmentName_ENHV [ENHV] = SL Login Environment
0009 EndIf
0010 Read INI [ReadIni,B980055,D980055,CDBASE]
DS szSectionName [D980055,SECTNM] <- 'INSTALL'
DS szVariableName [D980055,CVVVARNM] <- 'B9'
DS szValueForEntryDefault [D980055,DVAL] -> evt_szB9Path_NFLF [NFLF]
DS szFileNameOne [D980055,FILE1] <- 'JDE.INI'
0011 evt_szOutputPath_NFLF [NFLF] = concat(rtrim([VA evt_szB9Path_NFLF],' '),'\\')
0012 // Check for TC
0013 F9860.Fetch Single (index 3)
TK NameObject [F9860,OBNM] = evt_szNameObject_OBNM [OBNM]
TK FunctionCodeOpenSystems [F9860,FUNO] = evt_szOLFunctionCode_FUNO [FUNO]
TK ObjectLibrarianCode04 [F9860,OLCD04] -> evt_szUBECode_OLCD04 [OLCD04]
0014 If evt_szUBECode_OLCD04 [OLCD04] = '5'
0015 // UBE is a TC
0016 Get Path Code From Environment [GetPathCodeFromEnv,B9800094,D9800094,CCORE]
DS szUsrliblname [D9800094,LL] <- evt_szEnvironmentName_ENHV [ENHV]
DS szPathcode [D9800094,PATHCD] -> evt_szPathCode_PATHCD [PATHCD]
0017 evt_szOutputPath_NFLF [NFLF] = concat(ltrim([VA evt_szOutputPath_NFLF]," "),[VA evt_szPathCode_PATHCD] )
0018 evt_szOutputPath_NFLF [NFLF] = concat(rtrim([VA evt_szOutputPath_NFLF],' '),"\\")
0019 evt_szOutputPath_NFLF [NFLF] = concat(ltrim([VA evt_szOutputPath_NFLF],' '),"export")
0020 evt_szOutputPath_NFLF [NFLF] = concat(rtrim([VA evt_szOutputPath_NFLF],' '),"\\")
0021 Else
0022 evt_szOutputPath_NFLF [NFLF] = concat(ltrim([VA evt_szOutputPath_NFLF],' '),"PrintQueue")
0023 evt_szOutputPath_NFLF [NFLF] = concat(rtrim([VA evt_szOutputPath_NFLF],' '),"\\")
0024 EndIf
0025 // Check for Enterprise Server
0026 Get Audit Information [GetAuditInfo,B9800100,D9800100,CCORE]
DS szMachineKey [D9800100,MKEY] -> evt_szMachineKey_MKEY [MKEY]
0027 F9650.Select (index 1)
TK MachineKey [F9650,MKEY] = evt_szMachineKey_MKEY [MKEY]
0028 F9650.Fetch (index 1)
TK MachineUsage [F9650,USAGE] -> evt_szMachineUsage_USAGE [USAGE]
0029 F9650.Close
0030 DS szMachineUsage_USAGE [D589801,USAGE] = evt_szMachineUsage_USAGE [USAGE]
0031 DS szPathFlatFile_NFLF [D589801,NFLF] = evt_szOutputPath_NFLF [NFLF]

-------------------
Data Structure
D589801 <~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[OBNM] -> szSRCNameObject_OBNM
[ENHV] -> szEnvironmentName_ENHV
[NFLF] <- szPathFlatFile_NFLF
[USAGE] <- szMachineUsage_USAGE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Good Monday morning!
Thank you for the very informative post regarding the “Email PDF Output”. I have been looking for solution for some time and was very glad to see a working solution.
While implementing your solution I ran into a problem. Somehow I can not find the function “Get UBE Output Path”. I assume it is a business function so I searched it by function name, description but just could not find it. Would you please provide more information so I can locate it? If it is developed by you, would you mind sharing the source?
I’d really appreciate your help.
PS we are using B810.
 
Back
Top