Technical Articles
How to trigger a custom e-mail for Automatic Payment Advice ? And How to debug Automatic Payment advice program (F110).
The payment run process is an accounts payable process that is used to handle payments to vendors. The process is called an automatic payment program.
Automatic Payment Program (F110) is used to do the clear the invoices and post the payments. F110 is the standard t-code for doing the same.
Payment Advice:
A payment advice note is a document or letter of communication sent by a customer or buyer to businesses that states that an invoice has been paid to cheque, NEFT, RTGS, or by any means of electronic transfers, etc.,
It is a letter of communication that acknowledges the seller as to which outstanding invoices have been cleared by the buyer and by what means. Therefore, a payment advice note can be handy when it comes to matching payments to an invoice.
BTE Configuration steps:
Transaction code: FIBF
Link the newly created custom function module(ZFM_VENDOR_REM.) to the BTE.
The custom function module can be specified following the steps below.
Create A Product:
Navigate as shown below: –
In FIBF > Settings > Products > Of a customer.
Click On New Entries to create new customer products:
Update the following And Click Save :
In the image below, created a new product called “ZPMYADV” described as “Email Payment Advice for Vendor”. Note that you can leave the A or Active checkbox blank if you are not yet testing.
Link product and Zfunction module to the BTE process:
Go to Transaction code: FIBF
Navigate as shown below: –
In FIBF > Settings > Process Modules> Of a customer.
Click on New Entries:
Update the following update process 00002040 with the zfunction module(ZFM_VENDOR_REM) or function module(SAMPLE_PROCESS_00002040) and the product we created in the earlier step:
Above, we see that New Product “ZPMYADV”, the custom function module, and the BTE process was entered as new entry. Thus, linking the custom functionality to the BTE.
Click Save.
Write below custom code in the above mentioned FM – ZFM_VENDOR_REM
DATA: ls_addr1_complete TYPE szadr_addr1_complete,
ls_adsmtp_line TYPE szadr_adsmtp_line,
lv_adrnr TYPE adrnr.
CONSTANTS: lc_i TYPE char1 VALUE ‘I’,
lc_so10 TYPE char20 VALUE ‘ZRTR_TEXT_REMITTANCE’,
lc_form TYPE char20 VALUE ‘ZAF_RTR_Remittance’.
lv_adrnr = i_reguh–zadnr.
IF NOT lv_adrnr IS INITIAL.
* read complete address of vendor/customer
CALL FUNCTION ‘ADDR_GET_COMPLETE’
EXPORTING
addrnumber = lv_adrnr
IMPORTING
addr1_complete = ls_addr1_complete
EXCEPTIONS
OTHERS = 4.
IF sy–subrc EQ 0.
READ TABLE ls_addr1_complete–adsmtp_tab INTO ls_adsmtp_line INDEX 1.
IF sy–subrc = 0 AND NOT ls_adsmtp_line–adsmtp–smtp_addr IS INITIAL.
c_finaa–nacha = lc_i.
c_finaa–namep = lc_so10.
c_finaa–intad = ls_adsmtp_line–adsmtp–smtp_addr.
c_finaa–mail_body_text = lc_so10.
ENDIF.
ELSE.
MESSAGE ID sy–msgid TYPE sy–msgty NUMBER sy–msgno WITH sy–msgv1 sy–msgv2 sy–msgv3.
ENDIF.
ENDIF.
How to debug Automatic Payment advice program (F110).
If you ever tried do debug the automatic payment program (F110), you had realized, it’s not that easy like at other SAP programs. The reason is, F110 creates a background job, where the payment items are processed. There are a handful of ways, to debug your payment job, in the following I will describe one of them. Let’s dive into it and learn, how to do it …
How to debug F110
Breakpoint for XDEBUG
First of all, to be able to activate debugging for F110, you need to change a variable at the payment program. Run SE38 and navigate to program F110MAIN and search for XDEBUG.
set breakpoint the change XDEBUG variable
Create a breakpoint to stop at this program line.
Job Scheduling
Next step, you have to schedule your payment job into the future. This is necessary, to be able to run the background job in debugging mode.
Schedule Automatic Payment
Background Job Debugging
Once, the background job is scheduled, run SM37, select your created F110 job and run command JDBG into the command-field. The same function can be selected under menu Extras / Debug Job.
select background job and run job debugging
Activate Debugging
The job will start immediately. Continue with F8 and the debugger will stop at your breakpoint created before.
Now you have to change the variable XDEBUG to “X”.
Debug
Now you can run the program to your code of interest, which you want to debug.
Final words
You can not debug F110 as easy as other SAP programs, but with a little bit of extra work, you get it done without any problems.
Very Informative and detailed steps defined.