Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Standard  FBL1N transaction fetches the vendor line item display based on posting date. When there is a requirement to fetch customer line items based on document date, a custom enhancement needs to be developed.

To make them work based on document date (To fetch records based on BLDAT-Document date) enhancement needs to be developed in the logical database.The logical database holds all the structures. Here we cannot enhance the structures and nodes directly. Only the source code program of the database can only be enhanced.

By using submit functionality (passing vendor,open items date) in  custom z reports ,records based on the posting date will only be fetched. But in order to fetch open items based on document date(BLDAT), enhancement needs to be done. The standard transaction code FBL1N cannot be enhanced to accomodate this functionality. The standard FBL5N fetches the customer line item display based on posting date(key date).

The enhancement has to be implemented in the logical database.

Go to SE36. For FBL1N(Vendor) KDF is the logical database. Go to source code/Database program.


 

Enhancement spots will be available. Create enhancement implementations. The databases should be enhanced(XBSID , XBSAD). These two structures need to be enhanced to accommodate this functionality as XBSID and XBSAD holds the document date.



Enhancement needs to be applied at 2 areas.

1.Put the below enhancement LOGIC in PERFORM update_xbsak. (towards the end) Endform.

Find the detailed code snippet .

ENHANCEMENT 2  ZVENDOR_AGEING.    "active version
*** Considering document date instead of posting date in ZFI_AP_AGEING
** IF ( SY-TCODE = 'ZFI_VENDOR_AGEING' ) .
**REFRESH XBSAK.
*** Variante 1: Offene Posten zu einem bestimmten Stichtag
** if KD_OPOPT = 'X' and KD_APOPT ne 'X'.
** if B0SG-XNOPL is initial.
** select (BSIK_FIELDS) from BSAK
** into corresponding fields of table XBSAK
** for all entries in K_LIFNR
** where LIFNR eq K_LIFNR-LOW
** and BUKRS in KD_BUKRS
*** AND GJAHR IN KD_GJAHR
*** AND AUGDT BETWEEN '00010101'
*** AND '99991231'
** and BlDAT in KD_BUDAT
** and BlDAT le KD_STIDA
** and AUGDT gt KD_STIDA
** and ZUONR in KD_ZUONR
** and UMSKZ in KD_UMSKZ
** and SHKZG in KD_SHKZG
** and BSCHL in KD_BSCHL
** and (BSIK_WHERE).
** endif.
** endif. "Variante 1
*** Variante 2: Ausgegl. Posten in einem Datumsintervall
** if KD_OPOPT ne 'X' and KD_APOPT = 'X'.
** select (BSIK_FIELDS) from BSAK
** into corresponding fields of table XBSAK
** for all entries in K_LIFNR
** where LIFNR eq K_LIFNR-LOW
** and BUKRS in KD_BUKRS
*** AND GJAHR IN KD_GJAHR
*** AND AUGDT BETWEEN '00010101'
*** AND '99991231'
** and BUDAT in KD_BUDAT
** and AUGDT in KD_AUGDT
** and ZUONR in KD_ZUONR
** and UMSKZ in KD_UMSKZ
** and SHKZG in KD_SHKZG
** and BSCHL in KD_BSCHL
** and (BSIK_WHERE).
** endif. "Variante 2
*** Variante 3: Variante 1 + 2 gleichzeitig
** if KD_OPOPT eq 'X' and KD_APOPT eq 'X'.
** select (BSIK_FIELDS) from BSAK
** into corresponding fields of XBSAK
** for all entries in K_LIFNR
** where LIFNR eq K_LIFNR-LOW
** and BUKRS in KD_BUKRS
*** AND GJAHR IN KD_GJAHR
*** AND AUGDT BETWEEN '00010101'
*** AND '99991231'
** and BUDAT in KD_BUDAT
** and BUDAT le KD_STIDA
*** AND AUGDT GT KD_STIDA
*** OR AUGDT IN KD_AUGDT
** and ZUONR in KD_ZUONR
** and UMSKZ in KD_UMSKZ
** and SHKZG in KD_SHKZG
** and BSCHL in KD_BSCHL
** and (BSIK_WHERE).
** check XBSAK-AUGDT gt KD_STIDA or XBSAK-AUGDT in KD_AUGDT.
** append XBSAK.
** endselect.
** endif. "Variante 3
*** Variante 4 (aus RFITEMAR): AP mit Stichtag und Ausgleichszeitraum
** if KD_OPOPT ne 'X' and KD_APOPT ne 'X'.
** select (BSIK_FIELDS) from BSAK
** into corresponding fields of table XBSAK
** for all entries in K_LIFNR
** where LIFNR eq K_LIFNR-LOW
** and BUKRS in KD_BUKRS
*** AND GJAHR IN KD_GJAHR
*** AND AUGDT BETWEEN '00010101'
*** AND '99991231'
** and BUDAT in KD_BUDAT
** and AUGDT gt KD_STIDA
** and AUGDT in KD_AUGDT
** and ZUONR in KD_ZUONR
** and UMSKZ in KD_UMSKZ
** and SHKZG in KD_SHKZG
** and BSCHL in KD_BSCHL
** and (BSIK_WHERE).
** endif. " Variante 4
**
*** check projk and imkey range
** if PROJK_ELIMINATED eq 'X' or IMKEY_ELIMINATED eq 'X'.
** loop at XBSAK.
** if PROJK_ELIMINATED eq 'X'.
** perform CHECK_INT_EXT(FI_LDB_UTIL) tables PROJK_TAB
** using XBSAK-PROJK
** 'KONPR'
** changing CHECK_OK.
** if CHECK_OK = 'N'.
** delete XBSAK.
** continue.
** endif.
** endif.
**
** if IMKEY_ELIMINATED eq 'X'.
** perform CHECK_INT_EXT(FI_LDB_UTIL) tables IMKEY_TAB
** using XBSAK-IMKEY
** 'IMKEY'
** changing CHECK_OK.
** if CHECK_OK = 'N'.
** delete XBSAK.
** endif.
** endif.
**
** endloop.
** endif.
**
** sort XBSAK by MANDT LIFNR BUKRS.
** CURSOR-BSAK = 1.
**ENDIF.

ENDENHANCEMENT.

2. Enhance in PERFORM update_xbsik_hdb. 

Find the code for enhancement.
ENHANCEMENT 1  ZVENDOR_AGEING.    "active version
** Variante 1: Offene Posten zu einem bestimmten Stichtag
** if ( sy-tcode = 'ZFI_VENDOR_AGEING' ).
** REFRESH xbsik.
** if KD_OPOPT = 'X' and KD_APOPT ne 'X'.
** select (BSIK_FIELDS) from BSIK
** into corresponding fields of table XBSIK
** for all entries in K_LIFNR
** where LIFNR eq K_LIFNR-LOW
** and BUKRS in KD_BUKRS
*** AND GJAHR IN KD_GJAHR
*** AND GJAHR BETWEEN '0001' AND '9999'
** and BlDAT in KD_BUDAT
** and BlDAT le KD_STIDA
** and ZUONR in KD_ZUONR
** and UMSKZ in KD_UMSKZ
** and SHKZG in KD_SHKZG
** and BSCHL in KD_BSCHL
** and (BSIK_WHERE).
** endif. "Variante 1
*** Variante 2: Ausgegl. Posten in einem Datumsintervall
** "- Es erfolgt kein Zugriff auf BSIK
*** Variante 3: Variante 1 + 2 gleichzeitig
** if KD_OPOPT eq 'X' and KD_APOPT eq 'X'.
** select (BSIK_FIELDS) from BSIK
** into corresponding fields of table XBSIK
** for all entries in K_LIFNR
** where LIFNR eq K_LIFNR-LOW
** and BUKRS in KD_BUKRS
*** AND GJAHR IN KD_GJAHR
*** AND GJAHR BETWEEN '0001' AND '9999'
** and BUDAT in KD_BUDAT
** and BUDAT le KD_STIDA
** and ZUONR in KD_ZUONR
** and UMSKZ in KD_UMSKZ
** and SHKZG in KD_SHKZG
** and BSCHL in KD_BSCHL
** and (BSIK_WHERE).
** endif. "Variante 3
**
*** Variante 4 (aus RFITEMAP): AP mit Stichtag und Ausgleichszeitraum
** "- Kein Zugriff auf BSIK!
**
*** check projk and imkey range
if PROJK_ELIMINATED eq 'X' or IMKEY_ELIMINATED eq 'X'.
loop at XBSIK.
if PROJK_ELIMINATED eq 'X'.
perform CHECK_INT_EXT(FI_LDB_UTIL) tables PROJK_TAB
using XBSIK-PROJK
'KONPR'
changing CHECK_OK.
if CHECK_OK = 'N'.
delete XBSIK.
continue.
endif.
endif.

if IMKEY_ELIMINATED eq 'X'.
perform CHECK_INT_EXT(FI_LDB_UTIL) tables IMKEY_TAB
using XBSIK-IMKEY
'IMKEY'
changing CHECK_OK.
if CHECK_OK = 'N'.
delete XBSIK.
endif.
endif.

endloop.
endif.

sort XBSIK by MANDT LIFNR BUKRS.
ENDIF.

ENDENHANCEMENT.

In the above 2 enhancements, the tcode should be given. The sy-tcode should be the name of the transaction code of the custom zreport.  Only if  the tcode is executed the enhacements work otherwise FBL1N works as per standard.It can be tested by checking the custom z report and FBL1N. The custom report fetches records by document date and FBL1N fetches records by posting date.

When there is a requirement to fetch records based on document date from FBL1N, such a enhancement needs to be applied.The records from FBL1N will be fetched based on the document date. All the records based on the document date(BLDAT) will be fetched.
1 Comment