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

Send e-mail without attachment

Former Member
0 Likes
1,883

Hi ABAPers,

Following FM is used to send e-mail with Excel attachment:

   * Send email
  CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
      document_data              = ls_doc_data
      put_in_outbox              = 'X'
      commit_work                = 'X'
    TABLES
      packing_list               = lt_packing_list
      contents_bin               = t_attachment
      contents_txt               = t_message
      receivers                  = t_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.

I now like to get rid of the attachment, all trys have failed so far... Does this FM only support text e-mail AND attachment or is there a way to get rid of the attachment?

Thanks for your help guys.

Martin

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
910

Hi Martin,

You can use the class mentioned by Matthew or else go ahead with FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' as the one you are using is obsolete.

call function 'SO_NEW_DOCUMENT_ATT_SEND_API1' 

       exporting

            document_data              = ls_doc_data

            put_in_outbox              = 'X'

       importing

            sent_to_all                = gd_sent_all

       tables

            packing_list               = it_packing_list

            contents_txt               = it_message

            receivers                  = it_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.

Hope this helps.

Regards,

Deepak.

5 REPLIES 5
Read only

matt
Active Contributor
0 Likes
910

Rather than this obsolete function module, use CL_BCS and associated classes. It's much more straightforward and powerful. There's plenty of information on this site about the use of these classes.

Read only

Former Member
0 Likes
910

Hi Matthew,

Thanks, for your advice, but I just want to amend an existing program without a lot of effort. Ideally just deleting some code lines, that this Excel attachment is not being sent. Is there a possibility with this FM?

Thanks

Read only

uppu_narayan
Active Participant
0 Likes
910

Hi martin,

      Follow the below link on using cl_bcs for sending mail

http://wiki.sdn.sap.com/wiki/display/Snippets/Send+email+from+ABAP+with+class+CL_BCS

thanks and regards,

narayan

Read only

Former Member
0 Likes
911

Hi Martin,

You can use the class mentioned by Matthew or else go ahead with FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' as the one you are using is obsolete.

call function 'SO_NEW_DOCUMENT_ATT_SEND_API1' 

       exporting

            document_data              = ls_doc_data

            put_in_outbox              = 'X'

       importing

            sent_to_all                = gd_sent_all

       tables

            packing_list               = it_packing_list

            contents_txt               = it_message

            receivers                  = it_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.

Hope this helps.

Regards,

Deepak.

Read only

0 Likes
910

Thanks Deepak,

I implemented the new one and fiddled around, that worked! Thanks also to the others for suggesting the "new way" with class.

Have a good day and weekend all!

Martin