NAV 2013R2 Can an XMLport export be run without user intervention?

dmleroux
Member Posts: 3
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;
0
Best Answer
-
Hi,
Create the filenames yourself in code. Then look at this.
https://msdn.microsoft.com/en-us/library/hh166529(v=nav.90).aspx
Using streams there is no need to prompt the user for the file destination as it's already passed via the stream.Austrian NAV/BC Dev5
Answers
-
Hi,
Create the filenames yourself in code. Then look at this.
https://msdn.microsoft.com/en-us/library/hh166529(v=nav.90).aspx
Using streams there is no need to prompt the user for the file destination as it's already passed via the stream.Austrian NAV/BC Dev5 -
Thanks, I have a blind spot (still!) regarding streams0
-
You can use this:
OutFile.CREATE(XportFileName);
OutFile.CREATEOUTSTREAM(OutS);
Xport.FILENAME(XportFileName);
Xport.SETDESTINATION(OutS);
Xport.EXPORT;
OutFile.CLOSE;
Where
OutFile is FILE
OutS is OutStream
Regards.
0 -
Thanks, I have a blind spot (still!) regarding streams
It may help you more: dynamicslancer.blogspot.in/p/blog-page.html0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions