Here the code I used to apply the SaveAs Pdf functionality:
IF MESSAGEBOX('Save As PDF...','Do you want to SaveAs PDF:',question!,yesno!) = 2 THEN
RETURN
END IF
integer li_ret
string ls_projname, ls_projnum
//cch checking if there is data to convert if not just send a message
IF dw_4.rowcount() > 0 THEN
//cch construct the name of the PDF file
IF ISNULL(tab_1.tabpage_1.dw_1.object.bid_number[1]) OR TRIM(tab_1.tabpage_1.dw_1.object.bid_number[1]) = '' THEN
ls_projnum = 'No Name'
ELSE
ls_projnum = 'Proposal ' + TRIM(tab_1.tabpage_1.dw_1.object.bid_number[1])
END IF
ls_projname = trim(gstr_gen.map_padth)+ls_projnum+'.PDF'
dw_4.object.DataWindow.Export.PDF.Method = NativePDF!
//dw_4.Object.DataWindow.Export.PDF.NativePDF.ImageFormat = '1' //JPG
//===============
//cch call the SaveAs with PDF format
li_ret = dw_4.SaveAs(ls_projname, PDF!, True)
//cch check if the SaveAs was success or not
if li_ret = 1 then
//success
MESSAGEBOX('Save As PDF...','File was Generated as PDF.~rFile location: '+ls_projname)
Return
else
MESSAGEBOX('Save As PDF...','File was No Generated ~r' + String(li_ret))
Return
//...
end if
ELSE
MESSAGEBOX('Save As PDF...','There is no data to Save.~rError:.' + String(li_ret))
END IF
Also you have to consider if the name of the file has invalid caracters the file will not be created.
Hope this will help you.
Clarence.