Skip to main content

Envio de e-mail com anexo .PDF

A maioria dos usuarios nao tem acesso ou nao sabem utilizar o Submitted Jobs para buscar o resultado de algum relatorio.
Para otimizar a consulta do usuario aos resultados dos relatorios e auxilia-los para encaminhar essa informacao aos seus superiores, o JDE possibilita que os arquivos (.PDF ou .CSV) sejam anexados e enviados por e-mail.

Segue abaixo um passo a passo desde configuracao do JDE.INI ate o envio de e-mail com o anexo.

Passo 01 – JDE.INI
A configuracao do JDE.INI é a maior responsavel pelo envio de e-mail enviados pelo JDE.

§ JDE.INI – Fat Client and Server – Valores Default
[JDEMAIL]
mailProfile="Default Exchange Profile"
Rule1=90OPTMAILSERVER=mail.jdedwards.com
Rule2=100DEFAULTOWMON=OWMON@jdedwards.com
Rule3=110DEFAULTJDE_SYSTEM=JDE_System@jdedwards.com
Rule4=120DEFAULTWORKFLOW_SYSTEM=Workflow@jdedwards.com
Rule5=130OPTMERGELOCAL=1
Rule6=140OPTUPDATELOCAL=0

§ Substitua a linha grifada com o endereco de SMTP que é utilizado na empresa:
[JDEMAIL]
Rule1=90OPTMAILSERVER=smtp-relay.JDEFUSION.com
Rule2=100DEFAULTOWMON=OWMON@jdedwards.com
Rule3=110DEFAULTJDE_SYSTEM=JDE_System@jdedwards.com
Rule4=120DEFAULTWORKFLOW_SYSTEM=Workflow@jdedwards.com
Rule5=130OPTMERGELOCAL=1
Rule6=140OPTUPDATELOCAL=0



Passo 02 – Criacao de relatorio “DRIVER “
O relatorio “Driver” é o responsavel pela chamada do segundo relatorio (relatorio que possui a base de dados) e atraves de comandos (inseridos no codigo) conseguira buscar o .PDF ou .CSV no servidor e enviá-lo por e-mail.


§ 1. Relatorio “DRIVER” – responsavel pela chamada do segundo relatorio, verifica a finalizacao do Relatorio “B”, busca arquivo .PDF no servidor e envia e-mail ao usuario final.
§ 2. Relatorio “B” – le a tabela F03B11 (ou qualquer outra tabela) e cria o .PDF ou .CSV
§ 3. Servidor – armazena os resultados dos relatorios.
§ Usuario Final



Passo 03 – Set up
1. Opcao de Processamento:
1.1. Campos de e-mail: FROM, TO e Cc (caso necessario).


1.2. Campo para a verificacao do processo no servidor: Job Queue


1.3. Campo com o endereco do servidor: File Address (Server)


2. Seguranca :
Verificar se o JDE possui um usuario interno que pode acessar os arquivos .PDF no servidor e pode enviar e-mail.

Passo 04 – Funcoes Utilizadas :
N98305 - Fetch UBE Mapping from OCM B9861101 - F986110 DS OVERRIDE B9861107 - Read Active Queue INI Value B9800207 - Get Current Environment B0500190 - Send E-Mail - HRM

Passo 05 – Relatorio “DRIVER” :
O relatorio “DRIVER” executa o relatorio”B”.
Faz uma busca na tabela F986110 para buscar o JOB Number, JOB Status e o JOB Detail Information (é o nome do relatorio que esta no servidor).
Busca o arquivo no servidor.
Envia e-mail.

Código:
Busca o Nome do Servidor : VA evt_szServerName_SERVER_DL010 = ""
Fetch UBE Mapping from OCM
"" -> szReport
VA evt_szServerName_SERVER_DL010 <- szLogicalDataSource


Habilita a visualizacao da tabela F986110: F986110 DS OVERRIDE
VA evt_szServerName_SERVER_DL010 -> szDatabasepath
Read Active Queue INI value
"" -> cActiveQueue


Busca o Ambiente que o relatorio esta sendo executado: Get Current Environment VA evt_szCodePath_SERVER_PATHCD <- szEnvironmentname


