-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbi-to-email.pcode
More file actions
27 lines (21 loc) · 835 Bytes
/
bi-to-email.pcode
File metadata and controls
27 lines (21 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import PSXP_RPTDEFMANAGER:*;
/* generate report */
&reportDefn = create PSXP_RPTDEFNMANAGER:ReportDefn("REPORT_NAME");
&reportDefn.Get();
&promptRec = &reportDefn.GetPSQueryPromptRecord();
If &promptRec <> Null Then
/* set prompt record key(s) */
&reportDefn.SetPSQueryPromptRecord(&promptRec);
&promptRec.FIELD.Value = "VALUE";
End-If;
&reportDefn.OutDestination = "/tmp";
&reportDefn.ReportFileName = "TEST";
&reportDefn.ProcessReport("", "ENG", %Date, "PDF");
&reportDefn.Publish("", "", "tmp", 0);
/* send as email (deprecated, use MCFOutBoundEmail class) */
&ret = SendMail(0, "test@example.com", "", "", "Test Subject", "Test body.", "/tmp/TEST.pdf", "BI Publisher Doc");
If &ret = 0 Then
MessageBox(0, "", 0, 0, "Message Sent.");
Else
MessageBox(0, "", 0, 0, "Error: no mail interface installed.");
End-If;