«

»

Aug 27 2014

Email UBE’s output from within itself [How-To]

VN:F [1.9.22_1171]
Rating: 4.9/5 (7 votes cast)

Email UBE OutputAutomating jobs to send outputs to designated people have been one of the challenging areas in JDE.

Earlier days, we used to have a job being fired off from a Driver UBE (that way we get the job#), which would then pick up the report output and then email it as attachment. But then we had issues with passing in Interconnect values, or override Data selections etc.
The latest addition is the BI Publisher, where you can have beautiful reports generated, and then emailed off. It works just perfect.
But all these options require a good amount of development effort for each report

Did you know that you can send or email off a report’s output from within itself? Its easy, just a one time BSFN build, and then use it wherever you want. The key to sending output as attachment is to retrieve the JOB Number (JOBN) of the batch job.

Retrieve UBE Parameters
   SL ReportName -> BF szProgramId
   SL VersionName -> BF szVersionId
   "T5500002" -> BF szPOTemplateId
   VA evt_mnServerJobNumber_JOBNBR <- BF mnServerJobNumber

The Retrieve UBE Parameters BSFN, uses the pUBEVar data-structure (tagUBEVAR as declared in jdekstrt.h) to retrieve the job number. Please find the attached BSFN files and use it to your will. And YES, it works Only on Server.

Please register to download the attachments in Email UBE’s output from within itself [How-To]

Once you have built the BSFN, you can use this in Report Level Event – End Report (future) as above. You can find the End Report Event as shown below

Report Level ER Image

Use the Job Number to retrieve the Job Details from F986110. Make sure you override using the correct Database Path.

Complete Event rule (ER) dump can be viewed here –

Please register to download the attachments in Email UBE’s output from within itself [How-To]

Please let know your experience, and comments.

Published under the license.

VN:F [1.9.22_1171]
Rating: 4.9/5 (7 votes cast)
Email UBE's output from within itself [How-To], 4.9 out of 5 based on 7 ratings
(Visited 3,028 times, 10 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.

26 comments

1 ping

Skip to comment form

  1. jerome

    Good Job Deepesh !

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

    great job, Deepesh. I have one query. What is the difference between ‘End Report’ and ‘End Report [future]’ event?

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

      With help from David Leon (translation of his comment below) –

      “End report” represents the last section to read in the report, can be used to print sections related data etc.

      “End report (Future)” serves as the last process that finished after the execution of the report (pdf print finish). It utilized to send email for example.

      So in essence its in the [Future] that you get the finished output.

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

    one question, for example , i send UBE BI Publisher. Next process searh file, dont termine process End Report [future] . Dont termine print pdf. Why ????

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

      Hi David,
      As of what I understand, the BIP report outputs are stored in XML tables and not as physical outputs. Probably one of the reason why you do not get to search and find a pdf output.

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

        Hi there
        I have a configuration in JDE.INI to save pdf bi. When I launch the UBE report, execute code in termination of future report, but does not help. I’m thinking that looking at the F95 tables and I can see if I finish the job number and the RD already finished. At that time I can find the file in order to relate to the transaction in that work. What do you think about this?

        VN:F [1.9.22_1171]
        Rating: 0 (from 2 votes)
  4. DavidLeon

    End report representa la ultima sección a leer en el reporte, Puede utilizar para imprimir secciones relacionadas, con datos etc.

    End report (Future) Sirve como proceso ultimo despues que se haya acabado la ejecucion del reporte (print pdf termine). Se utliza para enviar email por ejemplo.

    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  5. Shrikanth Hegde

    Hi Deepesh…
    It is wonderfull info. I implemented this and it is working fine in my client env…..:)

    Also instead of using INI info ( I faced issue with this) for PATH you can use API:
    GetPrintQueueDirectoryPathName (lpDS->szDirectoryPath);

    Thank you
    Shrikanth Hegde

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

      Thanks Shrikant for the information. Updated the ER file accordingly

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

    Excellent…Thanks Deepesh….Helped me a lot !!

    Thanks,
    Joydeep

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

    Hi Deepesh…

    Hi Deepesh …

    NO achievement obtain the jobnumber, I copied the function equal and not able to obtain, I am using E1 9.1.4

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

      David,
      ayuda por favor publicar su conjunto de código aquí que parece mejor, si usted desea.
      (hope google translate is correct 😉

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

    Hi Deepesh…

    The BSFN RetrieveUBEParameters, I is not returning the jobnumber, be missing something in the report to return me this information.
    I am new to programming in JD Edwards.

    Best Regards

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

    Si estas validando cheovargas en localhost, nunca va a funcionar por que la extracción del numero de trabajo se lo hace únicamente en el ambiente web (Desplegado el paquete). El numero si consultas por un lado se realiza en una tabla F986110 y en localhost no inserta ahi; si utilizas un retrieve, se lo hace por RetrieveUBEParameters con algo adicional. Y la solución que tengo realizo una lectura de buffer.

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

    Gracias por tu pronta repuesta.

    No lo estoy haciendo local, ya que en la descripción arriba, indica que solo funciona en vía Web.

    Luego de desplegado el paquete, no me trae tampoco el JobNumber, nosé si sera que me falta algo en el Reporte, ya que las BSFN esta igual, lo único que veo es la Opción de Proceso que esta pasando, no se que tendrá esa opción de proceso descrita en el ejemplo

    Nuevamente gracias por tu pronta repuesta.

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

    Esta linea es la que te carga todo los parametros del UBE pReportSection = lpBhvrCom->lpReportSection;, pero hay que trabajarla mas segun le revise. Esta incompleta.

    Saludos,

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

    Hi Deepesh,

    I see there is a BSFN Get OneWorld Job Number – B984054. Can’t we use this BSFN to get the Job Number of the submitted UBE ?

    Regards
    Kid

    VN:F [1.9.22_1171]
    Rating: +1 (from 1 vote)
    1. Deepesh M Divakaran

      That would be a good option if it works on the cause.

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

    Hi Deepesh,

    Thanks for the guidance on this … I am super close to implementing, but my UBE that attaches output and sends the email must be called from a wrapper UBE in order to control the frequency to calls from level breaks. Do you or anyone else on this blog know if your logic works from a secondary UBE, or only the UBE that is directly called? Thanks!!

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

      Hi jdemeister
      If you need to call the UBE from a wrapper UBE, use the B91300C – Launch Batch Application BSFN, and return the Job number. Using this you can get the file name from job master table, and use it to attach and email.

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

        Hi Deepesh,
        I have used this logic in a BSFN to get the Job number.When this UBE is called from a parent, this bsfn returns the Parent UBE’s Job number instead of Child UBE’s.

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

    Hi there.. Very helpful. I was able to replicate the code and was able to get the job number, file name etc properly, but unable to get the email sent..
    – Attached the code in the report i needed the pdf for, Report output can be seen in WSJ. I replaced .csv to .pdf from your example code though. My log shows the correct file name and path.

    Questions:
    1. our dev server is in linux.. is there a way to verify that the file exist in the printqueue folder
    2. I am using B0500725 BSFN, is there anyway, i could test it with sample file by placing a text file locally and test, (Its a big process to get deployed to server and test and time consuming process.)

    Please help.

    Thanks,
    Uma

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

      Hi Uma,
      I have utilized a generic code which works on most environments. For your case –
      Check with your CNC on the printqueue file path. Use the hard-coded path in your UBE to the report output, and use that to email up.
      You could use the Operating System BSFNs to verify the existence of the file before sending.

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

    Hi,

    How to use GetPrintQueueDirectoryPathName API in C BSFN in JDE. Please help me.

    Thanks,
    Suresh.

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

      JDERTN(void) JDEWINAPI GetPrintQueueDirectoryPathName( (const JCHAR *) pcPrintQueueDirectoryPathName );

      VN:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
  1. Send Email with PDF Output | JDE Source

    […] DavidLeon: End report representa la ultima sección a leer en el reporte… […]

Leave a Reply