Skip to Content
0
Former Member
Jan 11, 2006 at 04:36 PM

Dumping data from internal table to local file.

27 Views

Hi all,

Here is the sample code with which I am trying to write the contents of an internal table to a local file using ws_download function module.

The error it shows is : error when opening the download file.

please check the code and tell where i am going wrong.

REPORT zv_ittable_localfile.

DATA : BEGIN OF itab OCCURS 0 ,

carrid LIKE sflight-carrid,

connid LIKE sflight-connid,

fldate LIKE sflight-fldate,

END OF itab.

SELECT carrid connid fldate

INTO CORRESPONDING FIELDS OF TABLE itab

FROM sflight.

*loop at itab.

*write :/ itab-carrid,itab-connid,itab-fldate.

*endloop.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

FILENAME = 'C:/Documents and

Settings/nsi/Desktop/vijay'

FILETYPE = 'ASC'

MODE = ' '

TABLES

data_tab = itab

  • FIELDNAMES =

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_WRITE_ERROR = 2

.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

points will be awarded.

Regards,

Vijay.