I have a user who needs to convert posted sales invoices into XML files for submission to a payment processing company. Each invoice must be a separate XML file with a pdf attachment. By itself, this was no particular problem. The problem comes when they batch post 50 invoices and then want to create all the XML and PDF files in a batch. I can set the code up to handle this, but the XMLport insists on showing a request page and a save dialog - meaning someone needs to do 100 extra mouse clicks. Is there a way to avoid this?
If I try using "XMLport.RUN..." I can get rid of the request page, but it also means I can't set the destination file name nor add the attachment, and I still have the save dialog. And the file names must meet a specific format.
sample code:
PInvRec is the posted invoice header.
Xport is the XMLport
PInvRpt is the report to used in making the PDF attachment.
If I try using "XMLport.RUN..." I can get rid of the request page, but it also means I can't set the destination file name nor add the attachment, and I still have the save dialog. And the file names must meet a specific format.
sample code:
PInvRec is the posted invoice header.
Xport is the XMLport
PInvRpt is the report to used in making the PDF attachment.
PInvRec.SETRANGE("No.", InvNum); SRSetup.GET; IF PInvRec.FIND('-') THEN BEGIN XportFilename := SRSetup."Export Path" + 'Invoice' + PInvRec."Inv. Ref. No." +'.xml'; XportPDFName := SRSetup."Export Path" + 'Invoice' + PInvRec."Inv. Ref. No." +'.pdf'; PInvRpt.SETTABLEVIEW(PInvRec); PInvRpt.USEREQUESTPAGE(FALSE); PInvRpt.SAVEASPDF(XportPDFName); Xport.FILENAME(XportFilename); Xport.SETTABLEVIEW(PInvRec); Xport.SetAttachmentName('Invoice'+PInvRec."Inv. Ref. No." + '.pdf'); Xport.RUN; //here is where I want to save the user about 100 mouse clicks CLEAR(PInvRpt); CLEAR(Xport); END;