cancel
Showing results for 
Search instead for 
Did you mean: 

How to send c.c. email po to vendor?

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

What is

"PERFORM mail."?

I have implemented all the functions, however, after I try to output to email. No error but no email found in SCOT as well.

Thanks for yoru advice.

Vicki

Former Member
0 Kudos

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'.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Sorry, as I do not have the device

out_opt-tddest = 'EPSON-COMMON'.

therefore I got error in the function.

And now I got it.

Thanks a lot for everyone's advice.

Answers (1)

Answers (1)

Former Member
0 Kudos

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.