Comando EQUIVALENTE no Select na tabela F986110: VA evt_szFoundFutureUse2_FNDFUF2 = "R550001A_HON0001_%"
F986110.Select
PO szJobQueue_JOBQUE = TK Job Queue
VA evt_szCodePath_SERVER_PATHCD = TK Environment Name
VA rpt_szUserId_USER = TK User ID
VA rpt_jdDateUpdated_UPMJ = TK Date - Job Submitted
VA rpt_mnTimeLastUpdated_UPMT <= TK Time Job Submitted VA evt_szServerName_SERVER_DL010 = TK Execution Host Name VA rpt_szWorkStationId_JOBN = TK Origination Host Name VA rpt_jdDateUpdated_UPMJ = TK Date - Last Activity VA rpt_mnTimeLastUpdated_UPMT <= TK Time - Last Activity VA evt_szFoundFutureUse2_FNDFUF2 is Like TK Foundation - Future Use2



Recupera o JOB Status, O JOB Number e o JOB Detail: F986110.Fetch Next
VA evt_szJobStatus_SERVER_JOBSTS <- TK Job Status VA evt_mnJobNumber_SERVER_JOBNBR <- TK Server Job Number VA evt_szFoundFutureUse2_FNDFUF2 <- TK Foundation - Future Use 2


Comando WHILE com Fetch Single para verificar o Status: While VA evt_szJobStatus_SERVER_JOBSTS is not equal to "D,E"
F986110.Fetch Single
VA evt_szJobStatus_SERVER_JOBSTS <- TK Job Status VA evt_mnJobNumber_SERVER_JOBNBR = TK Server Job Number VA evt_szCodePath_SERVER_PATHCD = TK Execution Host Name End While


Ajuste no nome do arquivo .PDF : VA evt_szFoundFutureUse2_FNDFUF2 = ltrim(rtrim( [VA evt_szFoundFutureUse2_FNDFUF2],' ' ),' ' )
VA evt_szFile_SERVER_NFLF = concat(concat([PO szFileAddressServer_NFLF],[VA evt_szFoundFutureUse2_FNDFUF2]) , '.pdf')


Envio de E-mail : Send E-Mail - HRM
PO szEmailFrom_EMAL -> szFrom
PO szEmailTo_EMAL -> szTo
PO szEmailCc_EMAL -> szCC
"Titulo do E-mail" -> szSubject
Corpo do E-mail -> szMessageTextChar256
"1" -> cIncludeAttachmentFlag01
VA evt_szFile_SERVER_NFLF -> szNameOfAttachmentFile
UNDEFINED -> szAttachmentDisplayText
UNDEFINED -> cSendCopyOfEMailToSelfFlag01
UNDEFINED -> cSetOneWorldErrorFlag01
UNDEFINED -> cRecordOperInLogFileFlag01
UNDEFINED -> cAppenOrOverwriteLogFile01
UNDEFINED -> szNameOfLogFile UNDEFINED <- mnErrorCodeReturned






Valeu!
Quem me ajudou nesse trabalho foi o MV!
Abraços, Rodrigo Uzeda

Comments

Post a Comment

Thanks for your comment!

Popular posts from this blog

INFOCUS 2012 - Agenda

JD Edwards 9.1 Standalone Installation Tutorial

Hello and welcome to JDEFUSION.com!

Here's a video tutorial on how to install the newest JD Edwards 9.1 version!

In only six steps and no magic, you will have your JD Edwards up and running, including the Web version! The JD Edwards team did an outstanding job on this new version and I'm proud to be the first to document in video the installation steps and show you the system working after the installation.

The tutorial is divided in the following steps:


Images download - E-DeliveryDirectory preparationOracle 11g 32 bit installationJDE Demo installationPost installation proceduresSystem check

By following the video you'll be able to have your own JD Edwards' instance running directly in your PC or you may also install as a Virtual Machine using Oracle Virtual Box. The base OS I'm using for this tutorial is Linux and as you can see, the Virtual Box VM works fast and is also stable. Please let me know if you need some information on how to setup a Virtual Box instanc…

JDEdwards 9.0 DEMO Installation Tutorial

Hello!
Here's the new tutorial on JD Edwards 9.1


http://www.jdefusion.com/2012/05/jd-edwards-91-standalone-installation.html


You may want to install the 9.0, but I do recommend you to install and try the 9.1 with the new user interface and the "pages" feature. Click the link above and enjoy the video tutorial!


Oracle announced JDEdwards most recent version: 9.0 in September 2008.
Below, a complete tutorial of how to download and install this version.
Feel free to comment if you have any questions about this tutorial.
After that, we'll discuss many new features included in this version, as the new "Save" option. Now you can save your specs in a file and restore in another location without deployment, just using OMW.
So, let's rock!
The first step is to download the DEMO version to your machine.
Go to http://edelivery.oracle.com/ click Continue
1. Media Pack Search
Choose JDEdwards Enterprise One and your platform


Click the first option: JDEdwards Enterprise…