The abap code snippet below shows you how to download data from an internal table into a file on the sap application server. Use the OPEN and CLOSE dataset abap commend.
*Download internal table to Application server file(Unix) DATA: it_datatab type STANDARD TABLE OF ekko, wa_datatab like LINE OF it_datatab. DATA: e_file like rlgrap-filename value '/usr/sap/tmp/file.txt'. *Creates file if does not exist open dataset e_file for output in text mode ENCODING default. "Encoding is required in later systems lOOP AT it_datatab into wa_datatab. transfer wa_datatab to e_file. ENDLOOP. close dataset e_file.