Skip to Content
0
Former Member
Apr 17, 2008 at 01:19 PM

Nedded Help with "SET_STATUS_ATTRIBUTES"

202 Views

Hi All,

I need to turn off Read recipt status on emails sent from sap.

i Used the following code but short dump is being generated

and i cant figure out why...

Please help me to resolve this issue....


  CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
    EXPORTING
      src_spoolid              = spono
      no_dialog                = 'X'
    IMPORTING
      pdf_bytecount            = l_byte_count
    TABLES
      pdf                      = i_pdf
    EXCEPTIONS
      err_no_abap_spooljob     = 1
      err_no_spooljob          = 2
      err_no_permission        = 3
      err_conv_not_possible    = 4
      err_bad_destdevice       = 5
      user_cancelled           = 6
      err_spoolerror           = 7
      err_temseerror           = 8
      err_btcjob_open_failed   = 9
      err_btcjob_submit_failed = 10
      err_btcjob_close_failed  = 11
      OTHERS                   = 12.

* Preparing body of the Mail
  MOVE 'Content Of Mail' TO l_text.
  APPEND l_text TO i_content.

* Preparing contents of attachment with Change Log
  PERFORM prepare_attachment.

* Creates persistent send request
  TRY.
      l_send_request = cl_bcs=>create_persistent( ).

* Creating Document
      l_document = cl_document_bcs=>create_document(
                                    i_type  = 'RAW'
                                    i_text  = i_content[]
                                    i_subject = 'Subject of mail'  )
.

* Size of PDF Document
      l_size = l_byte_count.

* Adding Attachment
      CALL METHOD l_document->add_attachment
        EXPORTING
          i_attachment_type    = c_ext
          i_attachment_size    = l_size
          i_attachment_subject = 'Attachment'
          i_att_content_hex    = i_attachx[].


* Add document to send request
      CALL METHOD l_send_request->set_document( l_document ).

* Get Sender Object
      l_uname = sy-uname.

      l_sender = cl_sapuser_bcs=>create( l_uname ).

      CALL METHOD l_send_request->set_sender
        EXPORTING
          i_sender = l_sender.

* E-Mail
      TRANSLATE p_mail TO LOWER CASE.

      l_recipient = cl_cam_address_bcs=>create_internet_address( p_mail ).

      CALL METHOD l_send_request->add_recipient
        EXPORTING
          i_recipient  = l_recipient
          i_express    = 'U'
          i_copy       = ' '
          i_blind_copy = ' '
          i_no_forward = ' '.

*Status of Read Receipt

CALL METHOD L_STATUS->SET_STATUS_ATTRIBUTES
  EXPORTING
    I_REQUESTED_STATUS = 'N'  " ---> 'N' stand for turnoff ?
*    I_STATUS_MAIL      = 'E' .

*Trigger E-Mail immediately

      l_send_request->set_send_immediately( 'X' ).
      CALL METHOD l_send_request->send( ).

      COMMIT WORK.

    CATCH cx_document_bcs INTO l_bcs_exception.
    CATCH cx_send_req_bcs INTO l_send_exception.
    CATCH cx_address_bcs  INTO l_addr_exception.

  ENDTRY.