Skip to Content

This blog post aims to provide a lesser known, but a very powerful tool to fetch the follow on document numbers from a given document number while writing custom ABAP based reports.

For example, a report is to be submitted to external authorities/auditors/internal management giving the extract of the SD billing document, FI document posted, and other details related to currency, amount. To further add to the complicacy, assume this is to be submitted for some specific customers or product groups. Developing such a report would involve fetching the data from various tables like VBRK, BKPF, BSEG, etc which may lead to long run times

Another case is FI/COPA reconciliation where it is often reconciled what is posted in FI and what not posted in COPA to arrive at the “reconciliation items”.

Standard SAP offers a function module BAPI_ACC_DOCUMENTS_RECORD which can simplify the process of data extraction. Lets see it using 3 different cases

Case 1 – Identify the follow on documents (CO/PCA/COPA,etc) from FI document

Go to SE37 and enter the FM BAPI_ACC_DOCUMENTS_RECORD. Press F8 to test the same

/wp-content/uploads/2013/04/image001_201385.png

Click on /wp-content/uploads/2013/04/image002_201389.png against the External_Documents and enter the following details

/wp-content/uploads/2013/04/image007_201390.png

OBJ_TYP = BKPF (BKPF identifies that the origin of the transaction lies in FI )

OBJ_KEY = FI Document Number + Company + Fiscal year

OBJ_SYS as “System ID_Client No”. The system ID can be obtained from SAP Log on Pad

Press F3 (back) after you have entered above details. Following screen appears

/wp-content/uploads/2013/04/image004_201393.png

Press Execute (F8). The “Result” under “Accounting_Documents” shows 18 entries

/wp-content/uploads/2013/04/image008_201394.png

Click on  /wp-content/uploads/2013/04/image002_201389.pngagainst the Accounting_Documents and you can see the following 4 types of documents

/wp-content/uploads/2013/04/image009_201396.jpg

In Column REC_T,

BKPF – Stands for FI Doc

COPCA – Stands for PCA Doc

COBK – Stands for Controlling document

             COPA – Stands for COPA document

Case 2: Identify the follow on Accounting documents (FI/CO/PCA/, etc ) from MM documents

Go to SE37 and enter the FM BAPI_ACC_DOCUMENTS_RECORD. Press F8 to test the same

/wp-content/uploads/2013/04/image001_201385.png/wp-content/uploads/2013/04/image001_201385.png

Click on /wp-content/uploads/2013/04/image002_201389.png against the External_Documents and enter the following details

       OBJ_TYP = MKPF (MKPF identifies that the origin of the transaction is in MM)

       OBJ_KEY = MM Document Number + Fiscal year

       OBJ_SYS as “System ID_Client No”. (The system ID can be obtained from SAP Log on Pad)

/wp-content/uploads/2013/04/image003_201374.jpg

Press F3 (back) after you have entered above details. Following screen appears

/wp-content/uploads/2013/04/image004_201393.png

  Press Execute (F8). The “Result” under “Accounting_Documents” shows 4 entries

/wp-content/uploads/2013/04/image005_201376.jpg


Click on /wp-content/uploads/2013/04/image002_201389.png against the “Accounting_Documents- Results” and you can see the following 4 documents

/wp-content/uploads/2013/04/image006_201384.jpg

In Column REC_T

BKPF – Stands for FI Doc

COPCA – Stands for PCA Doc

GLX – Stands for Special Purpose Ledger

COBK – Stands for Controlling document

Case 3: Identify the follow on Accounting documents (FI/CO/PCA/COPA/SPL, etc) from external documents (SD)

Follow the same process as above with following details

OBJ_TYP = VBRK and

OBJ_KEY = SD Billing document No. (Without suffixing any Fiscal year and Company code)

OBJ_SYS = System ID_Client No

To report this post you need to login first.

18 Comments

You must be Logged on to comment or reply to a post.

  1. Surya Varma

    Dear Ajay,

     

    This is great stuff…Very nice. Thank You. Hope we get to see many more articles fo this kind.

     

    Best Regards

    Surya

    (0) 
  2. BHIMAPPA KAMMA

    Thanks Ajay

     

    OBJ_KEY – FI document + Company + fiscal year

     

    It is company or company  code

    if company is blank we can not use this function module right-BAPI_ACC_DOCUMENTS_RECORD

     

    Thanks

    Bhima

    (0) 
  3. Subhadeep Das

    Hi,

     

    thank you for this excellent note, can you tell me if the output can be controlled ? As of now for each billing doc I am getting almost 10-15 different documents pertaining to FI,CO,PA etc. Is there any method I can restrict the output to FI only ?

     

    best regds

    Subha

    (0) 
  4. LCTLFRVR01 HDP

    Thank you Ajay, this is something I am searching for over a period of time, this is very much helpful, you are  exxxcelllent and life saver for people like me while articulating thru several concept

     

    Thanks a million- that’s also less as of now

    (0) 

Leave a Reply