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.
Account Type in SAP FI
The Account Type in SAP FI defines the type of SAP Account
The field in SAP Table is BSIS-KOART for Acct type
- A : Assets
- D : Customers
- K :Vendors
- M :Material
- S :G/L accounts
Check also Outbound Invoice Idoc
Calculate Due Date
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 due date field is FAEDE-NETDT.
Prepare Calculate Due Date Structure
Before calculating the Due Date in SAP FI, the following Structure types as FAEDE should be filled:
- 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,Due Date for Net Payment
- SK1DT,Due Date for Cash Discount 1
- SK2DT,Due Date for Cash Discount 2
The second step is to set the Account Type. Check the first section for different type of Account in SAP Invoice.
ABAP Sample for DETERMINE_DUE_DATE
You can set FAEDE input from an entrie from BSIS.
Move-corresponding bsis to faede.
" Call of DETERMINE_DUE_DATE
CALL FUNCTION 'DETERMINE_DUE_DATE'
i_faede = faede
e_faede = faede
OTHERS = 1.
" Calculated Due Date
WRITE: 'Due Date' , faede-netdt ." due date
Other BAPI for Payment Dates Calculation
The following SAP BAPI can help retrieve more data for Payment information of a SAP Account in SAP FI
- SD_PRINT_TERMS_OF_PAYMENT used to retrieve single payment term
- SD_PRINT_TERMS_OF_PAYMENT_SPLI can be used to retrieve multiple payment terms at once