09-28-2006 9:12 AM
hi jay
i have to download entire 200 fields in to csv format.the path will be in selection screen.
09-28-2006 9:14 AM
U can use gui_download function module to meet your requirements. ...Collect all the information in an internal table and pass the same to the above FM.
As, you specifically need it to be CVS..you can apply the below logic.
itab-> internal table having the data you wish to download.
loop at itab.
Clear lchr.
DO.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE itab TO <F>.
IF SY-SUBRC <> 0. EXIT.
ELSE.
if sy-index = 1.
lchr = <F>.
else.
concatenate lchr <F> into lchr separated by ','.
endif.
ENDIF.
ENDDO.
move lchr to itext-line.
append itext.
endloop.
call function 'GUI_DOWNLOAD'
exporting
filename = pfile
filetype = 'ASC'
tables
data_tab = itext.
09-28-2006 10:11 AM
hi,
Use both these FM ...
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = ','
TABLES
i_tab_sap_data = li_itab
CHANGING
I_TAB_CONVERTED_DATA = i_final
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 = ld_filename
filetype = 'DAT'
write_field_separator = 'X'
CONFIRM_OVERWRITE = 'X'
TABLES
data_tab = i_final[]
EXCEPTIONS
file_open_error = 1
file_write_error = 2
OTHERS = 3.
Regards,
09-28-2006 10:16 AM
Hi,
go through this link...
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.
Regards
Sudheer
09-28-2006 10:28 AM