on 12-05-2008 8:16 AM
My print program has the following codes for sending email PO to vendor
CALL FUNCTION l_fm_name
EXPORTING
control_parameters = l_prn_ctrlop
output_options = l_prn_comp
user_settings = ' '
mail_recipient = ls_recipient
mail_sender = ls_sender
TABLES
l_xekpa = l_doc-xekpa
l_xekpo = l_doc-xekpo
l_xeket = l_doc-xeket
l_xekkn = l_doc-xekkn
l_xekek = l_doc-xekek
l_xtkomv = l_doc-xtkomv
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
Only 1 address is allowed for parameter "mail_recipient". How can I send PO to more than 1 vendor? And is it possible to distinguish to: and cc: for recipient?
Thanks in advance.
Vicki
try this way
c_par-no_dialog = 'X'.
c_par-preview = space.
c_par-getotf = 'X'.
out_opt-tddest = 'EPSON-COMMON'.
CALL FUNCTION fm_name
EXPORTING
control_parameters = c_par
output_options = out_opt
user_settings = space
vbeln = it_vbeln-vbeln
pdf = r2
rbiclear = c3
IMPORTING
job_output_info = opt
einv = einv.
i_otf = opt-otfdata.(here u will get the output of smartform
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = objpack
contents_txt = objtxt[]
contents_bin = so_ali[]
*contents_hex = so_ali[]
receivers = reclist[]----
>here u can specify multiple receiptent
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.
PERFORM mail.
MESSAGE 'Mail sent successfully' TYPE 'S'.
*SUBMIT RSCONN01 WITH MODE = MODE.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually, I don't know where the smartform process the recipient. And I found that the recipient parameter is dimmed for changed in the smartform, so I cannot modify the parameter to a list. And even I can change or add parameter of recipient, I don't know where in the print program or in the smartform I should change to cater for the multiple recipient.
hi,
u can look at the following code sample
here m selecting my reciecevers based on my condition - e-mail receivers.
SELECT SINGLE smtp_addr FROM adr6 INTO v_mailaddr "#EC *
WHERE addrnumber = i_addrnum.
wa_it_reclist-receiver = v_mailaddr.
wa_it_reclist-express = c_X. " X
wa_it_reclist-rec_type = c_U. "U -> Internet address
APPEND wa_it_reclist TO it_reclist.
Sending Mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_doc_chng
put_in_outbox = c_X "X
COMMIT_WORK =
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = it_objpack
object_header = wa_objhead
contents_bin = it_objbin
contents_txt = it_objtxt
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
receivers = it_reclist <............................
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 .
u can look @ the entire code .. i have put into code tutorial ..
https://wiki.sdn.sap.com/wiki/x/MYOmAw
it was a FM to send Email ..
hope it would prove useful to u ...
regards,
prashanti
It seemed that mail_recipient is a default parameter of the smartform.
So do you mean, I do have to pass mail_recipient into the smartform function. And I call the 'SO_NEW_DOCUMENT_ATT_SEND_API1' in my print program?
More, you have highlight
i_otf = opt-otfdata.(here u will get the output of smartform), but where should this be used?
More, when I can contruct "doc_chng"?
Thanks for your advice.
Vicki
i_otf = opt-otfdata.(here u will get the output of smartform)
below f.m is used to convert the otf to pdf format...
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline.
below f.m is used to convert lines to 255 characters
CALL FUNCTION 'QCE1_CONVERT'
TABLES
t_source_tab = i_tline
t_target_tab = so_ali[]----
>( o/p of smartform is converted to 255 char)
EXCEPTIONS
convert_not_possible = 1
OTHERS = 2.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = objpack
contents_txt = objtxt[]
contents_bin = so_ali[]----
>(here we should pass the above converted 255 char so_ali[] )
*contents_hex = so_ali[]
receivers = reclist[]----
>here u can specify multiple receiptent
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.
PERFORM mail.
MESSAGE 'Mail sent successfully' TYPE 'S'.
*SUBMIT RSCONN01 WITH MODE = MODE.
ENDIF.
FORM mail .
PERFORM bdc_dynpro USING 'SAPMSSY0' '0120'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=PDIA'.
PERFORM bdc_dynpro USING 'SAPLSX10' '0120'.
PERFORM bdc_field USING 'BDC_CURSOR'
'SXJOBDATA-ADDR_TYPE'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ADRTP'.
PERFORM bdc_field USING 'SXJOBDATA-ADDR_TYPE'
'INT'.
PERFORM bdc_field USING 'SXJOBDATA-MAXJOBS'
'1'.
PERFORM bdc_dynpro USING 'SAPLSX10' '0120'.
PERFORM bdc_field USING 'BDC_CURSOR'
'SXJOBDATA-ADDR_TYPE'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=OK12'.
PERFORM bdc_field USING 'SXJOBDATA-ADDR_TYPE'
'INT'.
PERFORM bdc_field USING 'SXJOBDATA-MAXJOBS'
'1'.
PERFORM bdc_dynpro USING 'SAPMSSY0' '0120'.
PERFORM bdc_field USING 'BDC_CURSOR'
'02/03'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
CALL TRANSACTION 'SCOT' USING bdcdata
MODE 'N'
UPDATE 'S'.
ENDFORM. " mail
or use below
SUBMIT RSCONN01 WITH MODE = 'INT'.
Hi,
I think I am almost getting the right track..
I found that the result of opt is initial, therefore I got return = 4 from CONVERT_OTF.
i_otf = opt-otfdata.(here u will get the output of smartform)
Do I need to do something on my smartform?
Many thanks, you have given me a lot of useful information already.
Vicki
Did u set the getotf flag as 'X' in control parameters tht u r passing to the
smartform.
ls_control_param-getotf = c_x. " Chk this to get otf data
call function lf_fm_name
exporting
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
user_settings = c_space
is_dlv_delnote = ls_dlv_delnote
is_nast = nast
importing
job_output_info = it_job_output_info " this will contain otf data
exceptions formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
Edited by: prashanti k on Dec 9, 2008 9:28 AM
Hi,
After the FM SO_NEW_DOCUMENT_ATT_SEND_API1
add submit rsconn01
with mode eq l_c_mode where l_c_mode type char3 value 'INT'.
and return.
and make sure the receiver entries shud be made with receiver email id and receiver type as 'U'
data: l_c_rec_type type char1 value 'U', "Internet Users
Hope this will work.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.