2014 Dec 29 9:56 AM
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 = '[email protected]'.
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
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 = '[email protected]'.
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
2014 Dec 29 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
2014 Dec 29 10:07 AM
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
2014 Dec 29 10:13 AM
2014 Dec 29 10:16 AM
Did you check whether, there are issues in setting up the SMP Service.
Esp, pl. check the email address is configured against the user.
1) Cross check the steps in : http://scn.sap.com/docs/DOC-46513
2) Try running RSCONN01, and check whether the mail is not in waiting state
Cheers,
Remi
2014 Dec 29 10:25 AM
2015 Jan 02 9:45 AM
Guess by now, you must have been able to resolve the issue.
Pl. close this thread, (also post how you have resolved this issue)
Regards,
Remi
2015 Jan 02 11:37 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |