Skip to Content
avatar image
Former Member

sending email issue

hello gurus,

I've written the following code to send an email if the background job failed.after executing the program the sy-subrc status of the F.M SO_NEW_DOCUMENT_SEND_API1 is '2'. i.e, document not sent.

I checked in sost t-code to view the email status but they didn't show up please help me out.



select single status from tbtco into lv_jstatus where jobname = p_lv_jname and jobcount = p_lv_jcount.

*if lv_jstatus eq 'Y'.

*  lv_jstatus = 'A'.

*  endif.

if lv_jstatus eq 'A'.

ls_mailrecipients-rec_type  ='U'.

ls_mailrecipients-receiver = 'xxxx@gmail.com'.

ls_mailrecipients-express = 'X'.

APPEND  ls_mailrecipients to lt_mailrecipients .

*CLEAR lt_mailrecipients .

* subject.

ls_mailsubject-obj_name = 'Status'.

ls_mailsubject-obj_langu = sy-langu.

ls_mailsubject-obj_descr = ' Background Job is Cancelled.'.

ls_mailsubject-sensitivty = 'P'.

* mail contents

ls_mailtxt-line = 'Hello,'.

APPEND ls_mailtxt to lt_mailtxt.

ls_mailtxt-line = 'The Background Job is cancelled,Pleae Have a Look'.

APPEND ls_mailtxt to lt_mailtxt.

ls_mailtxt-line = 'Thank You'.

append ls_mailtxt to lt_mailtxt.

*CLEAR lt_mailtxt.

* send mail

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

destination 'NONE'

    EXPORTING

      document_data              = ls_mailsubject

      document_type              = 'RAW'

      put_in_outbox              = 'X'

      commit_work                = 'X'

    TABLES

      object_content             = lt_mailtxt[]

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

In the debugging mode I got status of the job 'A' . everything working fine but they are not showing up in SOST. please help me out

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Dec 29, 2014 at 10:02 AM

    Hi Narendra ,

        If you are running the same in foreground mails are going or not.

    I think its not going foreground also , kindly check with basis team are you having authorization to send a mails.

    Ans system itself giving the subrc value 2 ,means document not sent.

    Regards,

    Krishna

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      they didnt even show up in the t-code SOST for processing the email. I tried before they were successfully sent. But now they are not showing in SOST

  • avatar image
    Former Member
    Dec 29, 2014 at 10:13 AM

    Any More Helpful answers please help me

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 02, 2015 at 11:37 AM

    This message was moderated.

    Add comment
    10|10000 characters needed characters exceeded