Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CL_BCS multiple attachment mail

former_member194669
Active Contributor
0 Likes
1,873

Hi,

I am sending mails with multiple attachments, My requirement is some of the users with one attachment and some other users multiple attachments (Please check it_receipent table below mentioned) Here attachments are added before the Loop at it_receipent table, in that case how will i delete a added attachment?

Any info how to do this.


    try.
        document = cl_document_bcs=>create_document(
                                      i_type    = 'RAW'
                                      i_text = it_content[]
                                      i_subject = subject ).
        if not attach_name1 is initial.
          call method document->add_attachment
            exporting
              i_attachment_type    = attach_ext1
              i_attachment_subject = attach_name1
              i_att_content_text   = it_attach1[].
        endif.
        if not attach_name2 is initial.
          call method document->add_attachment
            exporting
              i_attachment_type    = attach_ext2
              i_attachment_subject = attach_name2
              i_att_content_text   = it_attach2[].
        endif.
        call method send_request->set_document( document ).
        sender = cl_sapuser_bcs=>create( sy-uname ).

        call method send_request->set_sender
          exporting
            i_sender = sender.

        loop at it_recipient.
          translate it_recipient-smtp_addr to lower case.
          recipient = cl_cam_address_bcs=>create_internet_address(
  it_recipient-smtp_addr ).
          call method send_request->add_recipient
            exporting
              i_recipient  = recipient
              i_express    = ' '
              i_copy       = ' '
              i_blind_copy = ' '
              i_no_forward = ' '.
        endloop.
        move : 'E' to v_request_status.
        v_status = v_request_status.
        call method send_request->set_status_attributes
          exporting
            i_requested_status = v_request_status
            i_status_mail      = v_status.
        send_request->set_send_immediately( 'X' ).
        send_request->send( ).
        commit work.
      catch cx_document_bcs into bcs_exception.
    endtry.

Hi,

I am sending mails with multiple attachments, My requirement is some of the users with one attachment and some other users multiple attachments (Please check it_receipent table below mentioned) Here attachments are added before the Loop at it_receipent table, in that case how will i delete a added attachment?

Any info how to do this.


    try.
        document = cl_document_bcs=>create_document(
                                      i_type    = 'RAW'
                                      i_text = it_content[]
                                      i_subject = subject ).
        if not attach_name1 is initial.
          call method document->add_attachment
            exporting
              i_attachment_type    = attach_ext1
              i_attachment_subject = attach_name1
              i_att_content_text   = it_attach1[].
        endif.
        if not attach_name2 is initial.
          call method document->add_attachment
            exporting
              i_attachment_type    = attach_ext2
              i_attachment_subject = attach_name2
              i_att_content_text   = it_attach2[].
        endif.
        call method send_request->set_document( document ).
        sender = cl_sapuser_bcs=>create( sy-uname ).

        call method send_request->set_sender
          exporting
            i_sender = sender.

        loop at it_recipient.
          translate it_recipient-smtp_addr to lower case.
          recipient = cl_cam_address_bcs=>create_internet_address(
  it_recipient-smtp_addr ).
          call method send_request->add_recipient
            exporting
              i_recipient  = recipient
              i_express    = ' '
              i_copy       = ' '
              i_blind_copy = ' '
              i_no_forward = ' '.
        endloop.
        move : 'E' to v_request_status.
        v_status = v_request_status.
        call method send_request->set_status_attributes
          exporting
            i_requested_status = v_request_status
            i_status_mail      = v_status.
        send_request->set_send_immediately( 'X' ).
        send_request->send( ).
        commit work.
      catch cx_document_bcs into bcs_exception.
    endtry.

3 REPLIES 3
Read only

former_member194669
Active Contributor
0 Likes
973

Nobody ?

Read only

former_member194669
Active Contributor
0 Likes
973

I find method for delete attachment . problem solved

Read only

0 Likes
973

Hi a@s

What the method you have found ?

can you please post it for deletion ?

Thanks in advance

Krupali