Application Development and Automation 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: 
Read only

Format text in mail content

Former Member
0 Likes
862

Hi all,

I am using the funtion module SO_NEW_DOCUMENT_ATT_SEND_API1 to send mail.

I want to format the text which i need to send in the mail content.

I dont have any attachments, message will be sent only throughthe mail body.

Im able to send all these below content...but its not coming in below requireed format.

Example: Mail body content should be like below format

-


vbeln

erdat

Matnr

-


123

xx

Mat-1

-


234

yy

Mat-2

-


Thanks in advance

jean liker

Hi all,

I am using the funtion module SO_NEW_DOCUMENT_ATT_SEND_API1 to send mail.

I want to format the text which i need to send in the mail content.

I dont have any attachments, message will be sent only throughthe mail body.

Im able to send all these below content...but its not coming in below requireed format.

Example: Mail body content should be like below format

-


vbeln

erdat

Matnr

-


123

xx

Mat-1

-


234

yy

Mat-2

-


Thanks in advance

jean liker

6 REPLIES 6
Read only

Former Member
0 Likes
816

Hi Jean,

Please find below give code where i was able to format the output. It is as per my requirement.

For blank space, you can just append a blank line to the message table.

* Text - Dear Franchisee,
  ls_message = text-011.
  APPEND ls_message TO fp_t_message.
  CLEAR ls_message.

  APPEND INITIAL LINE TO fp_t_message.

*<Royalty & Rent from table ZFARTXT001-DESCRIPTION by entering the BUKRS & language form the customer master >
*<Customer No>
  CONCATENATE fp_wa_zfartxt001-description
              fp_wa_kna1-kunnr
              INTO lv_msg
              SEPARATED BY space.

* Text - This is to inform you that an invoice(s) or credit adjustments(s)
*has been posted to the account referenced:

  CONCATENATE text-012
              text-013
              lv_msg
              INTO ls_message
              SEPARATED BY space.
  APPEND ls_message TO fp_t_message.
  CLEAR ls_message.

  APPEND INITIAL LINE TO fp_t_message.

* Text - Please Access BK ePAY to view the items
  ls_message = text-014.
  APPEND ls_message TO fp_t_message.
  CLEAR ls_message.

  APPEND INITIAL LINE TO fp_t_message.

* Text - Thank you,
  ls_message = text-015.
  APPEND ls_message TO fp_t_message.
  CLEAR ls_message.

  APPEND INITIAL LINE TO fp_t_message.

* Text - AR DEPARTMENT
  ls_message = text-016.
  APPEND ls_message TO fp_t_message.
  CLEAR ls_message.

* Text - 
  ls_message = text-017.
  APPEND ls_message TO fp_t_message.
  CLEAR ls_message.

* Text - 305-378-7710
  ls_message = text-018.
  APPEND ls_message TO fp_t_message.
  CLEAR ls_message.

Hope this helps.

Best Regards,

Ram.

Read only

Former Member
0 Likes
816

Hi Ram,

Thanks for your reply.

Read only

Former Member
0 Likes
816

Hi Ram,

Thanks for your reply.

But the sample code dont have any formatting options.

Read only

Former Member
0 Likes
816

-use textmodule tcode so10 to write ur bodytext

maybe with FM for symbol replacement

-write some html statements in ur code

they will get translated

use FM convert_itf_to_htm

send mail with doc-type HTM in packing_list

hope it helps

msg if u need some code example

regards

Stefan Seeburger

Read only

Former Member
0 Likes
816

If formatting is causing you some problems and finally you are Concatenating data into a single line, why dont you try CONCATENATE x y z SEPARATED BY space RESPECTING BLANKS.

This will ensure that all concatented fields retaing their respective field lengths.

Let me know if this does not help and there is some other issue.

Read only

MarcinPciak
Active Contributor
0 Likes
816

data it_message TYPE TABLE OF solisti1 WITH HEADER LINE.

"in unicode system use this:
CONSTANTS: con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB,   "for tab mark
           con_cret(2) TYPE c VALUE cl_abap_char_utilities=>cr_lf.        "for carret return
 
"in non-unicode this one
CONSTANTS: con_cret TYPE x VALUE '0D',  
           con_tab TYPE x VALUE '09'.    
 
"now simply place your TAB between your data and CR and beginning of each line
concatenate con_cret field1 con_tab field2 con_tab field3 into it_message.
append it_message.