Hello SAPers!
I’ve planned to write this post for some time, but began working on it just recently. I hope it would be of interest for you and will give some new insights on note to payee functionality in SAP. This post contains a lot of technical details, if you have any questions or need some clarification, feel free to post them as comments.
1.1 Introduction
Note to payee is a part of a data medium that contains additional information about payments, which might be relevant for payee or is required legally. As a rule, note to payee is transferred in fields of data medium, which from bank’s perspective are freely definable. That means that if there are no explicit legal or technical bank platform requirements, you can fill it with whatever information you want. Typical usage cases:
You can use a lot of standard mapping options in DMEE-tree to generate note-to-payee quite flexibly, but you can also use dedicated note-to-payee functionality to achieve greater flexibility.
1.2 Define technical attributes of note to payee
Technical attributes of note to payee should be defined during creation of payment medium format (hereinafter referred to as PMW). Use the following menu path or transaction OBPM1 to access the customizing:
SPRO → Financial Accounting (new) → Accounts Receivable and Accounts Payable → Business Transactions → Outgoing Payments → Automatic Outgoing Payments → Payment Media → Make Settings for Payment Medium Formats from PMW → Create Payment Medium Formats.
Select your PMW and navigate to tab “Text Fields for Reference Information”:
Add an entry with note to payee type 1, indicate the length of the field and number of fields. Length of note to payee field usually depends on the requirements of your bank. Number of fields depends on the approach to payments:
if number of lines is not enough, you’ll encounter error BFIBL02231 “Payment advice note created for payment document XXXXXXXXXX” and note to payee will not be generated properly.
1.3 Create note to payee
Note to payee is a functionality of SAP that allows to creation and storing of note to payee information (i.e. payment details) that can be used in payment file. Note to payee can be defined via customizing or with help of custom FM. Launch t-code OBPM2 and define note to payee using FM or using customizing. This post will focus on note to payee using FM-based approach, customizing-based note to payee will be covered in upcoming post.
Menu path to access note to payee settings is provided below:
SPRO → Financial Accounting (new) → Accounts Receivable and Accounts Payable → Business Transactions → Outgoing Payments → Automatic Outgoing Payments → Payment Media → Make Settings for Payment Medium Formats from PMW → Adjust Note to Payee.
If note to payee is FM-based, no additional customizing is necessary in this view. Additional customizing steps for customizing-based note to payee will be described later in a separate paragraph.
1.4 Assign note to payee to payment method
Note to payee should be assigned to a payment method on country level per origin in FBZP (example below):
The purpose behind this customizing is that note to payee can be generated differently depending on the origin of payment data. Origin refers to the source of payment data e.g.:
Please check out OSS-note 1977304 “FBZP: Explanation of origins when assigning a note to payee” for details on origins in APP.
1.5 Create FM to build note to payee
FM should be created by copy of standard FM FI_PAYMEDIUM_SAMPLE_DETAILS which provides an interface to build note to payee details. This FM will be triggered during proposal / payment run when option “Create payment medium” is ticked off. The result of FM execution will be saved into database table DFPAYHT – it will store one or more line for each payment document and might store additional technical information as well.
Sample source code for FM that generates note to payee can be found below:
function zdmee_build_note_to_payee.
*"--------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_FPAYH) LIKE FPAYH STRUCTURE FPAYH
*" VALUE(I_FPAYHX) LIKE FPAYHX STRUCTURE FPAYHX
*" TABLES
*" T_FPAYP STRUCTURE FPAYP
*" T_PAYMENT_DETAILS STRUCTURE FPM_PAYD
*" CHANGING
*" REFERENCE(C_XAVIS_REQ)
*"--------------------------------------------------------------------
data:
ls_note type fpm_payd,
lv_note type string.
constants: lc_inv type string value 'INV'.
field-symbols: <doc> like line of t_fpayp.
ls_note-type = 1.
ls_note-line = 1.
ls_note-text = lc_inv.
ls_note-length = strlen( ls_note-text ).
loop at t_fpayp assigning <doc>.
clear: lv_note.
append ls_note to t_payment_details.
lv_note = <doc>-xblnr.
ls_note-length = strlen( lv_note ).
ls_note-text = lv_note.
add 1 to ls_note-line.
append ls_note to t_payment_details.
endloop.
endfunction.
1.1.6 Create FM for DMEE-tree
Another FM (e.g. ZDMEE_NOTE_TO_PAYEE) should be created to retrieve note to payee details from DFPAYHT table and link it DMEE-tree. From technical perspective this FM is concatenating all lines from table DFPAYHT into one line.
This FM should be created via copy of standard template DMEE_EXIT_TEMPLATE_ABA. Please check out my post on “Exit modules in DMEE” for more details on this mapping options in DMEE-tree. Proposed source code for this FM can be found below.
function zdmee_note_to_payee.
*"--------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_TREE_TYPE) TYPE DMEE_TREETYPE_ABA
*" VALUE(I_TREE_ID) TYPE DMEE_TREEID_ABA
*" VALUE(I_ITEM)
*" VALUE(I_PARAM)
*" VALUE(I_UPARAM)
*" REFERENCE(I_EXTENSION) TYPE DMEE_EXIT_INTERFACE_ABA
*" EXPORTING
*" REFERENCE(O_VALUE)
*" REFERENCE(C_VALUE)
*" REFERENCE(N_VALUE)
*" REFERENCE(P_VALUE)
*" TABLES
*" I_TAB
*"--------------------------------------------------------------------
data:
result(160) type c,
linetab type standard table of text_fpm with header line.
field-symbols:
<fs> type dmee_tab_type_aba.
loop at i_tab assigning <fs>.
linetab = <fs>-text.
append linetab.
endloop.
concatenate lines of linetab into result separated by space.
c_value = result.
endfunction.
Sample note to payee generated by this FM can be found below:
This example might be rather simple, but I hope it provides enough details to understand where to start if you would like to implement more complicated logic for note to payee.
Your suggestions and comments are welcome!
Regards,
Bohdan Petrushchak
Okumaya devam et...
I’ve planned to write this post for some time, but began working on it just recently. I hope it would be of interest for you and will give some new insights on note to payee functionality in SAP. This post contains a lot of technical details, if you have any questions or need some clarification, feel free to post them as comments.
1.1 Introduction
Note to payee is a part of a data medium that contains additional information about payments, which might be relevant for payee or is required legally. As a rule, note to payee is transferred in fields of data medium, which from bank’s perspective are freely definable. That means that if there are no explicit legal or technical bank platform requirements, you can fill it with whatever information you want. Typical usage cases:
- To provide list of vendor invoice numbers, which are being paid (e.g. CITI Direct);
- To provide information on payment purpose and VAT amount paid (e.g. typical business practice in Ukraine, Russia);
- To provide specific legally required details (e.g. typically budget-related payments require additional details).
You can use a lot of standard mapping options in DMEE-tree to generate note-to-payee quite flexibly, but you can also use dedicated note-to-payee functionality to achieve greater flexibility.
1.2 Define technical attributes of note to payee
Technical attributes of note to payee should be defined during creation of payment medium format (hereinafter referred to as PMW). Use the following menu path or transaction OBPM1 to access the customizing:
SPRO → Financial Accounting (new) → Accounts Receivable and Accounts Payable → Business Transactions → Outgoing Payments → Automatic Outgoing Payments → Payment Media → Make Settings for Payment Medium Formats from PMW → Create Payment Medium Formats.
Select your PMW and navigate to tab “Text Fields for Reference Information”:
Add an entry with note to payee type 1, indicate the length of the field and number of fields. Length of note to payee field usually depends on the requirements of your bank. Number of fields depends on the approach to payments:
- if you pay each document separately, it would be enough to set up this value to 1 (i.e. one note to payee for each payment document);
- if you use grouped payments (i.e. one payment for many vendor invoices), number of fields should be high enough to allow creation and storing of note to payee details for each paid invoice.
if number of lines is not enough, you’ll encounter error BFIBL02231 “Payment advice note created for payment document XXXXXXXXXX” and note to payee will not be generated properly.
1.3 Create note to payee
Note to payee is a functionality of SAP that allows to creation and storing of note to payee information (i.e. payment details) that can be used in payment file. Note to payee can be defined via customizing or with help of custom FM. Launch t-code OBPM2 and define note to payee using FM or using customizing. This post will focus on note to payee using FM-based approach, customizing-based note to payee will be covered in upcoming post.
Menu path to access note to payee settings is provided below:
SPRO → Financial Accounting (new) → Accounts Receivable and Accounts Payable → Business Transactions → Outgoing Payments → Automatic Outgoing Payments → Payment Media → Make Settings for Payment Medium Formats from PMW → Adjust Note to Payee.
If note to payee is FM-based, no additional customizing is necessary in this view. Additional customizing steps for customizing-based note to payee will be described later in a separate paragraph.
1.4 Assign note to payee to payment method
Note to payee should be assigned to a payment method on country level per origin in FBZP (example below):
The purpose behind this customizing is that note to payee can be generated differently depending on the origin of payment data. Origin refers to the source of payment data e.g.:
- FI-AP – payment of vendor items (from F110);
- FI-AR – payment of customer items (from F110);
- FI-AP-PR – vendor payment requests (from F111);
- FI-AR-PR – customer payment requests (from F111);
- FI-BL – other payments (e.g. free-form payments, also triggered in F111).
Please check out OSS-note 1977304 “FBZP: Explanation of origins when assigning a note to payee” for details on origins in APP.
1.5 Create FM to build note to payee
FM should be created by copy of standard FM FI_PAYMEDIUM_SAMPLE_DETAILS which provides an interface to build note to payee details. This FM will be triggered during proposal / payment run when option “Create payment medium” is ticked off. The result of FM execution will be saved into database table DFPAYHT – it will store one or more line for each payment document and might store additional technical information as well.
Sample source code for FM that generates note to payee can be found below:
function zdmee_build_note_to_payee.
*"--------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_FPAYH) LIKE FPAYH STRUCTURE FPAYH
*" VALUE(I_FPAYHX) LIKE FPAYHX STRUCTURE FPAYHX
*" TABLES
*" T_FPAYP STRUCTURE FPAYP
*" T_PAYMENT_DETAILS STRUCTURE FPM_PAYD
*" CHANGING
*" REFERENCE(C_XAVIS_REQ)
*"--------------------------------------------------------------------
data:
ls_note type fpm_payd,
lv_note type string.
constants: lc_inv type string value 'INV'.
field-symbols: <doc> like line of t_fpayp.
ls_note-type = 1.
ls_note-line = 1.
ls_note-text = lc_inv.
ls_note-length = strlen( ls_note-text ).
loop at t_fpayp assigning <doc>.
clear: lv_note.
append ls_note to t_payment_details.
lv_note = <doc>-xblnr.
ls_note-length = strlen( lv_note ).
ls_note-text = lv_note.
add 1 to ls_note-line.
append ls_note to t_payment_details.
endloop.
endfunction.
1.1.6 Create FM for DMEE-tree
Another FM (e.g. ZDMEE_NOTE_TO_PAYEE) should be created to retrieve note to payee details from DFPAYHT table and link it DMEE-tree. From technical perspective this FM is concatenating all lines from table DFPAYHT into one line.
This FM should be created via copy of standard template DMEE_EXIT_TEMPLATE_ABA. Please check out my post on “Exit modules in DMEE” for more details on this mapping options in DMEE-tree. Proposed source code for this FM can be found below.
function zdmee_note_to_payee.
*"--------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_TREE_TYPE) TYPE DMEE_TREETYPE_ABA
*" VALUE(I_TREE_ID) TYPE DMEE_TREEID_ABA
*" VALUE(I_ITEM)
*" VALUE(I_PARAM)
*" VALUE(I_UPARAM)
*" REFERENCE(I_EXTENSION) TYPE DMEE_EXIT_INTERFACE_ABA
*" EXPORTING
*" REFERENCE(O_VALUE)
*" REFERENCE(C_VALUE)
*" REFERENCE(N_VALUE)
*" REFERENCE(P_VALUE)
*" TABLES
*" I_TAB
*"--------------------------------------------------------------------
data:
result(160) type c,
linetab type standard table of text_fpm with header line.
field-symbols:
<fs> type dmee_tab_type_aba.
loop at i_tab assigning <fs>.
linetab = <fs>-text.
append linetab.
endloop.
concatenate lines of linetab into result separated by space.
c_value = result.
endfunction.
Sample note to payee generated by this FM can be found below:
This example might be rather simple, but I hope it provides enough details to understand where to start if you would like to implement more complicated logic for note to payee.
Your suggestions and comments are welcome!
Regards,
Bohdan Petrushchak
Okumaya devam et...