Solução de envio por email utilizando o programa RFFOBR_D.
Utilizar BTE processo 2040
Marcar "controle de impressão" - > editar avisos
Informar formulário de impressao.
Na BTE
TYPES: BEGIN OF tp_chect , "vornumerierte Schecks: zum
zbukr TYPE reguh-zbukr, "Zahlungsbeleg gehörende Schecknr
vblnr TYPE reguh-vblnr, "prenumbered checks: check number
chect TYPE regud-chect, "of a payment documents
END OF tp_chect.
DATA: lt_chect TYPE TABLE OF tp_chect.
DATA: ls_regup_aux TYPE regup.
FIELD-SYMBOLS: <lfss_regup> TYPE regup,
<lfss_regud> TYPE regud,
<lfst_chect> TYPE ANY TABLE.
ASSIGN ('(RFFOBR_D)REGUP') TO <lfss_regup>.
CHECK sy-subrc = 0.
ASSIGN ('(RFFOBR_D)REGUD') TO <lfss_regud>.
CHECK sy-subrc = 0.
ASSIGN ('(RFFOBR_D)tab_schecks[]') TO <lfst_chect>.
CHECK sy-subrc = 0.
lt_chect[] = <lfst_chect>.
SELECT SINGLE *
INTO ls_regup_aux
FROM regup
WHERE laufd EQ is_reguh-laufd
AND laufi EQ is_reguh-laufi
AND xvorl EQ is_reguh-xvorl
AND zbukr EQ is_reguh-zbukr
AND lifnr EQ is_reguh-lifnr
AND kunnr EQ is_reguh-kunnr
AND empfg EQ is_reguh-empfg
AND vblnr EQ is_reguh-vblnr.
<lfss_regup>-zfbdt = ls_regup_aux-zfbdt.
<lfss_regup>-zbd1t = ls_regup_aux-zbd1t.
<lfss_regup>-zbd2t = ls_regup_aux-zbd2t.
<lfss_regup>-zbd3t = ls_regup_aux-zbd3t.
<lfss_regup>-bldat = ls_regup_aux-bldat.
CALL FUNCTION 'J_1B_FI_NETDUE'
EXPORTING
zfbdt = <lfss_regup>-zfbdt
zbd1t = <lfss_regup>-zbd1t
zbd2t = <lfss_regup>-zbd2t
zbd3t = <lfss_regup>-zbd3t
IMPORTING
duedate = <lfss_regud>-ausft.
DATA: lt_regup_br TYPE TABLE OF regup.
APPEND <lfss_regup> TO lt_regup_br.
CLEAR <lfss_regud>-chect.
READ TABLE lt_chect INTO DATA(ls_chect)
WITH KEY zbukr = is_reguh-zbukr
vblnr = is_reguh-vblnr.
IF sy-subrc = 0.
<lfss_regud>-chect = ls_chect-chect.
ENDIF.
CALL FUNCTION 'BOLETO_DATA'
EXPORTING
line_reguh = is_reguh
TABLES
itab_regup = lt_regup_br
CHANGING
line_regud = <lfss_regud>.
SELECT SINGLE fornr
INTO @DATA(l_fornr)
FROM zfi_cfg
WHERE bukrs EQ @is_reguh-zbukr
AND hbkid EQ @is_reguh-hbkid.
IF sy-subrc = 0.
cs_finaa-fornr = l_fornr. "Formulário por banco
ENDIF.
SELECT prsnr, adrnr
INTO TABLE @DATA(lt_addr)
FROM kna1 AS a INNER JOIN
knvk AS b
ON a~kunnr EQ b~kunnr
WHERE a~kunnr EQ @is_reguh-kunnr
AND abtnr EQ '0009'.
IF lt_addr[] IS NOT INITIAL.
SELECT adr6~smtp_addr,
adrt~remark
FROM adr6
INNER JOIN adrt
ON adrt~addrnumber EQ adr6~addrnumber
AND adrt~persnumber EQ adr6~persnumber
AND adrt~consnumber EQ adr6~consnumber
INTO TABLE @DATA(lt_email)
FOR ALL ENTRIES IN @lt_addr
WHERE adr6~addrnumber EQ @lt_addr-adrnr
AND adrt~comm_type EQ 'INT'
AND adrt~persnumber EQ @lt_addr-prsnr.
DATA(ls_email) = lt_email[ remark = 'BOLETO' ].
IF ( sy-subrc <> 0 ) OR
( sy-subrc = 0 AND ls_email-smtp_addr IS INITIAL ).
ls_email = lt_email[ remark = 'NFE' ].
IF ( sy-subrc <> 0 ) OR
( sy-subrc = 0 AND ls_email-smtp_addr IS INITIAL ).
ls_email = lt_email[ 1 ].
ENDIF.
ENDIF.
IF sy-subrc = 0 AND ls_email-smtp_addr IS NOT INITIAL.
cs_finaa-intad = ls_email-smtp_addr.
ENDIF.
ENDIF.
SELECT SINGLE low
INTO @DATA(l_low)
FROM tvarvc
WHERE name EQ 'ZFI_EMAIL_FI_DEPT'
AND type EQ 'P'.
"Email com cópia para financeiro
IF sy-subrc = 0 AND l_low IS NOT INITIAL.
cs_finaa-intad_cc = l_low.
ENDIF.
cs_finaa-nacha = 'I'.
Nenhum comentário:
Postar um comentário