on 02-06-2012 8:40 PM
Hi all
I need to download the full SRM Catalog structure together with all details from SRM to logcal XML file.
I've checked all around here on SDN but have not comed up with a clear solution...
One of these were : http://forums.sdn.sap.com/thread.jspa?threadID=1217084
My concern is more or less UNICODE..
So far I have tested this
- I have a deep structure with all the data about the Catalog structure <t_dyntable>
- then I try to convert this contents into UTF-8. By doing this I will get some of the special characters to show up as they should ( it think one of those were .amp that were successfully translated to &)
- Then CALL TRANSFORMATION were done to get the XML-file
Below you can see some different way's I have tried... Trying to use XSTRING.... and download via type BIN for GUI_DOWNLOAD. My starting point was with UTF-16, but with that I could not read the XML file at all - With UTF-8 I can read it but still as soon as some kind of special sign shows up the XML-editor complains about - Not allowed letter. Please help
Best regards
Henrik
data: g_ixml type ref to if_ixml,
g_stream_factory type ref to if_ixml_stream_factory,
g_encoding type ref to if_ixml_encoding,
ostream type ref to if_ixml_ostream.
data: v_encoding TYPE abap_encoding.
DATA xml_xstring TYPE xstring.
constants: encoding type string value 'utf-8'.
v_encoding = encoding.
g_ixml = cl_ixml=>create( ).
g_stream_factory = g_ixml->create_stream_factory( ).
g_encoding = g_ixml->create_encoding( character_set = encoding
byte_order = 0 ).
ostream = g_stream_factory->create_ostream_xstring( string = xml_xstring ).
ostream->set_encoding( encoding = g_encoding ).
CALL TRANSFORMATION Z_TRNS_CCM_TO_MDM_TRY
SOURCE ITEMS = <t_dyntable>
OPTIONS xml_header = 'FULL'
RESULT XML ostream.
* Convert XString to String
data: loc_conv type ref to CL_ABAP_CONV_IN_CE,
loc_xstring type xstring,
loc_string type string.
CALL METHOD CL_ABAP_CONV_IN_CE=>CREATE
EXPORTING
INPUT = xml_xstring
ENCODING = 'UTF-8'
REPLACEMENT = '?'
IGNORE_CERR = ABAP_TRUE
RECEIVING
CONV = loc_CONV.
TRY.
CALL METHOD loc_CONV->READ
IMPORTING
DATA = xml_string.
CATCH CX_SY_CONVERSION_CODEPAGE.
*-- Should ignore errors in code conversions
CATCH CX_SY_CODEPAGE_CONVERTER_INIT.
*-- Should ignore errors in code conversions
CATCH CX_PARAMETER_INVALID_TYPE.
CATCH CX_PARAMETER_INVALID_RANGE.
ENDTRY.
*****************
data xstring type xstring.
types: BEGIN OF ldata,
f(5000) type x, "(2556) type x,
END OF ldata.
data table type table of ldata.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = xml_xstring
* APPEND_TO_TABLE = ' '
* IMPORTING
* OUTPUT_LENGTH =
tables
binary_tab = table
.
*****************
* CALL TRANSFORMATION Z_TRNS_CCM_TO_MDM_TRY
* SOURCE ITEMS = <t_dyntable>
** OPTIONS xml_header = 'NO'
* OPTIONS xml_header = 'FULL' "
* RESULT XML xml_string.
REFRESH GT_ITAB.
CLEAR <t_dyntable>.
REFRESH <t_dyntable>.
APPEND xml_string TO gt_itab.
IF FILE_LO IS INITIAL.
FILE_LO = 'C:\TEMP'.
ENDIF.
concatenate FILE_LO '\item_list_' lv_pack_count_string '.xml' into gs_file.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = gs_file
* FILETYPE = 'BIN'
CHANGING
data_tab = gt_itab
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.
Hi,
You could look at the note 1376770 which provides a migration tool from CCM -> MDM, perhaps this will be of help to you?
Regards,
Jason
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi again
With coding above the download xml-file will contain
& : is interpreted as & in the xml-editor = OK
BUT the file contains other special signs that do not work:
± : is not interpreted ok. XML-editor will stop analyzing the file = NOT OK
Do you know if I could use another way of codepage or something to also handle these special signs.
Best reg
Henrik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.