PO Export issue using xml port

kamranshehzadkamranshehzad Member Posts: 165
Hi
I am facing a strange thing.
I have created a XML port to export the data into a file.

I am filtering out PurchaseHeader.Document Type = order using set range
and same with Purchase Lines but when it exports the data, it includes all lines of Purchase Lines table (39) and Range works fine for PurchaseHeader (38) table.

Any idea. Code follows.
IF EXISTS('C:\XML_PO_OUT.XML') THEN
    ERASE('C:\XML_PO_OUT.XML');

    PurchaseHeader.SETRANGE(PurchaseHeader."Document Type",PurchaseHeader."Document Type"::Order);
    PurchaseLine.SETRANGE(PurchaseLine."Document Type",PurchaseLine."Document Type"::Order);
    PurchaseHeader.SETFILTER(PurchaseHeader."No.",'104001');
    PurchaseLine.SetFilter(PurchaseLine."Document No.", '104001');

    TESTFILE.CREATE('C:\XML_PO_OUT.XML');
    TESTFILE.CREATEOUTSTREAM(TestStream);

    XP_PO.SETTABLEVIEW(PurchaseHeader);
    XP_PO.SETDESTINATION(TestStream);
     XP_PO.Export;

   // XMLPORT.EXPORT(123456753,TestStream);
    TESTFILE.CLOSE;
MESSAGE('PO Exported Successfully.');

Please suggest anything.

regards,
KS

Answers

Sign In or Register to comment.