|
The client wants to have two email addresses for one
vendor. The requirement is to send off one PO to two different email addresses
as per the business process requirement.
Solution: You can make a distribution group address containing both email address the maintain this distribution group address in vendor master record. Or You can solved it using ABAP: - Function module ME_PRINT_PO has been copied in order to change the Perform "PREPARE_FORMULAR" by "zPREPARE_FORMULAR" and Perform "ENDE" by "zENDE". Coding: - Include LZMEDRUCKF01 has been changed by adding a new form "f_send_mail *&
form f_send_mail changing p_retco. * initialise clear i_pdf[].
* 1) receiver list call function 'ADDR_GET_COMPLETE' EXPORTING
if sy-subrc ne 0.
loop at wa_addr-adsmtp_tab into wa_smtp. translate wa_smtp-adsmtp-remark to upper case. if wa_smtp-adsmtp-flgdefault
eq c_charx
clear wa_smtp. endloop. if sy-subrc eq 0. * 2) mail attributes move nast-objky to wa_doc-obj_name.
* 3) mail contents append lines of i_otf to i_otf255. call function 'SX_OBJECT_CONVERT_OTF_PDF'
exporting
if sy-subrc ne 0. * error creating attachment move c_char1 to p_retco. call function 'NAST_PROTOCOL_UPDATE'
exporting
if sy-subrc
ne 0.
* 4) mail body concatenate 'Attachment:'(001)
nast-objky
m_save wa_cont i_cont1. move 'Kind regards'(002) to wa_cont-line. m_save wa_cont i_cont1. * 5) title of the attachment move nast-objky to wa_cont-line. m_save wa_cont i_head. * 6) describe contents clear wa_pack-transf_bin. move c_char1
to wa_pack-head_start.
describe table i_cont1 lines wa_pack-body_num. move 'RAW' to wa_pack-doc_type. m_save wa_pack i_pack. move c_charx
to wa_pack-transf_bin.
describe table i_cont lines wa_pack-body_num. move 'PDF'
to wa_pack-doc_type.
m_save wa_pack i_pack. * 7) sent mail + PDF attachment to internet address call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
if sy-subrc
ne 0.
call function 'NAST_PROTOCOL_UPDATE'
exporting
if sy-subrc ne 0.
* mail successfully send move nast-objky to sy-msgv1. call function 'NAST_PROTOCOL_UPDATE'
exporting
if sy-subrc ne 0.
endif. endif. else. * no recipients move c_char1 to p_retco.
call function 'NAST_PROTOCOL_UPDATE' exporting
if sy-subrc ne 0.
endif. endif. endform. " f_send_mail - Include LZMEDRUCKTOP * workfields * data: w_rec
type char30.
* structures * data: wa_doc type
sodocchgi1.
* internal tables * data: i_otf
type standard table of itcoo.
- Create a ZLMEDRUCKF1O *&---------------------------------------------------------------------*
form zprepare_formular using p_screen
type c " note
353318
clear p_retco. data: xdevice(10),
"Hilfsfeld Formular
set language ekko-spras.
*- Formular festlegen -------------------------------------------------*
tnapr-fonam = p_fonam. "HW 214570 if tnapr-fonam eq space.
clear: xdialog, xdevice, itcpo. move-corresponding nast to itcpo. itcpo-tdtitle = nast-tdcovtitle.
*- Ausgabemedium festlegen --------------------------------------------* case nast-nacha. when '2'. xdevice = 'TELEFAX'. if nast-telfx eq space.
itcpo-tdtelenum = nast-telfx. if nast-tland
is initial.
endif. when '3'. xdevice = 'TELETEX'. if nast-teltx eq space.
when '4'. xdevice = 'TELEX'. if nast-telx1 eq space.
when '5'. clear itcpo-tdimmed.
move c_charx to itcpo-tdgetotf.
"Return OTF-data
when others. xdevice = 'PRINTER'. if nast-ldest eq space.
endcase. *- Testausgabe --------------------------------------------------------* if p_screen ne space. *- Testausgabe auf Bildschirm -----------------------------------------* * IF NAST-TCODE EQ 'XTST'.
endif. * Bei Probedruck, wenn das Medium keine Drucker ist. " 361152 if nast-sndex eq 'X' and nast-nacha ne '1'. " 361152 xdevice = 'PRINTER'. " 361152 if nast-ldest eq space.
" 361152
endif. " 361152 itcpo-tdnoprint = 'X'.
if sy-ucomm eq 'DRPR' or
" 361152
itcpo-tddataset = nast-dsnam.
* Formular festlegen -------------------------------------------------* call function 'OPEN_FORM' exporting form =
tnapr-fonam
if sy-subrc ne 0.
endform. " ZPREPARE_FORMULAR *&---------------------------------------------------------------------*
form zende changing p_retco. * Unterschrift -------------------------------------------------------* call function 'WRITE_FORM'
clear sy-subrc. * Folgeseitenzaehler löschen -----------------------------------------* call function 'WRITE_FORM'
clear sy-subrc. * Ende Formulardruck --------------------------------------------------* clear i_otf[]. call function 'CLOSE_FORM'
if not sy-subrc is initial. "HW 205472 p_retco = '1'. "HW 205472 perform protocol_update using '142'
ekko-ebeln
if result-tdspoolid ne space.
if not result-tdfaxid is initial or
" 422131
call function 'NAST_PROTOCOL_UPDATE' " 422131 exporting
" 422131
if result-userexit eq 'C' or
* send mail with PDF attachment to distirbution list if nast-nacha eq '5'. perform f_send_mail changing p_retco. endif. *---> End of Program Notes: Vendor set up: Vendor (mail) with flag in ADR6-FLGDEFAULT is considered as the main e-mail. Vendor (mail) with remark "Order" or "Orders" in screen field ADSMTP-REMARK are considered as the secondary e-mail. Else are considered. |
|
See Also
Get help for your ABAP problems
ABAP Books
More ABAP Tips
SAP Basis, ABAP Programming and Other IMG Stuff All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
|