Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9076

Re: ITSM mail body is empty

$
0
0


Dear Helmut,

 

As per my knowledge, Its not possible to add body in mail when u r using mension smart form and class.

 

But you can do this by method call action.


Please refere below sample code to send mail in HTML format.

 

       lv_send_request        TYPE REF TO cl_bcs,
       lv_document            TYPE REF TO cl_document_bcs,
       lt_sender              TYPE REF TO cl_sapuser_bcs,

 

*-- Create persistent send request

              lv_send_request = cl_bcs=>create_persistent( ).

              lv_sub = lv_subj.

*-- Create Document

              lv_document = cl_document_bcs=>create_document(
              i_type       = cv_htm
              i_text       = lt_contents1
              i_length     = lv_doc_len
              i_subject    = lv_sub
              i_language   = sy-langu
              i_importance = '5' ).

              CALL METHOD lv_document->add_attachment

                EXPORTING
                  i_attachment_type    = 'jpg'
                  i_attachment_subject = 'logo'
*                i_attachment_size    = lv_img1_size
                  i_att_content_hex    = lt_hex1.

              TRY.

*-- Set the Message Subject

                  CALL METHOD lv_send_request->set_message_subject

                    EXPORTING
                      ip_subject = lv_subj.
                CATCH cx_sy_dyn_call_illegal_method.    "#EC NO_HANDLER
              ENDTRY.



*-- Add document to send request

              CALL METHOD lv_send_request->set_document( lv_document ).



*-- Do send delivery info for successful mails

              CALL METHOD lv_send_request->set_status_attributes
                EXPORTING
                  i_requested_status = 'E'
                  i_status_mail      = 'A'.



*-- Set sender

              lt_sender = cl_sapuser_bcs=>create( sy-uname ).
              CALL METHOD lv_send_request->set_sender
                EXPORTING
                  i_sender = lt_sender.



**-- Add the recipients to the Send mail

              CLEAR : lv_rcv_email,lv_partner.

              REFRESH : lt_bapiadsmtp,lt_return.


              IF lv_recipient1 IS NOT INITIAL.
                lv_partner = lv_recipient1.



                CALL FUNCTION 'BAPI_BUPA_ADDRESS_GETDETAIL'
                  EXPORTING
                    businesspartner = lv_partner
                  TABLES
                    bapiadsmtp      = lt_bapiadsmtp
                    return          = lt_return.

                READ TABLE lt_bapiadsmtp INTO ls_bapiadsmtp INDEX 1.

                IF sy-subrc EQ 0.
                  lv_rcv_email = ls_bapiadsmtp-e_mail.
                ENDIF.
              ENDIF.


              CHECK NOT lv_rcv_email IS INITIAL.
              lt_recipient = cl_cam_address_bcs=>create_internet_address(
              lv_rcv_email ).

              CALL METHOD lv_send_request->add_recipient
                EXPORTING
                  i_recipient = lt_recipient
                  i_express   = abap_true.


              lv_send_request->set_send_immediately( 'X' ).

*-- Send Email
              CALL METHOD lv_send_request->send(
                EXPORTING
                  i_with_error_screen = abap_true
                RECEIVING                  result              = lv_result ).

 

 

Thanks,

Vikas


Viewing all articles
Browse latest Browse all 9076

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>