2011 Jan 31 10:44 AM
HI
While converting the internal table data into a XML and save it into Application server I am using the Function module SCMS_BINARY_TO_XSTRING.
At the last i am getting Junk characters.So i am not able to open the file. If i delete the last junk characters i am able to open the file.
Let me know how to eliminate the Junk characters or use any other Function module.
Many Thanks in Advance.
Dinesh Kumar
HI
While converting the internal table data into a XML and save it into Application server I am using the Function module SCMS_BINARY_TO_XSTRING.
At the last i am getting Junk characters.So i am not able to open the file. If i delete the last junk characters i am able to open the file.
Let me know how to eliminate the Junk characters or use any other Function module.
Many Thanks in Advance.
Dinesh Kumar
2011 Jan 31 10:50 AM
Hi Dinesh,
Have you tried using CALL TRANSFORMATION statement or FM SAP_CONVERT_TO_XML_FORMAT.
There are lot of examples for the both, given below are two of them;
Regards,
Karthik D
2011 Jan 31 11:11 AM
Sample program:
data: it_html type standard table of w3html with header line,
it_sflight type table of sflight with header line,
it_fcat type lvc_t_fcat with header line,
v_lines type i,
field(40).
field-symbols <fs> type any.
start-of-selection.
select * from sflight
into table it_sflight
up to 20 rows.
end-of-selection.
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'SFLIGHT'
changing
ct_fieldcat = it_fcat[]
exceptions
inconsistent_interface = 1
program_error = 2.
delete it_fcat where fieldname = 'MANDT'.
it_html-line = '<html>'.
append it_html.
clear it_html.
it_html-line = '<thead>'.
append it_html.
clear it_html.
it_html-line = '<tr>'.
append it_html.
clear it_html.
it_html-line = '<td><hl> Flight details </hl></td>'.
append it_html.
clear it_html.
it_html-line = '</tr>'.
append it_html.
clear it_html.
it_html-line = '</thead>'.
append it_html.
clear it_html.
it_html-line = '<table boarder = "l">'.
append it_html.
clear it_html.
it_html-line = '<tr>'.
append it_html.
clear it_html.
loop at it_fcat.
concatenate '<th bgcolor = "green" fgcolor = "black">' it_fcat-scrtext_l '</th>' into it_html-line.
append it_html.
clear it_html.
endloop.
it_html-line = '</tr>'.
append it_html.
clear it_html.
describe table it_fcat lines v_lines.
loop at it_sflight.
it_html-line = '<tr>'.
append it_html.
clear it_html.
do v_lines times.
read table it_fcat index sy-index.
concatenate 'IT_SFLIGHT-' it_fcat-fieldname into field.
assign (field) to <fs>.
enddo.
it_html-line = '<td>'.
append it_html.
clear it_html.
it_html-line = '<fs>'.
append it_html.
clear it_html.
it_html-line = '</td>'.
append it_html.
clear it_html.
clear field.
unassign <fs>.
it_html-line = '</tr>'.
append it_html.
clear it_html.
endloop.
it_html-line = '</table>'.
append it_html.
clear it_html.
call function 'GUI_DOWNLOAD'
exporting
filename = 'C:\Flights.htm'
tables
data_tab = it_html
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 method cl_gui_frontend_services=>execute
exporting
document = 'C:\Flights.htm'
operation = 'OPEN'
exceptions
cntl_error = 1
error_no_gui = 2
bad_parameter = 3
file_not_found = 4
path_not_found = 5
file_extension_unknown = 6
error_execute_failed = 7
synchronous_failed = 8
not_supported_by_gui = 9
others = 10.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
Regards,
Uttam Agrawal
ht[http://uttambpt.blogspot.com|http://uttambpt.blogspot.com]
2011 Jan 31 11:31 AM
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |