SAP Archiving – Archive Index ARIX_BKPF for Accounting Documents
Friends, in this post I am going to discuss about archive index. I have already discussed about archiving procedure. During write phase of archiving, data is read from database and the same is written is a file which is called as archive file. This is a flat file and contains data in sequential format.
Now, let us take a scenario wherein we want to read a particular FI document from an archive file. So, we write a program to do so. The program’s selection criteria is Company code, FI document number, and Fiscal year. Once executed, The program starts reading the archive file from the beginning and display the FI document as soon as it encounter it. Quite easy.
The problem
No doubt, we can always create a ABAP report which can read a desired archived FI document or data from archive file. But, the problem lies in the fact that archive file is a flat file and the program has to read the file in sequential manner until desired document/data object is reached. An archive file can have 50,000 or 200,000 documents and sequential read will take a lot of time if the document/data object exists in second half of archive file. The worst case in terms of performance is if the document/data object to be read is the last document in archive file. In short, flat structure of archive file resulted in performance problem.
The solution
What we do if read from a database table takes lots of time. Well, we create index on the database table. Of course after analysing the requirement and after effects of creating indexes.
Same solution was devised for archive files also. The archive files were indexed and the index is called as Archive Index. It may be confusing to think that index is created for a flat file. Actually it was achieved by using a database table. The table is ARIX_BKPF.
Below is a screen shot :
Explanation : How indexing is achieved
It is clear that ARIX_BKPF has company code, document number and fiscal year as key fields. It also contains two other fields, ARCHIVE_KEY and OFFSET which are archive file name and offset entry.
When delete phase is executed for FI_DOCUMNT, the delete program deletes the document from database and populate necessary information in ARIX_BKPF. So, ARIX_BKPF contains following 3 important parameters for all archived documents along with other fields:
Archived document key i.e Company code, document number and fiscal year
Archive file name(ARCHIVE_KEY) in which the document is stored.
Offset entry(OFFSET) i.e place in archive file where the document starts.
Let us again create an ABAP report to read a particular FI document from an archive file. This time we will use ARIX_BKPF and the reading procedure will be as follows :
1) The program goes to table ARIX_BKPF and fetch archive file name and offset where the document is stored in archive file.
2) With these two values namely, Archive file name and offset, the program directly start reading the desired document starting from the offset position within the archive file.
Bingo! We have just omitted sequential read in archive files. Now, our programs can directly read an FI document/data object from the position where they are stored in archive file. Of course, we need to write necessary lines of code to achieve this. Presence of table ARIX_BKPF doesn’t mean that all the program automatically read it
Note : ARIX_BKPF is replaced by new indexing tool called SAP AS starting from SAP_APPL Release 600 i.e ARIX_BKPF is no longer updated and used in Release SAP_APPL 600 onwards.
Please share your thoughts through comments.
The easiest way to stay informed about everything on Tech2know is to go for at lease one of below options :
Subscribe to my RSS feed / Subscribe by E Mail / Follow me on twitter /Become a fan on Facebook.
Stay tuned for more.
Related posts:
- SAP Archiving – SAP AS or Archive Information System For FI_DOCUMNT
- SAP Archiving – Archive Administration SARA
- SAP Archiving – Why XARCH Flag is Set in Secondary Indexes during Archiving FI Documents
- SAP Archiving Objects
- SAP Archiving – Important Customizing for Archiving Object FI_DOCUMNT