2010 Nov 24 4:27 AM
Hi All,
I am facing below issue while sending a email...
1.I have to show order long text in email .For reading long text iam using FM:READ_TEXT.
If in long text '&' is used then READ_TEXT is returing it has <(>&<)>.
e.g. if long text is : test & test then READ_TEXT is returning test <(>&<)> test.
2.When iam checking email in SOST transaction its showing me email content in the format i need
ORDer no.:...
decription:..
operation :....
operation description:...
but when iam checking the mail in my inbox(Microsoft offcie outlook) the content is getting wrapped
ORDer no.:...
decription:..operation :....operation description:...
Thanks in advance...
Moderator message: please use more descriptive subject lines from now on.
Edited by: Thomas Zloch on Nov 24, 2010 1:43 PM
2010 Nov 24 7:48 AM
For issue 1, you can use FM CONVERT_ITF_TO_STREAM_TEXT.
For Issue 2, use HTML as suggested.
Hi All,
I am facing below issue while sending a email...
1.I have to show order long text in email .For reading long text iam using FM:READ_TEXT.
If in long text '&' is used then READ_TEXT is returing it has <(>&<)>.
e.g. if long text is : test & test then READ_TEXT is returning test <(>&<)> test.
2.When iam checking email in SOST transaction its showing me email content in the format i need
ORDer no.:...
decription:..
operation :....
operation description:...
but when iam checking the mail in my inbox(Microsoft offcie outlook) the content is getting wrapped
ORDer no.:...
decription:..operation :....operation description:...
Thanks in advance...
Moderator message: please use more descriptive subject lines from now on.
Edited by: Thomas Zloch on Nov 24, 2010 1:43 PM
2010 Nov 24 4:38 AM
2010 Nov 24 5:00 AM
For point 1:
Im using
CALL FUNCTION 'BAPI_ALM_NOTIF_GET_DETAIL'
EXPORTING
number = lv_qmnum1
IMPORTING
notifheader_export = lt_header_notif
TABLES
notlongtxt = lt_long_text
notifpartnr = lt_partner1.
this read notification details..along with notification long text...
i have checked this BAPI inside it FM:READ_TEXT is called to read the long text....
Edited by: pbhosey on Nov 24, 2010 6:01 AM
2010 Nov 24 5:03 AM
for point 2
*Read the email body from standard text
REFRESH : l_t_lines.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = l_c_st
language = l_c_e
name = 'ZITSE_EMAIL_PERNR'
object = l_c_text
TABLES
lines = l_t_lines.
IF l_t_lines IS NOT INITIAL.
CLEAR : l_v_endline.
DESCRIBE TABLE l_t_lines LINES l_v_endline.
ENDIF.
To convert Text symbols into dynamic values in standard text
CLEAR : l_v_string.
REFRESH : l_t_body_txt.
DO l_v_endline TIMES.
CLEAR : l_wa_lines.
READ TABLE l_t_lines INDEX sy-index INTO l_wa_lines.
IF sy-subrc IS INITIAL.
MOVE l_wa_lines-tdline TO l_v_string.
REPLACE ALL OCCURRENCES OF '&AUFNR&' IN l_v_string WITH l_wa_email_data-aufnr. "Order no.
REPLACE ALL OCCURRENCES OF '&KTEXT&' IN l_v_string WITH l_wa_email_data-ktext. "order description
REPLACE ALL OCCURRENCES OF '&VORNR&' IN l_v_string WITH l_wa_email_data-vornr. "operation no.
If sub operation exits then then sub-operation short text will be same as operation short text
IF l_v_subflag IS NOT INITIAL.
If subopration is present then addign the suboperations fiedls to email body
REPLACE ALL OCCURRENCES OF '&UVORN&' IN l_v_string WITH l_wa_email_data-uvorn.
REPLACE ALL OCCURRENCES OF '&DESC&' IN l_v_string WITH l_wa_email_data-ltxa1.
REPLACE ALL OCCURRENCES OF '<XA1&' IN l_v_string WITH l_c_space.
ELSE.
REPLACE ALL OCCURRENCES OF '&UVORN&' IN l_v_string WITH l_c_space.
REPLACE ALL OCCURRENCES OF '&DESC&' IN l_v_string WITH l_c_space.
REPLACE ALL OCCURRENCES OF '<XA1&' IN l_v_string WITH l_wa_email_data-ltxa1.
ENDIF.
REPLACE ALL OCCURRENCES OF '&PARNR&' IN l_v_string WITH l_v_parnr. "service coodinator
IF l_v_ltrmn IS NOT INITIAL.
REPLACE ALL OCCURRENCES OF '<RMN&' IN l_v_string WITH l_v_ltrmn. "required end date
ELSE.
REPLACE ALL OCCURRENCES OF '<RMN&' IN l_v_string WITH l_c_space. "required end date
ENDIF.
To get the first name of personel assigned
CLEAR l_wa_pernr.
READ TABLE l_t_pernr INTO l_wa_pernr WITH KEY pernr = l_wa_email_data-pernr.
IF sy-subrc EQ 0.
CONCATENATE l_wa_pernr-vorna ',' INTO l_wa_pernr-vorna.
REPLACE ALL OCCURRENCES OF '&USER&' IN l_v_string WITH l_wa_pernr-vorna. "recipient name
ENDIF.
MOVE l_v_string TO l_wa_body_txt-line.
APPEND l_wa_body_txt TO l_t_body_txt.
ENDIF.
ENDDO.
IF l_t_body_txt[] IS NOT INITIAL.
if l_v_subflag = l_c_x.
If sub-operation flag is set then remove the operation description text
DELETE l_t_body_txt WHERE LINE EQ l_c_opdes.
else.
*Else remove the sub-operation no. and sub-operation description text
DELETE l_t_body_txt WHERE LINE EQ l_c_subop.
DELETE l_t_body_txt WHERE LINE EQ l_c_subopdes.
endif.
ENDIF.
*-----Email sending
*preparing email body
CLEAR l_wa_document.
REFRESH l_t_document.
MOVE l_t_body_txt TO l_wa_document-content_text.
MOVE l_v_subject TO l_wa_document-subject.
APPEND l_wa_document TO l_t_document.
CLEAR l_o_document.
TRY.
CLEAR l_o_send_request.
*" Create persistent send request
MOVE cl_bcs=>create_persistent( ) TO l_o_send_request.
UNASSIGN <fs_document>.
LOOP AT l_t_document ASSIGNING <fs_document>.
IF sy-tabix EQ 1.
*" Create Document.
MOVE cl_document_bcs=>create_document(
i_type = l_c_raw
i_text = <fs_document>-content_text
i_subject = <fs_document>-subject
)
TO l_o_document.
ENDIF.
ENDLOOP.
*" Set Subject of Email
TRY.
CALL METHOD l_o_send_request->set_message_subject
EXPORTING
ip_subject = l_v_subject.
CATCH cx_sy_dyn_call_illegal_method.
ENDTRY.
*" Add document to send request
CALL METHOD l_o_send_request->set_document( l_o_document ).
*Sender
CLEAR : l_o_sender.
MOVE cl_cam_address_bcs=>create_internet_address( l_v_sender ) TO l_o_sender.
CALL METHOD l_o_send_request->set_sender
EXPORTING
i_sender = l_o_sender.
*Recever
CLEAR l_wa_pernr.
READ TABLE l_t_pernr INTO l_wa_pernr
WITH KEY pernr = l_wa_email_data-pernr.
IF sy-subrc EQ 0.
MOVE l_wa_pernr-usrid_long TO l_o_receiver_email_id.
*" Add recipient (e-mail address)
CLEAR : l_o_recipient.
MOVE cl_cam_address_bcs=>create_internet_address(
l_o_receiver_email_id
)
TO l_o_recipient.
*" Add recipient with its respective attributes to send request
CALL METHOD l_o_send_request->add_recipient
EXPORTING
i_recipient = l_o_recipient.
ENDIF.
CLEAR l_o_sent_to_all.
*" Send document
CALL METHOD l_o_send_request->send(
EXPORTING
i_with_error_screen = l_c_x
RECEIVING
result = l_o_sent_to_all ).
ENDTRY.
Edited by: pbhosey on Nov 24, 2010 6:03 AM
2010 Nov 24 5:06 AM
2010 Nov 24 7:48 AM
For issue 1, you can use FM CONVERT_ITF_TO_STREAM_TEXT.
For Issue 2, use HTML as suggested.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |