on 10-02-2012 4:14 PM
Hello,
I have to send an email for different receivers via BTE 2040 (AVIS for the F110).
Part of the coding:
CONCATENATE 'pppppr@cccc.com' c_finaa-intad "PZ1
into c_finaa-intad SEPARATED BY space. "PZ1
-> The email-sending doesn't work.
With the coding:
c_finaa-intad = l_adsmtp_line-adsmtp-smtp_addr.
-> The email-sending works.
The OSS-note 1033893 is implemented.
Do you have an idea, what's the problem?
Thanks in advance
Peter
The whole coding..
****************************************************************************
*****************************************************************************
FUNCTION Z_S1FI_BTE_EVENT00002040_PZ.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(I_REGUH) LIKE REGUH STRUCTURE REGUH
*" TABLES
*" T_FIMSG STRUCTURE FIMSG
*" CHANGING
*" VALUE(C_FINAA) LIKE FINAA STRUCTURE FINAA
*"----------------------------------------------------------------------
*{ INSERT SK1K904419 1
* data declaration for address routines
TYPE-POOLS szadr.
DATA: l_addr1_complete TYPE szadr_addr1_complete,
l_adsmtp_line TYPE szadr_adsmtp_line,
lv_tlfxs TYPE lfb1-tlfxs, "DD050309
lv_lnrza TYPE lfa1-lnrza. "DD110509
** Mandantenprüfung
CASE sy-mandt.
WHEN '291' OR '299'.
* Nur für Buchungskreis 0002 durchführen
CASE i_reguh-zbukr. "DD100910
WHEN '0002'. "DD100910
* default: print payment advice
c_finaa-nacha = '1'.
*<DD011012-------------------------------------------------------------
* Email (message type I)
* check that address number is available
IF NOT i_reguh-zadnr IS INITIAL.
* read complete address of vendor/customer
CALL FUNCTION 'ADDR_GET_COMPLETE'
EXPORTING
addrnumber = i_reguh-zadnr
IMPORTING
addr1_complete = l_addr1_complete
EXCEPTIONS
OTHERS = 4.
IF sy-subrc EQ 0.
* check that internet address is available
READ TABLE l_addr1_complete-adsmtp_tab INTO l_adsmtp_line
INDEX 1.
IF sy-subrc EQ 0
AND NOT l_adsmtp_line-adsmtp-smtp_addr IS INITIAL.
* choose message type 'I'nternet and fill email address
c_finaa-nacha = 'I'.
c_finaa-intad = l_adsmtp_line-adsmtp-smtp_addr.
CONCATENATE 'p.BBBB@XXXXX.com' c_finaa-intad "PZ1
into c_finaa-intad SEPARATED BY space. "PZ1
c_finaa-textf = 'PDF'.
ENDIF.
ENDIF.
ENDIF.
*------------------------------------------------------------DD011012>
* Falls keine Email Adresse gefunden wurde, schicke an Fax
IF c_finaa-intad IS INITIAL. "DD011012
* Abw. Zahlungsempfänger ermitteln
SELECT SINGLE lnrza FROM lfa1 "DD110509
INTO lv_lnrza "DD110509
WHERE lifnr = i_reguh-lifnr. "DD110509
* Abw. Zalhungsempfänger vorhanden
IF lv_lnrza IS NOT INITIAL.
* Fax-Nummer des Sachbearbeiters beim abw. Zahlungsempfänger
* ermitteln:
SELECT SINGLE tlfxs FROM lfb1 "DD110509
INTO lv_tlfxs "DD110509
WHERE lifnr = lv_lnrza "DD110509
AND bukrs = i_reguh-zbukr. "DD110509
ENDIF.
* Falls es keinen abw. Zahlungsempfänger gibt, oder dieser keine
* Faxnummer hat, suche beim Kreditor
IF lv_tlfxs IS INITIAL. "DD110509
* Fax-Nummer des Sachbearbeiters auslesen
SELECT SINGLE tlfxs FROM lfb1 "DD050309
INTO lv_tlfxs "DD050309
WHERE lifnr = i_reguh-lifnr "DD050309
AND bukrs = i_reguh-zbukr. "DD050309
ENDIF. "DD110509
* Fax (message type 2)
IF c_finaa-nacha NE 'I'.
IF lv_tlfxs IS NOT INITIAL.
c_finaa-nacha = '2'. "Fax
c_finaa-tdschedule = 'IMM'. "Sofort
c_finaa-tdteleland = i_reguh-zland. "Land der Faxnummer
c_finaa-tdtelenum = lv_tlfxs. "DD050309
c_finaa-tdfaxuser = space.
c_finaa-abtei = space.
c_finaa-fornr = space.
ENDIF.
ENDIF.
ENDIF. "DD011012
ENDCASE. "DD100910
ENDCASE.
*} INSERT
ENDFUNCTION.
Hi, You need to implement 2 event, 2050 and 2040.
Here is coding for 2050. In below example, we are picking vendor partner e-mail address.
FUNCTION zfi_ap_bte_process_00002050.
IF sy-cprog = 'RFFOUS_T'.
TYPES: BEGIN OF ty_email,
smtp_addr TYPE ad_smtpadr,
END OF ty_email.
DATA: i_email TYPE STANDARD TABLE OF ty_email,
l_ITCPO type ITCPO.
l_ITCPO = C_ITCPO.
** Get mail address of Z0 Partner from KNVK table
** with passing vendor number.
if i_reguh-lifnr is not INITIAL.
SELECT a~smtp_addr
INTO TABLE i_email
FROM knvk AS k INNER JOIN
adr6 AS a ON
k~prsnr = a~persnumber
WHERE k~pafkt = 'Z0' AND
k~lifnr = i_reguh-lifnr.
ELSEIF i_reguh-kunnr is not INITIAL.
SELECT a~smtp_addr
INTO TABLE i_email
FROM knvk AS k INNER JOIN
adr6 AS a ON
k~prsnr = a~persnumber
WHERE k~pafkt = 'Z0' AND
k~kunnr = i_reguh-kunnr.
endif.
IF sy-subrc = 0.
DATA:l_date(10).
data L_cnt type sy-linct.
WRITE i_reguh-laufd TO l_date.
clear l_cnt.
sort i_email.
delete ADJACENT DUPLICATES FROM i_email.
DESCRIBE TABLE i_email lines l_cnt.
if l_cnt > 0.
CONCATENATE text-001 l_date INTO c_itcpo-tdtitle SEPARATED BY space.
c_itcpo-tdgetotf = 'X'.
endif.
ELSE.
clear c_itcpo-tdgetotf.
C_ITCPO = l_ITCPO.
ENDIF.
ENDIF.
ENDFUNCTION.
FUNCTION zfi_ap_bte_process_00002040.
IF sy-cprog = 'RFFOUS_T'.
TYPES: BEGIN OF ty_email,
smtp_addr TYPE ad_smtpadr,
END OF ty_email.
DATA: i_email TYPE STANDARD TABLE OF ty_email,
wa_email TYPE ty_email,
l_finaa TYPE finaa,
l_cnt type sy-linct.
l_finaa = c_finaa.
** Get mail address of Z0 Partner from KNVK table
** with passing vendor number.
if i_reguh-lifnr is not INITIAL.
SELECT a~smtp_addr
INTO TABLE i_email
FROM knvk AS k INNER JOIN
adr6 AS a ON
k~prsnr = a~persnumber
WHERE k~pafkt = 'Z0' AND
k~lifnr = i_reguh-lifnr.
endif.
** Get mail address of Z0 Partner from KNVK table
** with passing customer number.
if i_reguh-kunnr is not INITIAL.
SELECT a~smtp_addr
INTO TABLE i_email
FROM knvk AS k INNER JOIN
adr6 AS a ON
k~prsnr = a~persnumber
WHERE k~pafkt = 'Z0' AND
k~kunnr = i_reguh-kunnr.
endif.
IF sy-subrc = 0 .
TYPE-POOLS szadr.
DATA: l_addr1_complete TYPE szadr_addr1_complete,
l_adsmtp_line TYPE szadr_adsmtp_line.
clear l_cnt.
sort i_email.
delete ADJACENT DUPLICATES FROM i_email.
DESCRIBE TABLE i_email lines l_cnt.
if l_cnt > 0.
* default: print payment advice
c_finaa-nacha = '1'.
* check that address number is available
* IF NOT i_reguh-zadnr IS INITIAL.
* read complete address of vendor/customer
* CALL FUNCTION 'ADDR_GET_COMPLETE'
* EXPORTING
* addrnumber = i_reguh-zadnr
* IMPORTING
* addr1_complete = l_addr1_complete
* EXCEPTIONS
* OTHERS = 4.
*
* IF sy-subrc EQ 0.
* READ TABLE l_addr1_complete-adsmtp_tab INTO l_adsmtp_line INDEX 1.
* IF sy-subrc EQ 0
* AND NOT l_adsmtp_line-adsmtp-smtp_addr IS INITIAL.
* choose message type 'I'nternet and fill email address
c_finaa-nacha = 'I'.
* CONDENSE l_adsmtp_line-adsmtp-smtp_addr.
* c_finaa-intad = l_adsmtp_line-adsmtp-smtp_addr.
LOOP AT i_email INTO wa_email.
CONDENSE wa_email.
*** concat email address as mentioned in OSS note.
CONCATENATE c_finaa-intad wa_email INTO c_finaa-intad SEPARATED BY space.
AT FIRST.
CONDENSE c_finaa-intad.
ENDAT.
ENDLOOP.
C_FINAA-MAIL_SENSITIVITY = 'O'.
ELSE.
C_FINAA-MAIL_STATUS_ATTR = 'O'.
endif.
* ENDIF.
C_FINAA-MAIL_SEND_ADDR = 'AccountsPayable@aaaa.com'.
* ENDIF.
* ENDIF.
ELSE.
CLEAR c_finaa-intad.
c_finaa = l_finaa.
C_FINAA-MAIL_STATUS_ATTR = 'O'.
C_FINAA-MAIL_SEND_ADDR = 'AccountsPayable@aaaa.com'.
ENDIF.
* if email was not possible: try fax (message type 2)
IF c_finaa-nacha NE 'I'.
DATA: i_FAXNR TYPE STANDARD TABLE OF AD_FXNMBR, "AD_FAXNRCL,
wa_FAXNR TYPE AD_FXNMBR. "AD_FAXNRCL.
** Get mail address of Z0 Partner from KNVK table
** with passing vendor number.
if i_reguh-lifnr is not INITIAL.
SELECT a~FAXNR_CALL
INTO TABLE i_FAXNR
FROM knvk AS k INNER JOIN
adr3 AS a ON
k~prsnr = a~persnumber
WHERE k~pafkt = 'Z0' AND
k~lifnr = i_reguh-lifnr.
endif.
if i_reguh-kunnr is not INITIAL.
SELECT a~FAXNR_CALL
INTO TABLE i_FAXNR
FROM knvk AS k INNER JOIN
adr3 AS a ON
k~prsnr = a~persnumber
WHERE k~pafkt = 'Z0' AND
k~kunnr = i_reguh-kunnr.
endif.
LOOP AT I_FAXNR INTO WA_FAXNR.
CONDENSE WA_FAXNR.
IF NOT WA_FAXNR IS INITIAL.
I_REGUH-ZTLFX = WA_FAXNR.
EXIT.
ENDIF.
ENDLOOP.
IF NOT WA_FAXNR IS INITIAL.
IF NOT i_reguh-ztlfx IS INITIAL.
c_finaa-nacha = '2'. "Fax
c_finaa-tdschedule = 'IMM'. "Sofort
c_finaa-tdteleland = i_reguh-zland. "Land der Faxnummer
c_finaa-tdtelenum = i_reguh-ztlfx. "Faxnummer
* c_finaa-formc = 'ZFI_FAX_COVERLTR'. "SAPscript Deckblatt
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFUNCTION.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Currently the functionality is only availble if you use a seperate text
for the body of the mail (see note 1033893), or if you use one of the
following options in the exit 2040:
finaa-MAIL_SENSITIVITY
finaa-MAIL_IMPORTANCE <> space
finaa-MAIL_SEND_PRIO
finaa-MAIL_SEND_ADDR
finaa-MAIL_STATUS_ATTR
finaa-MAIL_BODY_TEXT
finaa-MAIL_OUTBOX_LINK
Please try to fill field finaa-MAIL_BODY_TEXT.
User | Count |
---|---|
106 | |
12 | |
10 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.