Hello Everyone,
The primary motive behind writing this blog is based on a personal experience wherein while extending the BKPF table and creating the accounting document, data could not be posted to the table. Upon further investigation, it was found that few structures needed to be extended in some reports and those reports needed to be regenerated.
It was difficult to find complete information on exactly what needs to be done in one go. Hence I would like to jot down all information in this blog.
Many times due to client requirements, database tables need to be extended. Only extending the database table is not sufficient as we need to know all dependent tables and reports which have to be regenerated or extended along with the base table.
In our case, for extending the BKPF table, we had to regenerate many reports, extend structure and depending tables, etc. Let me explain the entire process in detail.
Requirement: Extending table BKPF with new fields.
Accounting documents make up the financials of your organization. BKPF (Accounting Document Header) is a standard table in SAP R/3 ERP systems which stores the header lines for accounting documents and consists of Company Code, Document No, Fiscal Year (as key fields). We had to extend the BKPF Table with 3 new ZZ fields (ZZTRANTXT, ZZDECTXT, ZZAOACFO).
With the introduction of new fields, the selection criteria for creating accounting document were expanded as follows.
-
Effective Date
-
Document type
-
Transaction text (ZZTRANTXT)
-
Description text (ZZDECTXT)
-
Agency (ZZAOACFO)
In our scenario, the following had to be extended/modified.
Step 1:
VBKPF table (standard SAP Table which is used to store Document Header for Document Parking information). This is available within R/3 SAP systems and needs to be extended with the new ZZ fields.
Step 2:
The structure ACCHD should be extended since we were using BAPI_ACC_DOCUMENT_POST
BAPI_ACC_DOCUMENT_CHECK. This BAPI (BAPI_ACC_DOCUMENT_POST
, BAPI_ACC_DOCUMENT_CHECK) has an extension table which is used to map to the BKPF table.
Step 3:
Following Include LFACIF4S has a structure called P_ACC which needs to have newly added ZZ Fields. In order to get these new fields into this structure we need to run the following report SAPFACCG so that the structure is regenerated in the include.
P_acc Structure:
Step 4:
When we post a document using
preliminary_posting_post_all
function module, include LF040Z02 needs to be regenerated with newly added custom fields.
Step 5:
Run RFBIPGG0 for regenerating LF040Z02 Include. This report is relevant when we post a document using FV50. Here we have to enhance FV50 with new custom fields. Another scenario needs to be considered in case if you are posting a document using FBVB transaction, then the above include LF040Z02 becomes irrelevant.
Step 6:
Structure INVFO needs to be extended with newly added custom fields.
Step 7:
When we finally post a document using function module PRELIMINARY_POSTING_POST_ALL, this FM internally uses BDC and posts the document using transaction FBVB.
Step 8:
The BADI FI_HEADER_SUB_1300 could be used for screen enhancement. You might have to create an Enhancement Point in program SAPMF05A.
Note: New Z fields can be added to FB03 only in the form of hard screen modification and are not recommended.
For any queries, please get in touch with contacts mentioned below.
*personal mails deleted*