Purpose With AppendFile you can append a new record to a file, e.g. in order to fill a table with SAP ERP data for later use in Excel.

It is also possible to specify a second file. This file is copied to the first one, and all GuiXT variables in each line are replaced with their current values.

Example AppendFile “X:GuiXTFiles\MatDes.txt” s_matnr s_text s_unit s_price

The value of the variables &[s_matnr] &[s_text] &[s_unit] &[s_price] is concatenated to a single record. The values are separated by the delimiter specified in the OpenFile command (Delimiter=, default delimiter is the tab).

Looking at the example, assume that &[s_matnr]= 10000120 &[s_text]= Screw &[s_unit]= ST &[s_price]= 0.02 and that the delimiter is ‘;’. The new file record is


Format AppendFile “filename” var1 var2 var3 …

Up to 60 variables are possible (before GuiXT version 2009 Q1 2: 20 variables).

AppendFile “filename” template=templatefile”

The template file is copied and all GuiXT variables &[...] are replaced with their current values.

& Tricks
See Special Topics File handling in InputScripts for a detailed example.