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

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-Delivery Directory preparation Oracle 11g 32 bit installation JDE Demo installation Post installation procedures System 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 se

Tools Release 9.2.2.4

A new experience on www.innova9.io!

After almost a year, a new and redesigned web site for Innova9. With this new website, we'll be able to communicate better, educate better, and we launch a new initiative for integrations: We'are now Dell Boomi's Partner and we can build seamless integrations for on-prem, Cloud and hybrid business scenarios using JD Edwards' Orchestrator and the versatility of Dell Boomi. Also, we're launching our Products section, starting small with our JD Edwards' Sandbox installation and hosting as well as our Orchestrator Masterclass. There's more to come! Take a look at our Services: all focused on EnterpriseOne innovations, from UX One Enablement, to our new Online Help Desk, where we'll serve your Business Analysts, Power Users, and End Users with instant messages to help with UX and User Defined Objects activities. All in a super affordable price, available per user / per month on subscription base. Want more? Our articles now have a new place! Started with