Posted: Wed Dec 12, 2007 10:09 am Post subject: Difference between clearing and partially clearing document
Questions:
Who can tell me what difference between clearing and partially clearing document for payment from BKPF/BSEG?! for clearing document, I can call "GET_CLEARED_ITEMS" to get all original item from invoice, but for partilally clearing, I can't. Who can tell me?!
Answer 1:
There is a field in BSID/BSAD/BSIK/BSAK called REBZG that will lead you in the right direction.
I tried to track partial payments a while ago for an aging report on customer open items, and I known partial payments gave me the most headache.
If you have any further insights or solve the problem based on this hint, would you share some sample code? I would be interested how you go about it?
Answer 2:
You should use BSID and BSAD instead of BSEG:
Geth the invoice document
Check if items exist in BSID, checking BUKRS and VBELN
If they do, thee are open items
Then go to BSAD, and check if there are documents there checking BUKRS and BELNR
The BSAD document will have a link to another document stored on AUGBL.
Then you search BSAD looking for XZAHL = 'X' SHKZG = 'S' (payment) BELNR = (previous _BSAD)-AUGBL and REBZG = (invoice) BELNR
If you find a document, search for the next. On each document you will notice the actual balance for the item.
If you do not find a document with the given AUGBL, then go to BSID and search for BELNR = (last_BSAD)-AUGBL
If you find the item on BSID it means that the document ir partially cleared, and there is still an open balance. If you do not find BSID documents, it meand that the document is cleared by one or more payments.
The trick is to search again BSAD and BSID with the AUGBL found on BSAD, to track the next document on the flow. Ignore the documents with SHKZG = 'H', they are not reliable, because there are multiple ways to close an item.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.