2007 May 09 4:26 PM
hi.
I want transfer a internal table to a text file, how i can do it.
Thans.
Message was edited by:
ANDRES MOLDON
2007 May 09 4:43 PM
Hi,
Are you downloading to application server?
If you are then please use OPEN DATASET, TRANSFER and CLOSE DATASET statements.
Please check this link for sample code.
http://www.sapdevelopment.co.uk/file/file_downloadsap.htm
Regards,
Ferry Lianto
hi.
I want transfer a internal table to a text file, how i can do it.
Thans.
Message was edited by:
ANDRES MOLDON
2007 May 09 4:28 PM
Check this sample report.
REPORT ZTESTAA.
TYPE-POOLS:TRUXS.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN
LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
END OF ITAB.
DATA:
ITAB1 TYPE TRUXS_T_TEXT_DATA.
SELECT VBELN POSNR UP TO
10 ROWS FROM VBAP INTO TABLE ITAB.
*******
CALL FUNCTION
'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = ';'
TABLES
I_TAB_SAP_DATA = ITAB
CHANGING
I_TAB_CONVERTED_DATA = ITAB1
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 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.
***
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:TEMPtest.txt'
TABLES
DATA_TAB = ITAB1
EXCEPTIONS
OTHERS = 1.
If useful reward.
Vasanth
2007 May 09 4:31 PM
Hi,
Please check this link for sample codes to download internal table to either PC or application server.
http://www.sapdevelopment.co.uk/file/file_updown.htm
Regards,
Ferry Lianto
2007 May 09 4:31 PM
hi Andreas,
Use GUI_DOWNLOAD fm
DATA: ld_filename TYPE string,
ld_path TYPE string,
ld_fullpath TYPE string,
ld_result TYPE i.
* Display save dialog window
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
* window_title = ' '
DEFAULT_EXTENSION = 'XLS'
default_file_name = 'accountsdata'
INITIAL_DIRECTORY = 'c:temp'
CHANGING
filename = ld_filename
path = ld_path
fullpath = ld_fullpath
user_action = ld_result.
* Check user did not cancel request
CHECK ld_result EQ '0'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = ld_fullpath
filetype = 'ASC'
* APPEND = 'X'
write_field_separator = 'X'
* CONFIRM_OVERWRITE = 'X'
TABLES
data_tab = it_datatab[] "need to declare and populate
EXCEPTIONS
file_open_error = 1
file_write_error = 2
OTHERS = 3.http://www.sapdevelopment.co.uk/file/file_updownpop.htm
Regards,
Santosh
2007 May 09 4:40 PM
2007 May 09 4:51 PM
hi Andreas,
Ferry is Right !!!!!!!!! Use OPEN , TRANSFER AND CLOSE dataset in that case
Regards,
Santosh
2007 May 09 4:43 PM
Hi,
Are you downloading to application server?
If you are then please use OPEN DATASET, TRANSFER and CLOSE DATASET statements.
Please check this link for sample code.
http://www.sapdevelopment.co.uk/file/file_downloadsap.htm
Regards,
Ferry Lianto
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |