2008 Nov 13 5:41 AM
Hi gurus,
We are using R/3 4.7 version. Client wants us to trigger an email based on an event. This email carries some information for the targeted email recipient. Now the client requirement is that we should make some fields in email body as bold. These fields are inclusive of dynamic and static fields.
I tried using function module SO_NEW_DOCUMENT_ATT_SEND_API1 to trigger an email.
In this we function module we have to pass a structure called "packing list". This structure contains a component called "doc_type". In my report I am passing doc_type as "RAW". However when I use this doc type, I am unable to make body text as bold. This doc type creates email body in plain text.
I searched earlier forums, which suggested me to pass "HTM" as doc_type to get the email in HTML format. When I pass this value, I get an blank email. Later I found that the value table TSOTD for doc_type does not contain value "HTM". Hence I cannot use "HTM".
Can anyone please help me in solving this issue.
Rewards gurranteed.
Thanks,
Bhanu.
Hi gurus,
We are using R/3 4.7 version. Client wants us to trigger an email based on an event. This email carries some information for the targeted email recipient. Now the client requirement is that we should make some fields in email body as bold. These fields are inclusive of dynamic and static fields.
I tried using function module SO_NEW_DOCUMENT_ATT_SEND_API1 to trigger an email.
In this we function module we have to pass a structure called "packing list". This structure contains a component called "doc_type". In my report I am passing doc_type as "RAW". However when I use this doc type, I am unable to make body text as bold. This doc type creates email body in plain text.
I searched earlier forums, which suggested me to pass "HTM" as doc_type to get the email in HTML format. When I pass this value, I get an blank email. Later I found that the value table TSOTD for doc_type does not contain value "HTM". Hence I cannot use "HTM".
Can anyone please help me in solving this issue.
Rewards gurranteed.
Thanks,
Bhanu.
2008 Nov 13 5:50 AM
Fill the content of the mail i.e object_content including HTML tags
2008 Nov 13 6:00 AM
I tried using HTML tags but it does not work. Even the tags come in the email body.
2008 Nov 13 6:03 AM
Hi Bhanu,
You can try the following.
&----
*& Report SENDLIST
*&
&----
*& Sample report from note 190669 for sending lists via SAPconnect
*& for releases as of 6.10:
*&
*& 1. Use so_document_send_api1 instead of
*& so_new_document_att_send_api1 (same interface)
*& Better yet, use the BCS interface. See below and note 190669
*& 2. Cast recipient structures into receiver-receiver field
*& using a field-symbol
*& 3. Set a commit work statement after the sending
*& or set parameter commit_work at the send module
*& 4. Give binary data of type x not type c to send module, i.e.
*& use structure solix instead of soli and give it to tables
*& parameter contents_hex instead of contents_bin
*& Do this by filling contents_hex directly from the module
*& table_compress. In case of reading the data from spool, convert
*& to solix using so_solitab_to_solixtab
*& 5. Don't calculate document size. It is done internally
*&
*& Recommendation:
*& Switch to the new BCS interface instead of calling the API1
*& Function module. See Report sendlist_bcs (also within note 190669)
*& for this
*&
&----
report sendlist line-size 46 no standard page heading message-id so.
&----
*& Form create_list_content
&----
*
-
form create_list_content changing list_content type solix_tab.
1st possibility - use "submit <report> exporting list to memory"
this is the recommended way
if submit = 'X'.
perform use_submit changing list_content.
endif.
2nd possibility - create a new list within this report.
if write = 'X'.
perform write_a_list changing list_content.
endif.
3rd possibility - get list from spool
if spool = 'X'.
perform get_list_from_spool changing list_content.
endif.
endform. "create_list_content
&----
*& Form create_text_content
&----
*
-
form create_text_content changing text_content type soli_tab.
append 'This is the first line' to text_content.
append 'This is the second line' to text_content.
convert the content from RAW to TXT
call function 'SO_RAW_TO_RTF'
TABLES
objcont_old = text_content
objcont_new = text_content
EXCEPTIONS
others = 0.
endform. "create_text_content
&----
*& Form SEND
&----
Create the list-document and send it via FAX, Mail and RML
-
form send using text_content type soli_tab
list_content type solix_tab.
structures and internal tables for the send data
data document_data type sodocchgi1.
data packing_list type table of sopcklsti1.
data receivers type table of somlreci1.
data contents_txt type soli_tab.
data contents_hex type solix_tab.
data packlist_wa type sopcklsti1.
data receiver_wa type somlreci1.
data packlist_counter type i.
data sent_to_all type sonv-flag.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main document
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
document data contains information for the whole message
document_data-obj_descr = u2018textu2019.
some text for the main document
append u2018textu2019 to contents_txt.
append u2018textu2019
packlist_counter = 1.
perform create_packlist_entry using contents_txt
'RAW'
changing packlist_wa
packlist_counter.
append packlist_wa to packing_list.
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
add a text attachment of type TXT
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
perform create_packlist_entry using text_content
'TXT'
changing packlist_wa
packlist_counter.
append packlist_wa to packing_list.
append lines of text_content to contents_txt.
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
add the list attachment of type ALI
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packlist_counter = 1. "because we will fill the hex table now
perform create_packlist_entry using list_content
'ALI'
changing packlist_wa
packlist_counter.
append packlist_wa to packing_list.
append lines of list_content to contents_hex.
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Send the document by calling the API1
as of 6.10 either the flag 'commit_work' has to be set
or a commit work statement has to be set somewhere after the call
Sending won't work without this!
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
call function 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = document_data
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = sent_to_all
TABLES
packing_list = packing_list
contents_txt = contents_txt
contents_hex = contents_hex
receivers = receivers
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.
case sy-subrc.
when 0.
if sent_to_all is initial.
read table receivers index 1 into receiver_wa.
message i865 with receiver_wa-retrn_code.
else.
message s022.
endif.
when 1.
message i552.
when 2.
message i023 with document_data-obj_descr.
when 4.
message i471.
when others.
message i619.
endcase.
endform. " SEND
Hope this will help you...
Regards,
Ravi Kiran.
2013 Oct 14 4:11 PM
Check the parameter document_data-doc_size, I had the same problem, so I solved.
Regards.
Fabrizio
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |