«

»

Sep 21 2009

Send Email with PDF Output

VN:F [1.9.22_1171]
Rating: 4.2/5 (6 votes cast)

First and foremost check is to see that the JDE.ini has been setup with settings to mail with the SMTP settings in it, and that your SMTP allows the service.
JDE.ini – [JDEMAIL] settings needs to be configured as
1Rule1=90|OPT|MAILSERVER=SMTPSRVRNMATL20

E-MailTo check your SMTP services status use Telnet (needs Admin priv)

Open Telnet
Host Name = SMTP Servername
Port = smtp
Termtype = what ever it defaults

It will give you SMTP Server status

To know more about JDE.INI visit – http://www.scribd.com/doc/2088833/JDE-ini

You can view the New method to send Email Output from the same UBE – http://www.jdesource.com/enterpriseone/email-ube-output-from-within-itself-how-to/

Step 1 –
Create new Driver UBE which will then call the UBE who’s output has to be E-Mailed.
Step 2 –
After the above is done. We need to get the JobNumber of the executed UBE, to retrieve the PDF from the ExecutionHost server. So we need to use the PATH to the Server Print queue and the output file name.
The Usual PDF Output naming format is: R551234_VERSION_JOBNUMBER_PDF (If output in UNIX servers) else use .PDF
Please visit the link to see how to retrieve the Server JobNumber
Step 3 –
Once the full PATH is generated use BF B0500190 (SendEMailHRM) to use the file as attachment and send to respective person(s).

From Version 8.10 and above, the Send Email HRM BSFN has been replaced with B0500725 – Email Merge Letter, details of which has been written in the comments by Matt

Shown below is a sample code of what the parameters are for the B0500190 (SendEMailHRM).

 

VA rpt_MessageText = "Message text"
VA rpt_Subject = "Subject Text"

//GET THE JOBNUMBER for the UBE using above said Logic
//Lets say Retrieved rpt_ServerJobNumber
//
VA rpt_AttachFileName = concat("PATH",concat(rtrim(ReportName,' '),concat("_",concat(rtrim(VersionName,' '),concat("_",concat(rtrim([VA rpt_ServerJobNumber],' '),"_PDF"))))))
VA rpt_AttachDesc = concat(rtrim(ReportName," "),concat("_",concat(rtrim(versionname," "),".PDF" ) ) )
//
RV FileName = VA rpt_AttachFileName
//
If VA rpt_ServerJobNumber is greater than
  //
  Send E-Mail - HRM
      "[email protected]" -> szFrom
      VA rpt_All_To_ID -> szTo
      VA rpt_All_CC_ID -> szCC
      VA rpt_Subject -> szSubject
      VA rpt_MessageText -> szMessageTextChar256
      "1" -> cIncludeAttachmentFlag01
      VA rpt_AttachFileName -> szNameOfAttachmentFile
      VA rpt_AttachDesc -> szAttachmentDisplayText
      UNDEFINED -> cSendCopyOfEMailToSelfFlag01
      UNDEFINED -> cSetOneWorldErrorFlag01
      UNDEFINED -> cRecordOperInLogFileFlag01
      UNDEFINED -> cAppenOrOverwriteLogFile01
      UNDEFINED -> szNameOfLogFile
      RV Variable 000006 <- mnErrorCodeReturned

End If

The Problem with the above BSFN is that the attachment file path can not be greater than 40 Chars. So we may need to copy the BSFN to replace the DD Item with something of atleast 256 chars in length.

You may love to read the following document for more information – JDE-Email-Settings

Published under the license.

VN:F [1.9.22_1171]
Rating: 4.2/5 (6 votes cast)
Send Email with PDF Output, 4.2 out of 5 based on 6 ratings
(Visited 3,168 times, 17 visits today)

About the author

Deepesh M Divakaran

Deepesh MD is more of a Gizmo Geek, and a techie.
A very experienced Technical Consultant on Oracle JD Edwards EnterpriseOne, and OneWorld. As a consultant he has worked for wide range of industries, from Manufacturing, Media, Oil & gas etc. and has worked on re-engineering modules, and areas of customization.
With a touch of class and understanding towards what ever he does, he is often regarded by his colleagues as the one stop answer for all Technical/Software related queries.

23 comments

Skip to comment form

  1. Marcellus Palomino

    This is the best technique to be followed, I must say that really being here and not using this will really be silly. Will you please reply with more information here? I think you have a good response and it will definitely help a lot. As this forum has really been a good platform for us all, contributing to this will really be healthy for our and your business as well. We all are waiting for a good informative response. Thanks a lot for this, waiting for more.

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  2. Deepak C Thali

    Hi Deepesh,
    I am deepak currently working in Dubai,UAE. I would like to clarify some points about upgrading tools release. Now we are on tools 8.96.3 and would like to upgrade to 8.97.3 which is running on iseries. If possible can you please tell me how can we run multifoundation on as400 and incase if we have to revert to 8.96 what changes required on deployment server?

    deepak

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  3. Matt

    Hi,

    Will this work on the JDE scheduler -> if I schedule the driver report and run it overnight can I expect it will work?

    For instance retrieving the job number is usually user specific – so with the scheduler what will happen?

    Cheers
    Matt

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
    1. Deepesh Divakaran

      Hi Matt,
      What I understand is, we can setup a Job with respect to a User in the JDE Scheduler, so there it goes. Anyways, this works with Scheduler too, but that, you will need to code around to set the e-mail Id’s coming on correctly.
      What we did in our company is – We got a subsystem job which runs every 5 mins and picks up those UBE Outputs which have been entered in a table having UBE names/versions for specific user/role and the To E-Mail address. The Subsystem UBE then picks up those UBE outputs (set in table) being run in the past 5 mins, and e-mails it them to the eMail address only if it was run by the User/Role as setup in the Table. This way we need not create the above said logic for every UBE we code. All we need is a Record in the Table.
      Hope I make sense.

      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
  4. Matt

    Hi Deepesh,

    Thanks for that – I’m going to give it a shot!

    Also, do you know a business function that allows me to dynamically call any UBE (from say a processing option?).

    Basically I don’t want to use the report interconnect because I don’t want to hardcode which report I’m going to be running.

    I’ve tried one BSFN called “Call User Defined UBE” -> but no luck! – as always the documentation attached to the standard code base is pathetic!

    Cheers
    Matt

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
    1. Deepesh Divakaran

      Hi Matt,
      Actually you gave me a topic to write on and here it is – http://www.deepeshmd.com/enterpriseone/launch-batch-jobs-ube-dynamically-from-interactive-apps
      Please do share your valuable comments on the same.

      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
  5. Matt

    Hi Deepesh,

    I got it all going in DV and PY – then it hit PD… no go – when you run the UBE to email the PDF’s as suggested it hits a problem – the Send E-Mail – HRM is defined as a client only business function – so it will not run in a UBE.

    Back up plan?

    Cheers
    Matt

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
    1. Deepesh Divakaran

      Matt,
      I’m sorry my mistake… We had created a BSFN to do the e-mail part on server. following is the logic of the BSFN
      Used “Execute External Program” (B34A1030) and create a Send E-Mail string to get it working with your server OS. Like if, your Server OS is Linux/Unix use the MailX command to send the attachment. Prefix ‘uuencode’ for the file, if its Unix.
      e.g. SendString = (uuencode $SVRHOME/PrintQueue/R550101_VER001) | mailx -s SUBJECT -a $SVRHOME/PrintQueue/R550101_VER001_PDF.pdf ORIGINHOSTNAME
      Hope that helps.

      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
  6. Matt

    I forgot to mention it worked in DV and PY because I ran it locally (ie client side).

    Cheers
    Matt

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  7. Matt

    Hi Deepesh,

    Just thought I’d update you with a BSFN I found that sends emails with attachments off of the server!

    B0500725 – Specifically “Email Merge Letter”.

    Just tested in PY all good! Saves me having to write the unix script 😉

    Cheers
    Matt

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
    1. Deepesh Divakaran

      Matt,
      That’s great, this BSFN does not exist in Xe (the system I’ve access to). Could you help with the BSFN parameters/usage. I would love to update this article & if you are interested, you could do that too, and write/update new JDE articles.

      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
  8. Matt

    B0500725 – Email Merge Letter

    Here is the usage – where I have defined literals below with quotes you can simply use a variable to parse in dynamic email addresses/filenames etc. For the path I retrieve it from the processing options of the UBE.

    [email protected]” -> szFrom
    [email protected]” -> szTo
    -> szCC
    “SubjectString” -> szSubject
    “MessageString” -> szMessageTextChar256
    “1” -> cIncludeAttachmentFlag01 (leave blank if no attachment)
    “\\ServerWherePrintJobsSit\printqueue\” -> szNameOfAttachmentFile (leave blank if no attachment)
    “filename.pdf” -> szAttachmentDisplayText (leave blank if no attachment)
    Everything else is blank -> unless you want the error code back.

    When setting this up you’ll no doubt hit issues – for instance SMTP errors, ini file errors, path errors. The best thing to do is set it up in your UBE – run it locally with debug logging turned on. To avoid filling your log up with crap use owdlc.exe, simply go to batch versions, select your report/version/processing options/data selection and before clicking OK to run the report locally simply click debug on in owdlc.exe… this way the log only has entries from running the UBE. Then to quickly find what happened when you called the business function do a find/search on the debug.log file search for your email address (remember the email address is passed into the function) so it will be present in the debug log. Just under it you can see any errors.

    Types of errors you get are:

    Email server doesn’t trust your IP address (check with your email admin you’re on a trusted source).

    Email address is spoofed – (get your email admin team to allow your IP address to create/send emails).

    Incorrect port number – just use the standard 25 – from what I’ve seen it’s easier to change your email server than it is JDE on this one (you can do it, but it’s a pain)

    Invalid path (check the path you’ve passed to the function and simply cut/paste it into windows explorer and see if you can get there – if you can’t then chances are neither can the BSFN – also remember to make sure the server where this will run has access to this path.

    That’s pretty much it.

    Good luck.

    Cheers
    Matt

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  9. Matt

    Lastly – people have asked how do I get/find owdlc.exe – it’s currently a free download at Everest Software – http://www.everestsoftint.com/index.asp?a=browse&p=OWDLC

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
    1. Deepesh Divakaran

      Thanks Matt.

      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
  10. Joyce

    This utility works awesome..better error reporting.

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  11. Matt

    Hi Joyce,

    What version of JDE are you using it on?

    Cheers
    Matt

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
    1. Deepesh Divakaran

      I don’t think Joyce visited the site for JDE. 🙂
      This might be the reason for his comments – http://www.deepeshmd.com/general/you-comment-i-follow

      VA:F [1.9.22_1171]
      Rating: +1 (from 1 vote)
  12. Tammy

    Is there any simpler way I can use some BSFN to retrieve the job number for a UBE?

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  13. Ram

    Can you please detail the descrption for error code -32?

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  14. Jose Vargas

    Hi
    Can you please detail the descrption for error code -32?

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  15. DavidLeon

    Cuando es un error code 16 es que no existe el archivo fisicamente. Error code 32 es cuando existio un error en el envio de email, practicamente son dos cosas, los datos son que pasaste a las bsn con erroneos o imcopletos y el servidor de correo no esta configurado correctamente.

    Saludos,
    David

    VN:F [1.9.22_1171]
    Rating: +1 (from 1 vote)
  16. BSK

    Hi All,

    I am trying to send email from UBE to external vendors (eg. gmail account) and not successful.
    Error: “The SMTP server returned an error Response from the SMTP server is ” and also “Leaving sendMimeMsgOnSMTPImpl with an error return code: “.

    It works when I send email to internal email id (Outlook), but not external email id’s.

    Version: E810
    AS400/iSeries

    Any help is greatly appreciated.

    Thanks

    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  17. udayks

    I Got the errorcode=16 while running b0500725 and the mail was not sent.can anyone know about the errorcode’16’.

    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

Leave a Reply