‎2006 Feb 03 6:17 AM
Hi,
Iam using GUI_DOWNLOAD for downloading certain texts,its working fine.now i need to include the header(i'e) some text say 'This is a error file'at the top.how can i do this?
‎2006 Feb 03 6:27 AM
Hi swaminathan,
1. simple
2. use this code (just copy paste)
REPORT abc.
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
SELECT * FROM t001 INTO TABLE t001.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'd:\t001.txt'
TABLES
data_tab = t001.
*----
IMPORTANT
INSERT 'This is an error File'
INTO t001 INDEX 1.
BREAK-POINT.
regards,
amit m.
‎2006 Feb 03 6:27 AM
Hi swaminathan,
1. simple
2. use this code (just copy paste)
REPORT abc.
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
SELECT * FROM t001 INTO TABLE t001.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'd:\t001.txt'
TABLES
data_tab = t001.
*----
IMPORTANT
INSERT 'This is an error File'
INTO t001 INDEX 1.
BREAK-POINT.
regards,
amit m.
‎2006 Feb 03 6:30 AM
Hi,
You have to use GUI_DOWNLOAD twice. In the first call to GUI_DOWNLOAD, Open the file & pass header data internal table.
In the second call to GUI_DOWNLOAD open the same file in APPEND mode & pass the internal table line item data.
Best regards,
Prashant
Message was edited by: Prashant Patil
‎2006 Feb 03 6:43 AM
Hello Swaminathan,
For downloading you have the std FM GU_DOWNLOAD. You can append the first line as you want followed by rest of texts. For this the internal table should have the field as one continuous char.
With this u have to download it only once.
‎2006 Feb 03 6:43 AM
REPORT ZTEST12347 .
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
END OF ITAB.
SELECT VBELN
POSNR
FROM VBAP
UP TO 20 ROWS
INTO TABLE ITAB.
DATA: IT_LINE LIKE TLINE OCCURS 0 WITH HEADER LINE.
IT_LINE-TDLINE = 'this is error file'.
append it_line.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:test.txt'
TABLES
DATA_TAB = IT_LINE
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:test.txt'
APPEND = 'X'
TABLES
DATA_TAB = ITAB
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
‎2006 Feb 03 6:44 AM