Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

HOW TO SAVE THE FLAT FILE.

Former Member
0 Kudos

Hi Exports,

Flat file comes to our Internal table.then i build our logic.After that i wann to save this flat file is some location(may be in presentation/ application server).that to file name along with date,time and location.agin i run the pgm and save same location and file name is also same.

here iam giving file format.

emp no file name location.

1 XXX h:\kkk.txt

2

3

4

5

again i am running same pgm

emp no file name location.

6 XXX h:\kkk.txt

7

8

9

10

file name and location same but diff emp no.

Regards,

Krishna.

1 ACCEPTED SOLUTION

former_member588853
Active Contributor
0 Kudos

Hi,

Use GUI_DOWNLOAD function module and pass your internal table and the path where to save..

CALL FM 'GUI_DOWNLOAD'

importing

FILENAME = 'C:\default\test

filetype = 'ASC'

tables

data_itab = it_itab..

reward if useful

regards,

nazeer

Message was edited by:

nazeer shaik

2 REPLIES 2

former_member588853
Active Contributor
0 Kudos

Hi,

Use GUI_DOWNLOAD function module and pass your internal table and the path where to save..

CALL FM 'GUI_DOWNLOAD'

importing

FILENAME = 'C:\default\test

filetype = 'ASC'

tables

data_itab = it_itab..

reward if useful

regards,

nazeer

Message was edited by:

nazeer shaik

Former Member
0 Kudos

Hi Krishna Kumar,

if u wnat to download in to presentation server..

then use GUI_DOWNLOAD.

if u want to save in application server (in AL11) then u need to use

open data set...


  DATA : dl_string(250).           " String
*--Open data set
    OPEN DATASET dg_filename FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc <> 0.
      dg_subrc = sy-subrc.
    ELSE.
*--Transfer data
      DO.
        READ DATASET dg_filename INTO dl_string.
        IF sy-subrc = 0.
          APPEND dl_string TO dt_data.
          CLEAR  dl_string.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
*--Close data set
      CLOSE DATASET dg_filename.
    ENDIF.