02-23-2010 2:30 AM
Hi All,
Is it possible to download Table data into file(.xls or xml). is there any FM to od this kind of download. For example, if i enter the table name i need all the data in table as output.
Thanks & Regards
Arun
02-23-2010 2:36 AM
Hi,
you can use XML transformation CONVERT_XML_INT_TO_EXT (CALL TRANSFORMATION). It takes variable and it returns XML. To import back you can use transformation CONVERT_XML_EXT_TO_INT.
Cheers
02-23-2010 2:47 AM
Hello,
<li>In ECC 6.O , We have the following function modules to handle XML or XLS data.
SAP_CONVERT_TO_XML_FORMAT
TEXT_CONVERT_XML_TO_SAP
I hope that those help you.
Thanks
Venkat.OSAP_CONVERT_TO_XLS_FORMAT
TEXT_CONVERT_XLS_TO_SAP
02-23-2010 3:57 AM
Hi Arun,
For XML download you can go in with the suggestions given by others(above).
Why not use the Table Browser SE16 and download all the data in '.XLS' format ?
Regards,
Abhijit G. Borkar
02-23-2010 12:47 PM
Hi...
go to Transaction SE11 and execute the table which will give all the entries. go to EDIT....> DOWNLOAD. like this we can down load the table contents in the format what we want.
or use the below solution.
write a Zprogram with selcetion-screen parameter as table name.
write a select query to retrieve all the entries present in the Table and then use FM" GUI_DOWNLOAD" to down load data in to required format..
Regards,
Lokeswari.
02-23-2010 3:18 PM
REPORT ztable_download.
PARAMETERS: table LIKE dd02d-tabname,
file(50) LOWER CASE.
DATA: code(72) OCCURS 10,
w_code(72),
prog(8),
msg(120),
lin(3),
wrd(10),
off(3).
DATA: BEGIN OF rectest,
tprec(1) VALUE '0',
nometab(16),
utente(20),
data(10),
ora(8),
END OF rectest.
DATA: BEGIN OF recdett,
tprec(1) VALUE '1',
tab LIKE table,
END OF recdett.
DATA: BEGIN OF rectot,
tprec(1) VALUE '2',
tot(9),
END OF rectot.
OPEN DATASET file FOR OUTPUT IN TEXT MODE.
rectest-nometab = table.
rectest-utente = sy-uname.
rectest-data = sy-datum.
rectest-ora = sy-uzeit.
TRANSFER rectest TO file.
APPEND 'PROGRAM SUBPOOL.' TO code.
CONCATENATE 'TABLES ' table '.' INTO w_code SEPARATED BY space.
APPEND w_code TO code.
APPEND 'FORM DYN1 USING FILE.' TO code.
CONCATENATE 'SELECT * FROM ' table '.'
INTO w_code SEPARATED BY space.
APPEND w_code TO code.
CONCATENATE 'TRANSFER ' table ' TO FILE.'
INTO w_code SEPARATED BY space.
APPEND w_code TO code.
APPEND 'ENDSELECT.' TO code.
APPEND 'ENDFORM.' TO code.
GENERATE SUBROUTINE POOL code NAME prog
MESSAGE msg LINE lin WORD wrd OFFSET off.
IF sy-subrc <> 0.
WRITE: / 'Error during generation in line', lin,
/ msg,
/ 'Word:', wrd, 'at offset', off.
ELSE.
PERFORM dyn1 IN PROGRAM (prog) USING file.
WRITE: / 'Esportati ',sy-dbcnt,' records.'.
ENDIF.
02-23-2010 9:09 PM
For Excel
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = vl_filename
filetype = 'ASC'
write_field_separator = 'X'
TABLES
data_tab = it_variant
fieldnames = it_var_fname
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.
ENDIF.
02-23-2010 9:13 PM
Also use:-
XML:-
SAP_CONVERT_TO_XML_FORMAT
TEXT_CONVERT_XML_TO_SAP
Excel:-
SAP_CONVERT_TO_XLS_FORMAT
TEXT_CONVERT_XLS_TO_SAP
Or Goto SE16
Select all records
Seect menu button ' Download'
I hope it will helps you
02-25-2010 2:43 PM
Hi Arun,
My info is similar to Lokeswari Bandaru, but my answer can be more usefull.
go to tr: SE11, select table you want to download and make a search.
Go to SETTING --> User Parameters and select 'Alv grid display'
Now, you can hide columns that you don´t need download.
Click 'Local file' icon to download file.
I hope, this is usefull for you.
Regards.