SO_DOCUMENT_SEND_API1 Subject

SO_DOCUMENT_SEND_API1

When we use the FM SO_DOCUMENT_SEND_API1 to send emails we need to fill some paramters to  send email from SAP, to do this we need to pass the table parameter called: receivers, this table will contains emails that we want to send emails, here you have and example:

so_document_send_api1 example

  DATA:     gt_mailrecipients TYPE STANDARD TABLE OF somlreci1,
ls_mailrecipients TYPE  somlreci1.




 ls_mailrecipients-receiver  = 'barak_obama@usa.gov'
ls_mailrecipients-rec_type  = 'U'.
ls_mailrecipients-com_type  = 'INT'.
ls_mailrecipients-notif_del = abap_true.
ls_mailrecipients-notif_ndel = abap_true.
APPEND ls_mailrecipients TO gt_mailrecipients.


      CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = wa_subject
          document_type              = 'HTM'
        TABLES
*         OBJECT_HEADER              =
          object_content             = gt_mailtxt
          receivers                  = gt_mailrecipients
        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.

Now, how can set the  email subect on SO_DOCUMENT_SEND_API1 ?

Its very easy, as you can see on invoke of FM, we pass a paramter called  wa_subject, in this parameter we can put the subject email below code:

wa_subject-obj_descr = 'Billing information'.

When you send email, the user will recive an email with:

 

Recomendation

When you use this function module we recomend  invoke program rsconn01  to send emails inmediatly, this will help you to send yout emails automatic , to check email status you can visit SOST tcode, here you have an example:

      CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = wa_subject
          document_type              = 'HTM'
        TABLES
*         OBJECT_HEADER              =
          object_content             = gt_mailtxt
          receivers                  = gt_mailrecipients
        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.

      ENDIF.

      IF sy-subrc EQ 0.
        COMMIT WORK.
        SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
      ENDIF.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Go up