Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Send special character by mail

martinborda
Explorer
0 Kudos

We are creating an XML spreadsheet that is sent by mail, and we are requested to show in a cell the special character Delta (u0394).

The overview of the process is the following:

- We create an XML file through IF_IXML interface, with enconding UTF-8 Little Endian.

- Then we render XML into an internal table.

- At last, we send the XML spreadsheet (the internal table) as an attached file by mail through SO_NEW_DOCUMENT_ATT_SEND_API1.

The problem we are facing is the following:

If we try to put Delta (u0394) as a character in a data tag (it's a variable of type String), SAP is turning it as '#', and not showing the character.


  DATA: o_cell TYPE REF TO if_ixml_element,
        o_data TYPE REF TO if_ixml_element,
        v_string TYPE string.

* Crea una celda
  o_cell = o_xmldoc->create_simple_element( name = 'Cell'
                                             parent = o_row ).

v_string = 'u0394'.

*   Crea un dato
    o_data = o_xmldoc->create_simple_element( name   = 'Data'
                                               parent = o_cell
                                               value  = v_string ).

When you open the file in Excel, the '#' character is shown instead of 'u0394'.

How can I show that Delta character (u0394) in the XML spreadsheet file I am sending?

Please tell me if more information is needed.

Thanks in advance,

Martin

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Try to use html entity instead --> greek capital letter delta --> &# 916;

Remove space after #.

Edited by: Simo Mertsola on Sep 15, 2009 1:54 PM

Edited by: Simo Mertsola on Sep 15, 2009 1:55 PM

5 REPLIES 5

Former Member
0 Kudos

Hi,

Try to use html entity instead --> greek capital letter delta --> &# 916;

Remove space after #.

Edited by: Simo Mertsola on Sep 15, 2009 1:54 PM

Edited by: Simo Mertsola on Sep 15, 2009 1:55 PM

0 Kudos

I tried like you said:


  DATA: o_cell TYPE REF TO if_ixml_element,
        o_data TYPE REF TO if_ixml_element,
        v_string TYPE string.
 
* Crea una celda
  o_cell = o_xmldoc->create_simple_element( name = 'Cell'
                                             parent = o_row ).
 
v_string = '& #916;'.                                           'Added a space in the middle to show the HTML entity code in the forum
                                               parent = o_cell
                                               value  = v_string ).

But SAP is tranforming my XML text to:

<Cell>&amp;#916;<Cell>

( &amp; is the HTML entity for '&')

How can I put Delta character so that SAP turns it in the right HTML entity &#916;

Or how can I manage so that the cell value generated is:

<Cell>&#916;<Cell>

Former Member
0 Kudos

&amp is entity for &

There should be no spaces in v_string, so remove space after &

v_string = '& #916;'.

0 Kudos

Thanks for your reply.

I put the space just to show the code here in the forum, it's not actually there in the code (it is commented, sorry if I wasn't that clear...).

The problem is that I cannot send to the XML the Delta symbol, or its html entity.

0 Kudos

Sorry, did'nt see your comment...

Don't know what is the default character set but you may try to change it.


l_rif_encoding type ref to if_ixml_encoding.

l_rif_encoding = l_rif_ixml->create_encoding( character_set = 'UTF-8' byte_order = 0 ).

CALL METHOD <yourstream>->SET_ENCODING
EXPORTING
ENCODING = l_rif_encoding.