‎2006 Jul 25 9:06 AM
Hi
I am trying to split a string that has the # character within it. I have tried using the # as a string and as the hex value 23, which is what is displayed when I display the string as it's hex value. I have successfully split using other hex values within the string but this one will not work.
My issue is that this is the output from the ostream when I set the pretty print to on - which I require to format the XML document correctly for the spool. It would be perfect if it would just split where it's told to!!
Below is a snippet of the string and the hex values.
<pack_type>EMAIL</pack_type># <customer/># <print_destn>email</print_destn>
3C7061636B5F747970653E454D41494C3C2F7061636B5F747970653E23203C637573746F6D65722F3E23203C7072696E745F646573746E3E656D61696C3C2F707269
If anyone has any experience of the ABAP XML classes, It would be great to hear from you!!
Cheers
Ian
‎2006 Jul 25 9:31 AM
Hi,
Try using the class
CL_ABAP_CHAR_UTILITIES.
Regards,
Shashank
‎2006 Jul 25 9:31 AM
Hi,
Try using the class
CL_ABAP_CHAR_UTILITIES.
Regards,
Shashank
‎2006 Jul 25 9:35 AM
Hi Ian,
The problem with Strings is that it intenally treats SPACE with # & hence we cannot split at this character. You can use Overlay to transform # to some other character say '.' & then try splitting it at '.'...c if it works.....well dnt have much to say about ABAP XML....
‎2006 Jul 25 9:44 AM
Hello,
Do like:
split data at CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB into itab.
regards,
Naimesh
‎2006 Jul 25 9:45 AM
hi,
Do this
SPLIT data_string
AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
INTO TABLE itab.
itab is table with the structure
begin ty_itab
field type char100
end ty_itab.
‎2006 Jul 25 10:03 AM
Ah, sorry guys, I forgot to mention that I'm on a 4.6C system and do not have the luxury of CL_ABAP_CHAR_UTILITIES.
None of the search, overlay or translate keywords can see the character either.
I have tried writing the string to a char8000 field but no joy either.
‎2006 Jul 25 10:48 AM
Hello,
Do like this,
CONSTANTS: con_tab TYPE x VALUE '09'.
Split data at con_tab into itab.
Regards,
Naimesh
‎2006 Jul 25 2:39 PM
Ok. Sorted. I output the XML to my pc using the following:
Saving the XML document
l_xml_size = l_ostream->get_num_written_raw( ).
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = l_xml_size
filename = 'H:\test.xml'
filetype = 'BIN'
CHANGING
data_tab = l_xml_table
EXCEPTIONS
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.
and then opend the test.xml file with a hex editor. The character # that the ABAP editor had shown as 23 in the hex display was in fact 0A - a linefeed. Documentation on the method set_pretty_print of the ostream interface says the pretty print using a space or tab. Thanks for that SAP - very misleading and wasted a lot of time!!
Still sorted now.
Thanks to all for their help.
Ian
‎2016 Sep 21 8:30 AM