Friday, June 14, 2019

NAV - How to create a silent export XMLPort

Name DataType Subtype Length
POXMLFile File
XMLStream OutStream
IsExported Boolean
FromFile Text
ToFile Text
POStat Record PO Status
TheFileName Text



  //Create File
  TheFileName :=  POStat."PO Number" +'-'+ DATE2YYYYMMDD(POStat."PO Order Date")+ '.xml';
  POXMLFile.CREATE(XMLTemplate."Output File Location" + TheFileName);
  POXMLFile.CREATEOUTSTREAM(XMLStream);
  IsExported := XMLPORT.EXPORT(XMLPORT::"PO Export XML", XMLStream,POStat);
  POXMLFile.CLOSE;
 
IF IsExported THEN
BEGIN
  MESSAGE( TheFileName   + ' Exported to XML');
END
ELSE
  MESSAGE(Text001);

No comments:

Post a Comment