Wednesday, February 25, 2009

XMLport sample usage

XMLport definition:






On XMLport properties, change "Format/Evaluate" to "XML Format/Evaluate" so that numeric values will be exported without thousand separators

On properties of Customer-Element-Table: fill in LinkTable and LinkFields

(Optional) If you want to apply filter on certain table:
Put cursor on line with SourceType=Table
Open Properties
Fill SourceTableView \ Table Filter

Custom code on "Tonase - Export::OnBeforePassField()":
"Sales Invoice Header".CALCFIELDS("Total Weight")

Codeunit that run the XMLport:
// create the output file, and get its outstream...
MyOutputFile.CREATE(MyOutputFileName);
MyOutputFile.CREATEOUTSTREAM(MyOutputStream);

// set appropriate filters...
MyTable.SETFILTER("Absen Kirim",'010108..311208');
MyXMLPort.SETTABLEVIEW(MyTable);

// set the xml port destination, and run the xml port...
MyXMLPort.SETDESTINATION(MyOutputStream);
MyXMLPort.EXPORT;

// all done...
MyOutputFile.CLOSE;

Codeunit's variables and text constant:














Result:
















No comments:

Post a Comment