Friday, June 7, 2019

NAV - How to create an XMLPort to export a PO

http://dynamicslancer.blogspot.com/2016/09/how-to-use-xmlport-to-create-file-in.html

  • Create Codeunit to execute XMLPort
ExportPOXML(PO : Text[50])
POHdr.SETFILTER("No.",PO);
IF POHdr.FINDFIRST THEN BEGIN
  POXMLFile.CREATE(TEMPORARYPATH + 'PO.xml');  
  POXMLFile.CREATEOUTSTREAM(XMLStream);  
  IsExported := XMLPORT.EXPORT(XMLPORT::"PO Export XML", XMLStream,POHdr);  
  FromFile := POXMLFile.NAME;  
  ToFile := 'VendorPO.xml';  
  POXMLFile.CLOSE;  
END;
IF IsExported THEN  
BEGIN  
  DOWNLOAD(FromFile,'Download file','C:\Temp','Xml file(*.xml)|*.xml',ToFile);  
  ERASE(FromFile);  
  MESSAGE(Text000);  
END  
ELSE  
  MESSAGE(Text001);  
  • Create Button on Page to call codeunit and pass current record
Export PO to XML - OnAction()
Sub.ExportPOXML(Rec."PO Number");

1 comment:

  1. Hi,

    Can you please tell me on how to do setup to fetch POS sales Transaction from HO on POS..

    There is one default web service that is Get_Transaction but it is not working. which POS button need to add to fetch Transaction information from HO server

    ReplyDelete