Calculate Due Date in ABAP is main requirement when dealing with invoices and payment of this invoice.
It helps you also to handle dunning by calculating the Due date and current date and set the dunning level.
First let’s define the different Account Type, then we will detail the SAP BAPI to use when retrieving Due Date.
Table of Contents
In order to determine the Due Date for an invoice, you can use the standard bapi ‘DETERMINE_DUE_DATE’. As input, it will take i_faede.
The output is e_faede and the duedate field is FAEDE-NETDT.
You way want to check also Step by Step Guide To Create Sap Down Payment with VIM
Before calculating the DueDate in SAP FI, the following Structure types as FAEDE should be filled.
The structure for Due Date input (FAEDE) is:
Fields | Description |
---|---|
SHKZG | Debit/Credit Indicator |
KOART | Account Type |
ZFBDT | Baseline Date for Due Date Calculation |
ZBD1T | Cash discount days 1 |
ZBD2T | Cash discount days 2 |
ZBD3T | Net Payment Terms Period |
REBZG | Number of the Invoice the Transaction Belongs to |
REBZT | Follow-On Document Type |
BLDAT | Document Date in Document |
NETDT | DueDate for Net Payment |
SK1DT | DueDate for Cash Discount 1 |
SK2DT | DueDate for Cash Discount 2 |
For more information about Finance module in SAP, check :
The second step is to set the Account Type. Check the first section for different type of Account in SAP Invoice.
To go deep into ABAP development for SAP FI, check the following book ABAP Development for Financial Accounting: Custom Enhancements.
The Account Type in SAP FI defines the type of SAP Account
The field in SAP Table is BSIS-KOART for Acct type in SAP.
In SAP FI, Account Type can have the following possible Values:
Check also SAP Invoice IDoc INVOIC2
Let’s give a sample ABAP Code with DETERMINE_DUE_DATE function call.
You can set FAEDE input from an entrie from BSIS. The result for the Due Date can found in FAEDE-NETDT.
Move-corresponding bsis to faede. " Call of DETERMINE_DUE_DATE CALL FUNCTION 'DETERMINE_DUE_DATE' EXPORTING i_faede = faede IMPORTING e_faede = faede EXCEPTIONS OTHERS = 1. " Calculated Due Date WRITE: 'Due Date' , faede-netdt ." due date
The following SAP BAPI can help retrieve more data for Payment information of a SAP Account in SAP FI
This function SD_PRINT_TERMS_OF_PAYMENT_SPLI (Preparation of Terms of Payment According to Table 052) is in the function group VPRI SD Print Functions.
The signature of SD_PRINT_TERMS_OF_PAYMENT_SPLI is :
FUNCTION SD_PRINT_TERMS_OF_PAYMENT_SPLI. *"---------------------------------------------------------------------- *"*"Lokale Schnittstelle: *" IMPORTING *" VALUE(BLDAT) LIKE VBRK-ERDAT DEFAULT 00000000 *" VALUE(BUDAT) LIKE VBRK-FKDAT DEFAULT 00000000 *" VALUE(CPUDT) LIKE VBRK-ERDAT DEFAULT 00000000 *" VALUE(LANGUAGE) LIKE NAST-SPRAS DEFAULT ' ' *" VALUE(TERMS_OF_PAYMENT) LIKE T052-ZTERM *" VALUE(WERT) LIKE ACCCR-WRBTR DEFAULT 00000000 *" VALUE(WAERK) LIKE VBRK-WAERK DEFAULT ' ' *" VALUE(FKDAT) LIKE VBRK-FKDAT DEFAULT 00000000 *" VALUE(SKFBT) LIKE ACCCR-SKFBT DEFAULT 00000000 *" VALUE(I_COMPANY_CODE) LIKE VBRK-BUKRS OPTIONAL *" VALUE(I_COUNTRY) LIKE VBRK-LAND1 OPTIONAL *" EXPORTING *" VALUE(BASELINE_DATE) LIKE VBRK-FKDAT *" TABLES *" TOP_TEXT_SPLIT STRUCTURE VTOPIS *" EXCEPTIONS *" TERMS_OF_PAYMENT_NOT_IN_T052 *" TERMS_OF_PAYMENT_NOT_IN_T052S *"----------------------------------------------------------------------
The standard Function module SD_PRINT_TERMS_OF_PAYMENT is for “Format Terms of Payment According to Table 052”.
Here the signature of this function:
FUNCTION SD_PRINT_TERMS_OF_PAYMENT. *"---------------------------------------------------------------------- *"*"Lokale Schnittstelle: *" IMPORTING *" VALUE(BLDAT) LIKE VBRK-ERDAT DEFAULT 00000000 *" VALUE(BUDAT) LIKE VBRK-FKDAT DEFAULT 00000000 *" VALUE(CPUDT) LIKE VBRK-ERDAT DEFAULT 00000000 *" VALUE(LANGUAGE) LIKE NAST-SPRAS DEFAULT ' ' *" VALUE(TERMS_OF_PAYMENT) LIKE T052-ZTERM *" VALUE(COUNTRY) LIKE KNA1-LAND1 DEFAULT ' ' *" VALUE(HOLDBACK) LIKE VBDKR-P_SPLIT DEFAULT ' ' *" VALUE(TOP_HOLDBACK_INFO) LIKE FPLTVB STRUCTURE FPLTVB *" OPTIONAL *" VALUE(DOCUMENT_CURRENCY) LIKE VBRK-WAERK DEFAULT ' ' *" EXPORTING *" VALUE(BASELINE_DATE) LIKE VBRK-FKDAT *" VALUE(PAYMENT_SPLIT) LIKE VBDKR-P_SPLIT *" VALUE(ZFBDT) LIKE VBDKR-ZFBDT *" TABLES *" TOP_TEXT STRUCTURE VTOPIS *" EXCEPTIONS *" TERMS_OF_PAYMENT_NOT_IN_T052 *"----------------------------------------------------------------------
SAP ISU Tables for Technical master data, for Billing Master Data, Billing and invoicing Tables?…
SAP Fiori 3 UX and Design of SAP Fiori Apps for SAP S/4HANA, SAP TechEd…
Dunning is the business practice of informing a customer of past due payment. Dunning letters…
SAP AP Tcodes & SAP AR Tcodes: House Banks Tcodes, Advance Payments or Down Payments,…
What are the main SAP Payment Terms Tables ? What are the related Tables in…
Work center consists of master data related to routing of products. It contains data related…