SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow


Display Sales Invoice Due Date on SAP Smartform Output using NET_DUE_DATE_GET Function Module


On a SAP Smarform document for SAP Sales output, I had to display due date information. When I checked sample Smartform documents I see that using ABAP function module FI_FIND_PAYMENT_CONDITIONS and NET_DUE_DATE_GET, ABAP developers can get due date information on to the SAP Smartform invoice output easily.

FI_FIND_PAYMENT_CONDITIONS is used to determine cash discount using ZTERM and document, posting, CPU, base date
The required input parameters are terms of payment key, document date, posting date.
Optional parameters are system date, base date, function class from transaction control, etc.

Export parameters of the ABAP function module fi_find_payment_conditions is payment terms work area, calculated base date and cash discount.

data :
 lt_sklin type SKLIN ,
 lv_zfbdt type BSEG-ZFBDT,
 lv_FAEDT type RFPOS-FAEDT,
 lv_zbd1t type BSID-ZBD1T,
 lv_ZBD2T type BSID-ZBD2T,
 lv_ZBD3T type BSID-ZBD3T.

call function 'FI_FIND_PAYMENT_CONDITIONS'
EXPORTING
 i_zterm = IS_BIL_INVOICE-HD_GEN-TERMS_PAYM
 i_bldat = IS_BIL_INVOICE-HD_GEN-BIL_DATE
 i_budat = IS_BIL_INVOICE-HD_GEN-BIL_EDATE
 I_CPUDT = SY-DATLO
IMPORTING
* E_T052 =
 E_ZFBDT = lv_zfbdt " Calculated base date, for example 20080717
 E_SKLIN = lt_sklin
* E_XSPLT =
EXCEPTIONS
 TERMS_INCORRECT = 1
 TERMS_NOT_FOUND = 2
 NO_DATE_ENTERED = 3
 NO_DAY_LIMIT_FOUND = 4
 OTHERS = 5
Code

As seen in below ABAP debug screenshot during Smartform execution, the ZTAG1 cash discount days returns 15 days.

abap-internal-table-lt_sklin-for-payment-conditions





NET_DUE_DATE_GET ABAP function module calculates the due date based on the relevant sales invoice information.

lv_zbd1t = lt_sklin-ZTAG1.
lv_ZBD2T = lt_sklin-ZTAG2.
lv_ZBD3T = lt_sklin-ZTAG3.

call function 'NET_DUE_DATE_GET'
EXPORTING
 i_zfbdt = lv_zfbdt " 20080717
 i_zbd1t = lv_zbd1t " Cash discount days 1, for example 015
 i_zbd2t = lv_ZBD2T " Cash discount days 2, for example 000
 i_zbd3t = lv_ZBD3T " Net Payment Terms Period, ie. 000
 i_shkzg = 'S' " Debit/Credit Indicator: H Credit and S Debit
 i_rebzg = 'X' " Number of the Invoice the Transaction Belongs to
 I_KOART = 'D' " Account type
IMPORTING
 E_FAEDT = lv_FAEDT " Net Due Date
Code

Possible account types used in SAP are listed below under KOART data type:

KOART Account type
A Assets
D Customers
K Vendors
M Material
S G/L accounts

And the sample NET_DUE_DATE_GET ABAP function module call resulted with the due date variable lv_FAEDT as follows :

lv_FAEDT = 20080801



SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.