Automatic Payment Advice by email

作者:郑德鼎 约 4 分钟阅读 更新日期:2024-02-22 2 年前更新 标签:CO, FI, 工具, 技术, 财务

Technical Articles

Vanita Motwani Mody

Posted onDecember 31, 2018 1 minute read

Automatic Payment Advice by email

FollowRSS feedLike

2 Likes 17,328 Views 6 Comments

Before writing this blog, I came across so many posts and a lot of scattered information on this topic that I thought it might be beneficial to write a blog that contains this information in one place.

Requirement was to generate automatic payment advice when a payment is saved via F110 and email a sapscript form as a PDF attachment along with the mail body in the desired language. This can be easily implemented via BTE 00002040. Refer to SAP Note 836169 for more details.

I have listed all the steps below. Please note it is very important that the following customization is done. In our system this was with the default setting and the payment advice email was not getting generated.

Transaction FBZP

Select company code and Payment Method I.

Steps to program the changes –

FIBF Settings

Maintain the new Function module in FIBF->Settings->Process Modules->of a customer.

Maintain Email Body in S010:Create your text with email body for Text ID FIKO using transaction SO10. Transport the text using report RSTXTRAN.Refer to SAP Note 1033893

Function module changes: Copy FM SAMPLE_PROCESS_00002040 and make the changes below to send the email.REGUH-ZADNR contains the Payee’s Address Number. You may use FM ‘ADDR_GET_COMPLETE’ to get the actual email address of the vendor maintained or directly from table LFB1, depending on your specific requirement.Set c_finaa-formc with the actual form name.

Once these changes are implemented required emails should be sent out to the intended recipients, you can check this in transaction SOST.                                                                  Set c_finaa-mail_body_text with the name of the standard text with the mail body.                    Set c_finaa-intad with the email address details.

Sending Payment Advice to Multiple E-Mails Ids and Changing Subject line of payment advice using BTEs

By Venkat Reddy, Microexcel

Introduction

This article is intended to discuss 2 items on payment advice to Vendor-

1)     How to send payment advice to multiple e-mail ids.

2)     How to change Subject line of the payment advice.

When Accounts Payable team comes up with the requirement of sending payment advice to vendor above mentioned 2 points will be the first priority of requirements.

Based on SAP Note-1033893 we can achieve them by implementing BTE’s 2040 & 2050

Pre-Requisites : All FBZP configuration to send Payment Advice needs to be maintained.

Note – Please see the below mentioned link on how to implement BTE through FIBF in detail.

http://www.saptechnical.com/Tutorials/ExitsBADIs/Park/Index.htm

Step-by-Step Procedure to achieve

Step-1 Implementing BTE-2040 to send Payment Advice to Multiple E-Mail Ids

Go to T-Code – FIBF

Menu -> Settings -> Products -> of a customer

Create a New Entry as shown below –

Menu -> Settings -> Process Modules -> of a customer

Create a New Entry as shown below –

Through SE37 we need to copy the standard function module SAMPLE_PROCESS_00002040 to Z.

Source Code in the Function Module –

function zsample_process_00002040.

*"----------------------------------------------------------------------

*"*"Local Interface

*"  IMPORTING

*"     VALUE(I_REGUH) LIKE  REGUH STRUCTURE  REGUH OPTIONAL

*"  TABLES

*"      T_FIMSG STRUCTURE  FIMSG OPTIONAL

*"  CHANGING

*"     VALUE(C_FINAA) LIKE  FINAA STRUCTURE  FINAA OPTIONAL

*"----------------------------------------------------------------------

* data declaration for address routines

type-pools szadr.

data: l_addr1_complete type szadr_addr1_complete,

l_adfax_line     type szadr_adfax_line,

l_adsmtp_line    type szadr_adsmtp_line.

DATA: lv_email(130) type c.

* 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

call function 'ADDR_GET_COMPLETE'

exporting

addrnumber     = i_reguh-zadnr

importing

addr1_complete = l_addr1_complete

exceptions

others         = 4.

if sy-subrc eq 0.

* Email to Vendor As Default.

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

c_finaa-namep = 'PAYMENT ADVICE'.

