2008 Aug 21 1:08 PM
Hi,
I want to format the text of a email text like font change,color, bold etc. Can anyone guide me is that possible?
I am using FM SO_NEW_DOCUMENT_SEND_API1 for email send.
Regards,
Divya
2008 Aug 21 1:36 PM
Try by inserting HTML Tags along with the Subject of the mail
Bhupal
Hi,
I want to format the text of a email text like font change,color, bold etc. Can anyone guide me is that possible?
I am using FM SO_NEW_DOCUMENT_SEND_API1 for email send.
Regards,
Divya
2008 Aug 21 1:36 PM
Try by inserting HTML Tags along with the Subject of the mail
Bhupal
2010 Mar 19 9:31 AM
Dear All,
I have a issue in formatting the header in the ALV display. We have changed a report program to ALV
In Report output was:
From To Option
In ALV, using REUSE_ALV_COMMENTARY_WRITE
the output is coming as :
From To Option
How to insert space here?
Appreciate your quick response...
Regards,
Divya
2008 Sep 17 11:09 AM
hi,
i have the same requirement. did you find any solution for the same?
2008 Sep 17 1:16 PM
Yes I got the solution.
You can use this type of code:
SMTP Configuation
Job to Send Mails - RSCONN01
Description
In many cases it is required to send notifications/messages to Users depending upon some event/action that has occurred in SAP. There are standard function modules available in SAP for achieving this functionality. Here we will discuss in addition to sending mails how we can achieve text formatting using a combination of powerful SAP function modules and simple HTML tags.
Program Logic
SAP has provided us many function modules for this purpose. We will use "SO_DOCUMENT_SEND_API1" in our case. One of the parameters that need to be passed to this Function is the structure document_data. Here we have a field doc_type, in order to have required text formatting we pass this parameter as 'HTM'. By using this extension we can format the body of this mail using HTML tags.
&----
*& Report Z_SEND_HTML_MAIL *
*& *
&----
*& *
*& *
&----
REPORT Z_SEND_HTML_MAIL .
Data Declaration
PARAMETER p_rec TYPE so_recname OBLIGATORY.
DATA: wa_docdata TYPE sodocchgi1,
wa_objpack TYPE sopcklsti1 ,
it_objpack TYPE TABLE OF sopcklsti1,
wa_objtxt TYPE solisti1,
it_objtxt TYPE TABLE OF solisti1,
wa_reclist TYPE somlreci1,
it_reclist TYPE TABLE OF somlreci1.
DATA: tab_lines TYPE i.
PERFORM fill_text.
PERFORM fill_object_details.
create receiver list
PERFORM create_receivers_list.
*send mail
PERFORM send_mail.
WRITE: / 'End of Program'.
----
Form fill_text
----
text
----
--> p1 text
<-- p2 text
----
FORM fill_text .
wa_objtxt =
'<SPAN style="font-family:arial;font-size:10.5pt;color:blue">'.
APPEND wa_objtxt TO it_objtxt.
wa_objtxt = '<B><U>Test Program for Send Mail.</U></B> <BR>'.
APPEND wa_objtxt TO it_objtxt.
wa_objtxt = '<I>This code is formatted using HTML.</I>'.
APPEND wa_objtxt TO it_objtxt.
wa_objtxt = 'Have a nice day.'.
APPEND wa_objtxt TO it_objtxt.
wa_objtxt = '<SPAN>'.
APPEND wa_objtxt TO it_objtxt.
ENDFORM. " fill_text
----
Form fill_object_details
----
text
----
--> p1 text
<-- p2 text
----
FORM fill_object_details .
DESCRIBE TABLE it_objtxt LINES tab_lines.
READ TABLE it_objtxt INTO wa_objtxt INDEX tab_lines.
wa_docdata-obj_name = 'TEST_HTML'.
wa_docdata-obj_descr = 'Test for HTML Code'.
wa_docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( wa_objtxt ).
CLEAR wa_objpack-transf_bin.
wa_objpack-head_start = 1.
wa_objpack-head_num = 0.
wa_objpack-body_start = 1.
wa_objpack-body_num = tab_lines.
wa_objpack-doc_type = 'HTM'.
APPEND wa_objpack TO it_objpack.
ENDFORM. " fill_object_details
----
Form create_receivers_list
----
text
----
--> p1 text
<-- p2 text
----
FORM create_receivers_list .
wa_reclist-receiver = p_rec.
wa_reclist-rec_type = 'U'.
APPEND wa_reclist TO it_reclist.
ENDFORM. " create_receivers_list
*----
Form send_mail
*----
\
text
*----
--> p1 text
<-- p2 text
*----
\
FORM send_mail .
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = wa_docdata
PUT_IN_OUTBOX = ' '
sender_address = 'abc.xyz@com'
sender_address_type = 'INT'
commit_work = 'X'
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
SENDER_ID =
TABLES
packing_list = it_objpack
OBJECT_HEADER =
CONTENTS_BIN =
contents_txt = it_objtxt
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
receivers = it_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH wa_docdata-obj_name.
ELSE.
WRITE : / 'Mail sent to', p_rec.
ENDIF.
ENDFORM. " send_mail
2008 Sep 18 4:53 AM
hi,
thank you very much. that was the exact solution i needed.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |