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: 

Converting the mail body data into proper text

jagesh_lakdawala
Active Participant
0 Kudos

Hi Experts,

My requirement is to read the email Body data (available in Internal Table format as shown below) into the proper text (STRING format).

Email body may contain multiple lines which I want to concatenate and want to have single string Variable in my program.

In the above screen shot, I can see ## separator is being used for identifying the next line.

I think instead of parsing these data manually there must be some standard SAP given FM which give us the proper text in STRING format.

internal table which contains the input data is of format SOLI_TAB (line Type SOLI).

The below is the coding which I have used to read the email body text.

Regards,

Jagesh

3 REPLIES 3

jagesh_lakdawala
Active Participant
0 Kudos

Hi Experts,

please do the needful.

Regards,

Jagesh

0 Kudos

Hi Jaheshm

this is quite basic: The hash symbol # is used by ABAP to print or show a charcter which is not printable or displayable. Usually this is a control character like tabulator, linefeed and so on.

ABAP identifies such characters as attributes defined in class CL_ABAP_CHAR_UTILITIES, i.e. CL_ABAP_CHAR_UTILITIES=>horizontal_tab etc. Check the class for all defined attributes, try to remove (replace with'') in the mail body.

Probably the # are tabs to get some kind of formattting you will lose.

Regards,

Clemens

Tomas_Buryanek
Active Contributor
0 Kudos

Try call get_body_part_content method with parameter IV_PREFER_TEXT = 'X'. This will probably take care of "newline" in output.

Or check CONT_HEX instead of CONT_TEXT, where you can find binary representation of "newline" (CR+LF..) and filter them manualy.

Also you can check class CL_BCS_CONVERT, where you can find useful methods to convert SOLI, SOLIX, string, xstring etc. data.

-- Tomas --