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

SO672 when loop table and send email

former_member625844
Participant
1,031

I use the below code to loop through an itab and group by customer code. Then for each customer I send a Email.

LOOP AT gt_lott INTO DATA(wa) GROUP BY wa-customer_id .
LOOP AT GROUP wa ASSIGNING FIELD-SYMBOL(<members>).
create mail content...
ENDLOOP.
send_request = cl_bcs=>create_persistent( ).
mailsubject = 'CM Report'.
"document
document = cl_document_bcs=>create_document(
i_type = 'HTM'
i_text = it_contents
i_subject = mailsubject ).
send_request->set_document( document ).
sender = cl_cam_address_bcs=>create_internet_address( 'xxx.COM' ).
send_request->set_sender( sender ).
recipient_to = cl_cam_address_bcs=>create_internet_address( 'xxx.com' ).
send_request->add_recipient( i_recipient = recipient_to ).
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = lv_sent_to_all ).
COMMIT WORK.
ENDLOOP.

After I run the code, I can see multiple emails were created in Tcode SCOT. But they are in Status 672,

I can manually send them but I wonder what cause this issue? Is this my code problem or some setting error in SCOT? Thx.

I use the below code to loop through an itab and group by customer code. Then for each customer I send a Email.

LOOP AT gt_lott INTO DATA(wa) GROUP BY wa-customer_id .
LOOP AT GROUP wa ASSIGNING FIELD-SYMBOL(<members>).
create mail content...
ENDLOOP.
send_request = cl_bcs=>create_persistent( ).
mailsubject = 'CM Report'.
"document
document = cl_document_bcs=>create_document(
i_type = 'HTM'
i_text = it_contents
i_subject = mailsubject ).
send_request->set_document( document ).
sender = cl_cam_address_bcs=>create_internet_address( 'xxx.COM' ).
send_request->set_sender( sender ).
recipient_to = cl_cam_address_bcs=>create_internet_address( 'xxx.com' ).
send_request->add_recipient( i_recipient = recipient_to ).
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = lv_sent_to_all ).
COMMIT WORK.
ENDLOOP.

After I run the code, I can see multiple emails were created in Tcode SCOT. But they are in Status 672,

I can manually send them but I wonder what cause this issue? Is this my code problem or some setting error in SCOT? Thx.

2 REPLIES 2
Read only

vijay_hariharan
Contributor
955

Hello

If the message says 'Wait for Communication Service' - please use this to search the forum. There should be a lot of threads with responses to this. Should be something related to SCOT settings and RSCONN01 job scheduling. Please check

Read only

FredericGirod
Active Contributor
0 Likes
955

vijay.hariharan this is an answer, you should convert it to answer (button action)