How to produce report with a PDFNAME from a variable - Forms/Reports 6i
259480Nov 10 2008 — edited Nov 11 2008A simple problem but I can't see my way through it. This is in forms and reports 6i. I'm sure I've missed something simple.
I have a report named MDD_REP called by a button press from forms that produces a detailed PDF of the current forms item (MDD_NO). When the report is run, the pdf is saved, but it is named MDD.PDF. Since I have many pdf's to generate, I would like each one to be named by the MDD_NO. Below is the procedure I am using to call the report. The pdf name should come from the variable :Q_MDD_MAIN.MDD_NO. Can someone please tell me what I am doing wrong. I would also like to specify a default directory to collect all the PDF'S
No error messages are produced when the form is run or the button clicked. When I check the Reports Background engine I get the following message
Starting report MDD_REP [Mon Nov 10 17:06:12 2008] ...
End report MDD_REP [Mon Nov 10 17:06:12 2008].
But if I search the drive for any new file, no report can be found anywhere.
Please help
Thanks, Glenn
-- RUN_WELL_REPORT
-- Built-in: RUN_PRODUCT
PROCEDURE RUN_MAKE_PDF IS
pl_id ParamList;
pdfname VARCHAR2(16);
BEGIN
-- Check to see if the 'tmpdata' parameter list exists.
pl_id := Get_Parameter_List('tmpdata');
pdfname := :Q_MDD_MAIN.MDD_NO;
-- If it does, then delete it before we create it again in
-- case it contains parameters that are not useful for our
-- purposes here.
IF NOT Id_Null(pl_id) THEN
Destroy_Parameter_List( pl_id );
END IF;
-- Create the 'tmpdata' parameter list afresh.
pl_id := Create_Parameter_List('tmpdata');
-- Add a data parameter to this parameter list
-- Add or remove comments to change the destination and actions of the report
Add_Parameter(pl_id, 'DESTYPE', TEXT_PARAMETER, 'FILE'); -- set to preview mode
Add_Parameter(pl_id, 'DESNAME', TEXT_PARAMETER, PDFNAME);
Add_Parameter(pl_id, 'DESFORMAT', TEXT_PARAMETER, 'PDF'); -- set to preview mode
Add_Parameter(pl_id, 'PARAMFORM', text_parameter, 'NO'); -- no parameter form required
-- Run the report synchronously, passing the parameter list.
-- If there is some delay in printing, then print the report ASYNCHRONOUS
Run_Product(REPORTS, 'C:\MDD_DATA_ENTRY\MDD_REP', SYNCHRONOUS, RUNTIME,
FILESYSTEM, pl_id, NULL);
END;