Search code examples
emailabapsapconnect

How to send an email without using the program RSCONN01?


I am trying to send an email with an excel attachment without using rsconn01. If this is possible could you show me how this is done?

I would also like a little bit more information about how rsconn01 works. I am using rsconn01 to send the emails but, I received a complaint that this program was also resending out emails that failed earlier that day.

This is the code I am using now. It works, but I want to know another way to do it without using rsconn01.

`CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
  document_data              = w_doc_data
  put_in_outbox              = 'X'
  commit_work                = 'X'

IMPORTING
  sent_to_all                = w_sent_all
TABLES
  packing_list                = t_packing_list
   contents_bin               = t_attachment
  contents_txt               = it_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.

if sy-subrc = 0.
   WAIT UP TO 2 SECONDS.
   SUBMIT rsconn01 WITH mode = 'INT'
            WITH output = 'X'
           AND RETURN.
    else.
  WRITE:/ 'ERROR IN MAIL ', sy-subrc.
endif.`

Solution

  • You will have to use RSCONN01 unless you'd like to implement your own protocol handling. You're using the standard SAPconnect functionality (although with an API that's a bit outdated, I'd switch to the BCS if I were in your shoes). As long as you're using this, you're stuck with that report. However, you usually won't have to call it for yourself. It's a background process that is called every few minutes to process outgoing mail. Perhaps you're working in a development environment where the SAPconnect system isn't properly setup - in that case, you should talk to your system administrators. There are ways to tune the SAPconnect system to work in many cases. You should try to use the existing and well supported facilities before trying to circumvent them.