Hello,
We have a FDM batch processing process that is loading a couple files from our ERP overnight to our Essbase databases. At the end of the process, we have FDM email our team the Batch File Listing report. However, when FDM runs the report, the process isn't far enough along for the
report to confirm it finished successfully. The report is sent when batch process is still on Consolidating. Currently the script, which I have included below, is in the AftConsolidate step and if I put it in BefCheck, it doesn't run. I do have a validation rule in place. Do you know of a way to delay the running of the report a bit longer so I can receive a completed report? Any thoughts would be greatly appreciated.
Thank you.
Sub AftConsolidate(strLoc, strCat, strPer, strTCat, strTPer, strEntGroup)
If strLoc = "PLNGLVPAUTO" Then
'Declare local variables
Dim objReport1
Dim objConfig1
Dim objMsg1
Dim lngReportID1
Dim lngPublishType1
Dim strPublishPath1
Dim strFromAddress1
Dim strToAddress1
Dim strSubject1
Dim strEmailMsgLine1
Dim strSMTPServer1
'Initialize Variables
lngReportID1 = 424
lngPublishType1 = 31 'PDF
strPublishPath1 = API.DataWindow.Connection.PstrDirOutbox &
"\NightlyPLNLoad\" & adaptor & "\" &
API.POVMgr.PPOVLocation & ".pdf"
'Create the Report object
Set objReport1 = CreateObject ("upsWReportingDM.clsReportPublisher")
objReport1.mInitialize API
'Set Parameters
objReport1.mParametersClear
objReport1.mParametersAddNew "Period", PeriodKey
objReport1.mParametersAddNew "CatKey", RES.PlngCatKey
'Publish the Report
objReport1.mReportPublishToFile CLng(lngReportID1), CStr(strPublishPath1),
CLng(lngPublishType1)
'Web Client (Set API action properties)
RES.PlngActionType = 4 '(See Enumeration: ScriptActionTypes)
RES.PstrActionValue = strPublishPath1
'Initialize message content variables
strFromAddress1 = "FDMLoad@company.com"
strToAddress1 = "me"
strSubject1 = "Test Batch Report PLNGLVPAUTO Email"
strEmailMsgLine1 = "Test Batch Report PLNGLVPAUTO Emailing
Functionality"
'Initialize Mail Server Variables
'SMTP server name
strSMTPServer1 = "Smtp1.acxmailhosting.com"
'CdoSendUsing enumeration-1=use smtp on local machine, 2=use smtp over network
intSendUsing = 2
'SMTP port on server
intSMTPPort = 25
'Create CDO configuration object
Set objConfig1 = CreateObject ("CDO.Configuration")
'Set Config object settings
With objConfig1.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") =intSendUsing
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =strSMTPServer1
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= intSMTPPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")
= 10
.Update
End With
'Create CDO message object
Set objMsg1 = CreateObject("CDO.Message")
'Assign config object to configuration property of message object
Set objMsg1.Configuration = objConfig1
'Set Message object settings and send mail
With objMsg1
.To = strToAddress1
.From = strFromAddress1
.Subject = strSubject1
.TextBody = strEmailMsgLine1
.AddAttachment strPublishPath1
.Send
End With
'Destroy message objects
Set objMsg1 = Nothing
Set objConfig1 = Nothing
Set objReport1 = Nothing
End If
End Sub