How to transfer data from internal table to application server in ABAP/4

Normally, when you want to transfer data the file to application server, you will
have 3 steps:

  1. Open file in application server by statement:

    OPEN DATASET file_name FOR OUTPUT IN TEXT MODE.
  2. Transfer data from file by statement:

    TRANSFER itab TO file_name. 
    Note: This statement should be in LOOP statement for Internal table
  3. Close file by statement:

CLOSE DATASET file_name.

Example


DATA: gv_dataset1(30) VALUE ’/temp/testfile.txt’.

OPEN DATASET gv_dataset1 FOR OUTPUT IN TEXT MODE.
LOOP AT i_tab.
  TRANSFER i_tab TO gv_dataset1.
ENDLOOP.
CLOSE DATASET gv_dataset1.

Post new comment