2006 Nov 07 9:03 AM
I have some problems with my coding below.
Table cc_itab contains :
Table to_itab contains :
The emails are sended correctly but when i look at the mails in outlook i see
1st mail : TO : [email protected]
CC : [email protected];[email protected]
This is still correct but now the problem starts
2nd mail : TO : [email protected]
CC : [email protected];[email protected];[email protected];[email protected]
in cc every email address is used 2 times.
3th mail : TO : [email protected]
CC : [email protected];[email protected];[email protected];[email protected];[email protected];[email protected]
in cc every email address is used 3 times.
******************************************************************************************************************
loop at cc_itab.
TRY.
Create persistent send request
send_request = cl_bcs=>create_persistent( ).
Create document
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = bodytext
i_subject = subject ).
i_subject = 'Overview emails of 06/10/2006' ).
Add document to send request
CALL METHOD send_request->set_document( document ).
Get sender object
sender = cl_sapuser_bcs=>create( sy-uname ).
Add sender
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
Create recipient TO -> Vendor
CLEAR c_address.
c_address = cc_itab-s_name_text.
CLEAR recipient.
recipient = cl_cam_address_bcs=>create_internet_address( c_address ).
Add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = ' '
i_copy = ' '
i_blind_copy = ' '.
Create recipient CC -> Purchaser
LOOP AT cc_itab.
CLEAR c_address.
c_address = cc_itab-smtp_addr.
CLEAR recipient.
recipient = cl_cam_address_bcs=>create_internet_address( c_address ).
Add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = ' '
i_copy = 'X'
i_blind_copy = ' '.
ENDLOOP.
set send immediately flag
send_request->set_send_immediately( 'X' ).
Send document
CALL METHOD send_request->send( ).
COMMIT WORK.
CATCH cx_bcs INTO bcs_exception.
RAISE EXCEPTION bcs_exception.
ENDTRY.
endloop.
I have some problems with my coding below.
Table cc_itab contains :
Table to_itab contains :
The emails are sended correctly but when i look at the mails in outlook i see
1st mail : TO : [email protected]
CC : [email protected];[email protected]
This is still correct but now the problem starts
2nd mail : TO : [email protected]
CC : [email protected];[email protected];[email protected];[email protected]
in cc every email address is used 2 times.
3th mail : TO : [email protected]
CC : [email protected];[email protected];[email protected];[email protected];[email protected];[email protected]
in cc every email address is used 3 times.
******************************************************************************************************************
loop at cc_itab.
TRY.
Create persistent send request
send_request = cl_bcs=>create_persistent( ).
Create document
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = bodytext
i_subject = subject ).
i_subject = 'Overview emails of 06/10/2006' ).
Add document to send request
CALL METHOD send_request->set_document( document ).
Get sender object
sender = cl_sapuser_bcs=>create( sy-uname ).
Add sender
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
Create recipient TO -> Vendor
CLEAR c_address.
c_address = cc_itab-s_name_text.
CLEAR recipient.
recipient = cl_cam_address_bcs=>create_internet_address( c_address ).
Add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = ' '
i_copy = ' '
i_blind_copy = ' '.
Create recipient CC -> Purchaser
LOOP AT cc_itab.
CLEAR c_address.
c_address = cc_itab-smtp_addr.
CLEAR recipient.
recipient = cl_cam_address_bcs=>create_internet_address( c_address ).
Add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = ' '
i_copy = 'X'
i_blind_copy = ' '.
ENDLOOP.
set send immediately flag
send_request->set_send_immediately( 'X' ).
Send document
CALL METHOD send_request->send( ).
COMMIT WORK.
CATCH cx_bcs INTO bcs_exception.
RAISE EXCEPTION bcs_exception.
ENDTRY.
endloop.
2006 Nov 07 9:13 AM
Hi,
the mail sending is inside the loop.
loop at cc_itab.
In the starting itself each time <b>refresh</b> that recipient internal table <b>that u r passing to email FM</b>
other ways the emails get appended over and over again
endloop.
hiope u got the problem solution
rgds
Anver
if hlped pls mark points
2006 Nov 07 9:28 AM
Hi Anversha,
Thanks for your response but the sending of the mail is not in the loop. In the loop recipients are added to the mail.
The loop ends before setting the send immediately flag and before the send of the document.
Rgds,
Eric
2006 Nov 07 10:03 AM
In your code it seems you are looping at cc_tab twice..it might be a typo error as you would be looping at to_tab and cc_tab within it.
I would advice to put a break point before you loop at cc_tab and check how many times it is looping around during the iterations !!
Regards
Anurag
2006 Nov 07 10:05 AM
hi ,
as anurag, told.
put a break point before your loop, and chk ur receipent innternal table.
some where the values are appending again and again.
rgds
anver
2006 Nov 07 10:42 AM
You're wright.
Did use a clear instead of a refresh of the table.
Thank you both.
Didn't mark my thread as a question so a can't give you points. Sorry. Will do it next time.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |