Procurement to Payment Document Flow

Process logic to get PO Amount and PO Number from Payment Document 

Follow logic flow can be used to build cash flow report in SAP. In SAP we do not have any report which provide details from PO to Payment document. You may have to develop it for your client. In such cases following logic may help you to build your report.

COLLECT ALL THE PAYMENT DOCUMENTS FROM TABLE BKPF ON FOLLOWING BASIS

Look For
BKPF-BUKRS Company Code
BKPF-GJAHR Fiscal Year
BKPF-BLART Document type (KZ or other payment document type)
BKPF-CPUDT Accounting Document Entry Date
BKPF-CPUTM Time of Entry
This need to be assured that all the documents posted with doc type KZ and CP has been covered by the above parameter.

STORE Following
BKPF-BUKRS Company Code (ITEB1-BUKRS)
BKPF-BELNR Accounting Document Number (ITEB1- BELNR) (Store in your program table as Payment Doc No.)
BKPF-GJAHR Fiscal Year (ITEB1- GJAHR)
BKPF-BLART Document type
BKPF-BUDAT Posting Date in the Document
BKPF-MONAT Fiscal period
BKPF-CPUDT Accounting Document Entry Date
BKPF-CPUTM Time of Entry

LOOK INTO TABLE BSAK FOR VENDOR NUMBER AND INVOICE DOCUMENT NO
List following document where
ITEB1-BUKRS = BSAK-BUKRS Company Code
ITEB1- BELNR = BSAK-BELNR
ITEB1- GJAHR = BSAK-GJAHR
STORE Followings
BSAK-BUKRS Company Code
BSAK-BELNR Accounting Document Number
BSAK-GJAHR Fiscal Year
BSAK-AUGBL Clearing Document Number (Store in your program table as Clearing Doc No 1)
BSAK-AUGDT Clearing Date
BSAK-LIFNR Vendor Number (This vendor number can be taken as to whom payment has been made) (Store in your program table YFAPAY as Vendor No)
BSAK-BUZEI Line Item number

Again look into table BSAK on the basis of above clearing document number and clearing date. Now store all the documents number where line item number is not same as above documents. This will be Invoice document number. Logic explain below
Look in BSAK where
BSAK-AUGBL Clearing Document Number (From above stored data)
BSAK-AUGDT Clearing Date (From above stored data)
BSAK-BUKRS Company Code (From above stored data)
BSAK-GJAHR Fiscal Year (From above stored data)
Store followings
BSAK-BUKRS Company Code (ITAB2-BUKRS)
BSAK-GJAHR Fiscal Year (ITAB2- GJAHR)
BSAK-BELNR Accounting Document Number (ITAB2- BELNR)
(Store in Table YFAPAY as Invoice Doc Number)
(Note for this doc no BSAK-BUZEI should not be same as we have stored in the first run)

NOW LOOK INTO TABLE BKPF FOR ABOVE INVOICE DOCUMENT NUMBER FOR MIRO DOCUMENT NUMBER

ITAB2-BUKRS = BKPF -BUKRS
ITAB2- GJAHR = BKPF- GJAHR
ITAB2- BELNR = BKPF- BELNR

Store MIRO document Number
BKPF -BUKRS
BKPF- GJAHR
BKPF- BELNR
BKPF-AWKEY,
Take only first 10 letters from this field. Store this document number in your program table as “MIRO Doc No”

NOW LOOK IN TABLE RSEG FOR ABOVE MIRO DOCUMENT AND STORE PO NUMBER AND AMOUNT OF CASH FLOW

Look into RSEG where
RSEG-BELNR (For above MIRO document)
BKPF-BUKRS = RSEG-BUKRS (Company Code)
BKPF- GJAHR = RSEG-GJAHR (Fiscal Year)
STORE followings
RSEG-BELNR (Material document number)
BKPF-BUKRS = RSEG-BUKRS (Company Code)
BKPF- GJAHR = RSEG-GJAHR (Fiscal Year)
RSEG-EBELN (PO Document number) (Store in your program table as PO Doc No.)
RSEG-EBELP (PO Item No.)
RSEG-WRBTR (This can be taken as Amount of cash flow and store in the your program table)
RSEG-LFBNR  (Material Doc No.) (Store this field as material document number in your program table)

 

lets discuss if you have any other observation in this regard. Let’s also explore it we have any other method or way to handle it.

Largest collection of SAP E Books available for instant download.

Posted in ABAP Tagged with: ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Categories