concatenate l_adsmtp_line-adsmtp-smtp_addr 'test@abcde.com'

into lv_email separated by space.

c_finaa-intad = lv_email.

elseif sy-subrc <> 0.

* FAX communication “ Uncomment if Payment Advice needs to sent by FAX

** Check if Fax number exists.

** Fax for payment Advice(2nd fax)

*          clear l_adfax_line.

*          read table l_addr1_complete-adfax_tab into l_adfax_line index 2.

*          if sy-subrc <> 0.

*            read table l_addr1_complete-adfax_tab into l_adfax_line index 1.

*          endif.

** Fax End

*          if sy-subrc eq 0

*          and not l_adfax_line-adfax-fax_number is initial.

*            c_finaa-nacha      = '2'.                 "Fax

*            c_finaa-tdschedule = 'IMM'.               "Sofort

*            c_finaa-tdteleland = l_adfax_line-adfax-country.

*            c_finaa-tdtelenum  = l_adfax_line-adfax-fax_number.

**        c_finaa-formc      = 'FI_FAX_COVER_A4'.   "SAPscript Deckblatt

*          endif.

endif.

endif.

endif.

endfunction.

Sending Payment Advice to Multiple E-Mails Ids and Changing Subject line of payment advice using BTEs

...Previous

Note– With the above code Payment advice is sent through E-Mail only, if both E-Mail and Fax is maintained for a vendor in vendor master then E-Mail will be given first preference.

Go to transaction SO10.

In the source code of the function module for the parameter namep it is maintain as ‘PAYMENT ADVICE’, So standard text needs to be created by 'Payment advice' in order to call the E-mail body.

c_finaa-namep = 'PAYMENT ADVICE'.

By clearing Payments through F110 transaction code then the payment advices will be sent to Vendor and also to the id maintained in the function module.

Checking E-Mails through SOST

This confirms Payment Advice is sent to 2 email ids simultaneously.

E-Mail Body

Step-2 Implementing BTE-2050 to change Payment Advice subject line

Before Implementing in SOST Subject line of Payment Advice -

After Implementing BTE-2050

Follow the same steps to create product and process module same as BTE-2040.

Create the product and Process Module

Copy function module SAMPLE_PROCESS_00002050 to ZSAMPLE_PROCESS_00002050.

Source Code in the Function Module –

FUNCTION ZSAMPLE_PROCESS_00002050.

*"----------------------------------------------------------------------

*"*"Local Interface

*"  IMPORTING

*"     VALUE(I_REGUH) LIKE  REGUH STRUCTURE  REGUH

*"     VALUE(I_GJAHR) LIKE  REGUD-GJAHR

*"     VALUE(I_NACHA) LIKE  FINAA-NACHA

*"     VALUE(I_AFORN) LIKE  T042B-AFORN

*"  CHANGING

*"     VALUE(C_ITCPO) LIKE  ITCPO STRUCTURE  ITCPO

*"     VALUE(C_ARCHIVE_INDEX) LIKE  TOA_DARA STRUCTURE  TOA_DARA

*"       DEFAULT SPACE

*"     VALUE(C_ARCHIVE_PARAMS) LIKE  ARC_PARAMS STRUCTURE  ARC_PARAMS

*"       DEFAULT SPACE

*"----------------------------------------------------------------------

DATA: lv_date(10) type c,

lv_Subline type string.

lv_date = C_ITCPO-TDTITLE+25(10).

Concatenate 'Payment Advice from XXXXX' “ Added XXXXX to the subject line

lv_date

into lv_Subline

separated by space.

IF I_NACHA EQ 'I'.

C_ITCPO-TDTITLE = lv_Subline. ENDIF.
ENDFUNCTION.

After clearing payments through F110 in SOST E-mails will be with added subject line.

郑德鼎

关于作者:郑德鼎

企业信息化与 SAP 技术顾问,长期专注 SAP ABAP、FI/CO、MM、SD 等模块的技术分享与实战经验总结。查看更多介绍

来源说明:本文内容由「Automatic Payment Advice by email.docx」整理生成,仅用于内部技术分享与学习交流。