‎2009 Jan 15 7:08 AM
Hi All,
I have a issue and sincerely hope someone of you can help me. I need to download data in XML format. Are there any FM available for this or any other way i can do it.
Thanks n Regards
Kaushik
Search before posting , there are number of threads with the similar questions
also use meaningful subject for your future questions
Edited by: Vijay Babu Dudla on Jan 15, 2009 4:36 AM
‎2009 Jan 15 7:17 AM
Hi.. try with this code.
TYPES: BEGIN OF ty_xml,
string TYPE string,
END OF ty_xml.
DATA: it_xml TYPE TABLE OF ty_xml,
wa_xml TYPE ty_xml.
DATA: file TYPE string,
result TYPE xstring.
DATA itab TYPE vbak OCCURS 0.
DATA wa_itab TYPE vbak.
DATA: xml TYPE string.
PARAMETERS : dl RADIOBUTTON GROUP a,
up RADIOBUTTON GROUP a.
PARAMETERS : pa_file(128) DEFAULT 'C:\test.xml'.
START-OF-SELECTION.
file = pa_file.
CASE 'X'.
WHEN dl.
SELECT * FROM vbak UP TO 1 ROWS
INTO CORRESPONDING FIELDS OF TABLE itab.
CALL TRANSFORMATION id
SOURCE itab = itab
RESULT XML xml.
MOVE xml TO wa_xml-string.
APPEND wa_xml TO it_xml.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = file
filetype = 'ASC'
CHANGING
data_tab = it_xml[]
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
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
WHEN up.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = file
filetype = 'ASC'
CHANGING
data_tab = it_xml[]
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19
.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
LOOP AT it_xml INTO wa_xml.
MOVE wa_xml-string TO xml .
ENDLOOP.
CALL TRANSFORMATION id
SOURCE XML = xml
RESULT itab = itab[].
BREAK-POINT.
LOOP AT itab INTO wa_itab.
WRITE: / wa_itab-vbeln, wa_itab-auart.
ENDLOOP.
ENDCASE.
‎2009 Jan 15 7:12 AM
Hi,
Try using the Function Module : SWF_ABAP_TO_XML
Hope it helps u.
Thanks & Regards
‎2009 Jan 15 7:14 AM
1. Search the forum before posting the query.
2. Use more meaningful and relevant title.
3. You can still do the search this question is asked several time before also, so you will get god help.
‎2009 Jan 15 7:14 AM
‎2009 Jan 15 7:15 AM
use meaningful subject in future
use this function module.
SAP_CONVERT_TO_XML_FORMAT
‎2009 Jan 15 7:16 AM
search on sdn as this question has been repeatedly answered so do make use of the search functionalty provided to u.
Edited by: Nikita Jain on Jan 15, 2009 12:47 PM
‎2009 Jan 15 7:17 AM
Hi.. try with this code.
TYPES: BEGIN OF ty_xml,
string TYPE string,
END OF ty_xml.
DATA: it_xml TYPE TABLE OF ty_xml,
wa_xml TYPE ty_xml.
DATA: file TYPE string,
result TYPE xstring.
DATA itab TYPE vbak OCCURS 0.
DATA wa_itab TYPE vbak.
DATA: xml TYPE string.
PARAMETERS : dl RADIOBUTTON GROUP a,
up RADIOBUTTON GROUP a.
PARAMETERS : pa_file(128) DEFAULT 'C:\test.xml'.
START-OF-SELECTION.
file = pa_file.
CASE 'X'.
WHEN dl.
SELECT * FROM vbak UP TO 1 ROWS
INTO CORRESPONDING FIELDS OF TABLE itab.
CALL TRANSFORMATION id
SOURCE itab = itab
RESULT XML xml.
MOVE xml TO wa_xml-string.
APPEND wa_xml TO it_xml.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = file
filetype = 'ASC'
CHANGING
data_tab = it_xml[]
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
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
WHEN up.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = file
filetype = 'ASC'
CHANGING
data_tab = it_xml[]
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19
.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
LOOP AT it_xml INTO wa_xml.
MOVE wa_xml-string TO xml .
ENDLOOP.
CALL TRANSFORMATION id
SOURCE XML = xml
RESULT itab = itab[].
BREAK-POINT.
LOOP AT itab INTO wa_itab.
WRITE: / wa_itab-vbeln, wa_itab-auart.
ENDLOOP.
ENDCASE.
‎2009 Jan 15 9:20 AM
Hi..
The download option is giving exception 15 - Access Denied.
Regards
‎2009 Jan 15 7:18 AM
Hi
go to se37
ctrl+F
type XML
execute
there are lot of FM s will display choose appropriate one
regards
sateesh
‎2009 Jan 15 7:24 AM
Hi,
try these below Funtion Modules,
TEXT_CONVERT_CSV_TO_SAP
TEXT_CONVERT_TEX_TO_SAP
TEXT_CONVERT_TXT_TO_SAP
TEXT_CONVERT_XLS_TO_SAP
TEXT_CONVERT_XML_TO_SAP
Regards,
Anki Reddy