The purpose of this page is to clarify the understanding of the system logic in a technical point of view about hte Posting and Clearing process.
The content of this page will provide debug tips and techinal information as internal tables involved in the posting and clearing process.
The main program for posting document is SAPMF05A.SAPMF05B is responsible for clearing the documents. But, as during the clearing a new document is created, SAPMF05B calls SAPMF05A.
So, before start your debug is important to identify if you are posting (SAPMF05A) or clearing (SAPMF05B) document.
The main internal tables used during the Posting and Clearing
- KONTAB (clearing items): Collection of clearing postings without cash discount items.
- KONTAB_1ST is the key structure used for summarization: AGZEI is a logical pointer from KONTAB to POSTAB (any number). Meaning: 1.In POSTAB: That the item has been cleared by item ... in KONTAB.
- POSTAB (open items): Responsible for store all open items selected to be processed. If you are selecting many line items to clearing this is not the best option for debug because it will be a massive work. POSTAB-WRBTR contains the value of the items in the payment currency. This is the amount used for clearing. This table is filled in SAPMF05B in form POSTAB_DATEN (select open items and calculate amounts) Write BSEG from the open items (BSIS, BSIK, BSID) into POSTAB. Carry out currency translations. (Clearing in the transaction currency of the invoice does not require translation.) Determine due dates. Determine cash discounts.
- XBKPF (document header): Collects the headers of the new documents to be posted.
- XBSEG (document items): Collects the items of the new documents to be posted.
Internal Tables Flow during Clearing:
*BSEG -> POSTAB
Goto Form POSTAB_DATEN
AGZEI is a logical pointer from KONTAB to POSTAB (any number). Meaning that in POSTAB: That the item has been cleared by item ... in KONTAB.
If possible, two entries that belong together are merged.
- Posting key is set and value dated.
- All important fields in BSEG are set (amounts, organizational units, texts), BSEG-AUGBL is set to = '*', cash discount amounts are written to BSEG.
- BSEG-NEBTR = NETTAB-NEBTR (payment amount) in first clearing item!
- Transfer external account assignments for down payments/requests.
- BSEG-XAUTO = 'X‘
- Adjust withholding tax amounts
- Save posting items in XBSEG.
Posting items filled from the items to be cleared (from table POSTAB)
Just specific fields are moved from POSTAB to KONTAB because in more than one item in POSTAB can be summarized in one line item in KONTAB. (For more details please check SAP Note 69767).
2 KONTAB items always arise for each open item in order to catch situations where the local and document currency have different +/- signs.
In the COLLECT KONTAB the append that follows has the following meaning: Per logical grouping (all fields the same in KONTAB_1ST) both an S and H entry are created. Reason: Due to collection, it may occur that an item - 1001 USD/ - 1799 DEM is added to an item with 1000 USD/1800 DEM. The result is an item with – 1USD / 1 DEM. This would be divided, and two postings would be created. Later, in KONTAB_VERDICHTEN, each pair is summarized if it does not look like the above example.
During KONTAB_VERDICHTEN KONTAB is compressed. In KONTAB there are always pairs of items to be grouped, (usually one item with amount 0, and the real item). The reason for this is that in certain constellations in different currencies, different +/- signs can appear, for example, with payment in third currency. These are grouped.
KONTAB -> XBSEG
Collects the items of the new documents to be posted.
BSEG/XBSEG - Important fields to know:
Contains the line item that is cleared so that any additional processing knows which items were cleared by this BSEG line.
- First for open item selection:
XAUSZ3-AGZEI = KONTAB-AGZEI (Which item was cleared and what information does it contain?)
- Update task:
XAUSZ3-AGZEI = BSEG-AGZEI. (Pointer from XBSEG items to cleared items).
Different meaning depending on net/gross posting:
Payment reference. In customer invoices, the customer should refer to this number when making payment. In vendor invoices, the vendor provides this number that we can refer to when making payment.
Only filled in items created automatically; account assignment key. (compare table T030/T030W or. A: FBKP)
Cross company code clearing item
|BSX||Stock posting from MM|
|KBS||Purchase order with account assignment (expense posting from MM)|
|KDF||Exchange rate difference for open items|
|KDB||Exchange rate difference for foreign currency balances from valuation|
|KDW||Payment difference for alternative currency|
|KDR||Exchange rate rounding differences MM|
|RDF||Rounding difference for national currencies|
Tax exchange rate differences (alternative tax exchange rate)
Tax clearing items for down payments made gross
Cash discount paid - Customer takes cash discount
|SKE||Cash discount received - We claim cash discount when we make payment|
|VSK||Cash discount lost (net procedure)|
|SKV||Cash discount clearing (net procedure)|
Bill of exchange charges
|ZDI||Payment difference according to difference reasons (Customizing): Small differences that fall within the tolerances set, and that are therefore automatically posted as an expense|
|EGS, EGK||Incoming invoice, G/L account/vendor item|
|AGS, AGD||Outgoing invoice, G/L account/customer item|
|SAK||G/L account posting|
|DAS||Differences from G/L account clearing|
|VST, MWS, NAV||Taxes|
Similar grouping to KTOSL:
|T||Corresponds to VST or MWS ... for taxes|
|S,D||Reversal as indicator for CO|
Partner business area. GSBER of business partner for domestic sales. Relevant for business area consolidation. Can be entered at header level and is inherited into the G/L account items not created automatically. Can also be overwritten individually in the item.
- PYCUR and PYAMT
Currency, and possibly amount, relevant for the payment program if payment is to be made in third currency. Entered in the invoice document.
Invoice reference, but also used for
-Link between down payment and down payment clearing (transfer posting) or
-Linking a partial payment or residual item for original invoice. REBZT is set to Z (partial payment), V (carry forward), U (transfer posting).
A Down payment clearing: Partially cleared amounts for a down payment G
Credit memo: For invoice entry with explicit invoice reference
For down payments on invoices: Invoice reference for invoice in payment request
U Transfer posting of down payment (in credit memo created) V Carry forward Z Partial payment
Special G/L indicator (determination of alternative reconciliation account – T074) ----> T074U- MERKP determines whether it is a statistical item (maintenance in transaction FBKP).
Special G/L class (grouping of same UMSKZ ). Generally only important for screen control (T019). (maintenance in transaction: FBKP).
|A||All types of down payments|
|W||All types of bills of exchange|
Otherwise any, set to X for table T019
Can be assigned if supported for the document type: Table: T003-XGSUB. If VBUND is entered in the vendor master record: Inherit VBUND in all items (for the evaluation). Problems occur if there are several vendors in one document (if accessed via ACC interface), then XGSUB decides the type of inheritance.
(in RFOPS). Calculation of days in arrears: Relevant BLDAT, ZFBDT, and ZBDXP with X = 1, 2, 3. -VERZG = BLDAT – ZFBDT – ZBD1T - tolerance days. -If GT is 0, same formula with ZBD2T (if it exists) and overwrite VERZG. -If GT is 0, same formula with ZBD3T (if it exists) and overwrite VERZG. -End result = VERZG
For more details please check external wiki.
- WRBTx, DMBTx, DMB2x, DMB3x whereby x = 1, 2, 3. Tax split amounts in open item (important for net documents)
- WSKTO Cash discount agreed in open item in document currency, if fixed amount. In clearing document and cleared items: Cash discount taken.
- XANET 'X' = Down payment in net procedure <>'X‘ = Down payment managed gross
- XHRES Subledger accounts: Is the G/L account (reconciliation account) resident? XOPVW and XKRES are always set.
- XKRES Line item display possible = BSIS/BSAS is updated, subledger: Always set
- XOPVW: G/L accounts: Clearing possible, subledger: Always set
Use this structure to help you compose your contributions for WIKI and at the same time will ensure spelling and grammar.