Clear GL Account Process

总账清账流程
本文介绍了在SAP系统中通过自动清账程序和手动清账来进行总账科目清账的过程。涉及抵税、银行子账户及采购收货/发票接收等业务场景下的交易对冲,包括外币交易产生的汇兑损益及小额差异自动计入损益账户等内容。

http://www.sap-exp.com/clearing.html

 

This refers to the process of clearing GL accounts using both automatic clearing program as well as manual clearing.


Common Business Requirement

Certain GL accounts such as withholding tax, bank sub accounts, GR/IR accounts will always have an offsetting posting for a business transaction. Each line item will have its corresponding contra line item which would have already been posted or will be posted subsequently. E.g., when a cheque is issued, a credit posting is done to the bank outgoing payment sub account and when the bank statement is received, a debit posting is done to the same account. These line items need to be identified and cleared periodically. The clearing of accounts will ease the process of reconciliation of the balance sheet accounts such as accrual accounts and suspense accounts.

Sometimes, such business transactions are incurred in different currencies and over a period of time. There is a need to post the foreign currency gain / loss for any fluctuation in the currency in the local books.

In certain cases, there will be minor differences in the debit and credit values for the same business transaction. These line items should still be cleared automatically if they are within the tolerance limits, and the difference should be booked into the P&L account.

SAP provides two ways of clearing the GL line items; they are automatic clearing and manual clearing. Countries will use automatic clearing program or manual clearing or both.

When the GL account line items are not cleared automatically manual clearing should be used. After executing the automatic clearing transaction, the GL account open line items should be reviewed for any line that need to be cleared manually.

In some cases, e.g. after uploading of payroll, manual clearing of down payment accounts will be required.

In both automatic and manual clearing, the clearing document will be reset if the clearing was incorrectly done.

Common Business Process Flow

Common Business Process Flow for Clear GL Account is as follow:
Coming Soon!

The precondition to clearing is the balance sheet GL account has to be created as an “Open Item Managed” account. This is defined in the company code segment of the GL account master record.

For each GL account, foreign currency gain and loss accounts are defined. In case of foreign currency transactions that are booked over a period of time, any foreign currency gain or loss resulting in clearing are booked automatically.

Tolerance groups are defined for different group of GL accounts. During clearing, in case there is a difference between the debit and the credit entry but are still within the tolerance amounts, the difference is booked into a defined P&L account automatically.

Automatic Clearing Criteria

Based on the nature of these G/L accounts, the criteria needed to clear the entries and the order in which the criterion are to be selected are defined. Automatic clearing will be used for withholding tax, bank statements and GR/IR accounts. Two standard SAP programs are available – automatic clearing without specifying clearing currency (transaction code F.13), automatic clearing specifying clearing currency (F13E).

The clearing is done based on the following fields of the GL transaction line items and the type of accounts.

  • ZUONR – Assignment
  • DMBTR – Amount in local currency
  • BLDAT – Document Date
  • WRBTR – Amount in transaction currency
  • EBELN – Purchase order number
  • EBELP – Purchase order line items

GR/IR accounts will be cleared based on purchase order no and then purchase order line item no. Bank incoming and outgoing accounts will be cleared based on document date and then amount in transaction currency. Cash-in-transit accounts will be cleared based on the assignment field. Other open item managed balance sheet accounts will be cleared based on amount in local currency.

Tolerance Limit

More than one tolerance group can be assigned to a company code. Tolerance limit is set based on a percentage of the maximum amount of debit/credit amounts or absolute value based on the local currency of the company code. Tolerance group is maintained in the company code level data of the GL account.

If the difference is within tolerance limit, the difference is posted to  WRITE OFF - SMALL OVERPAYMENTS / UNDERPAYMENTS Account.

SELECT a.company_code, a.company_name, a.gl_account_nbr, a.clearing_date, a.clear_account_document_nbr, a.doc_assignment, a.fiscal_year, a.gl_document_nbr, a.document_item_nbr, a.doc_posting_date, a.document_date, a.document_currency, a.doc_reference, a.document_type, a.fiscal_period, a.doc_posting_key, a.doc_account_debit_or_credit, a.business_scope, a.doc_tax_code, a.doc_local_currency_amount, a.doc_currency_amount, a.tax_amount_standard, a.doc_currency_tax, a.doc_item_text, a.doc_source_order_nbr, a.plant_code, a.cost_center, a.doc_payment_starting_date, a.doc_open_item_management, a.doc_value_date, a.bpm_order_no, a.process_code, a.paymethod, a.paystract, a.zshare_ctr, a.cl_document_nbr, a.handling_accountant, a.handling_accountant_name, a.z_proid, a.pernr, a.dr_amount, a.cr_amount, a.paymethod_name, a.gl_account_name, a.anti_accounting_mark, a.enter_time, a.wb_debit_amount, a.wb_crebit_amount, a.ts_ms, a.cnt FROM ( SELECT a_1.company_code, a_1.company_name, a_1.gl_account_nbr, a_1.clearing_date, a_1.clear_account_document_nbr, a_1.doc_assignment, a_1.fiscal_year, a_1.gl_document_nbr, a_1.document_item_nbr, a_1.doc_posting_date, a_1.document_date, a_1.document_currency, a_1.doc_reference, a_1.document_type, a_1.fiscal_period, a_1.doc_posting_key, a_1.doc_account_debit_or_credit, a_1.business_scope, a_1.doc_tax_code, a_1.doc_local_currency_amount, a_1.doc_currency_amount, a_1.tax_amount_standard, a_1.doc_currency_tax, a_1.doc_item_text, a_1.doc_source_order_nbr, a_1.plant_code, a_1.cost_center, a_1.doc_payment_starting_date, a_1.doc_open_item_management, a_1.doc_value_date, a_1.bpm_order_no, head.procode AS process_code, payment.paymethod, a_1.paystract, a_1.zshare_ctr, a_1.cl_document_nbr, CASE WHEN head.pernrjb IS NOT NULL AND head.pernrjb <> ‘’::text THEN head.pernrjb ELSE bkpf.usnam END AS handling_accountant, pa001.sname AS handling_accountant_name, head.proid AS z_proid, head.pernr, a_1.dr_amount, a_1.cr_amount, payment.paymethodtxt AS paymethod_name, a_1.gl_account_name, a_1.anti_accounting_mark, a_1.enter_time, a_1.wb_debit_amount, a_1.wb_crebit_amount, a_1.ts_ms, row_number() OVER (PARTITION BY a_1.company_code, a_1.gl_account_nbr, a_1.fiscal_year, a_1.fiscal_period, a_1.gl_document_nbr, a_1.document_item_nbr ORDER BY head.procode DESC) AS cnt FROM table_01 a_1 LEFT JOIN dwd_ztbpm_payment_view payment ON a_1.bpm_order_no = payment.orderno LEFT JOIN dwd_ztfi_trpay_view trpay ON a_1.bpm_order_no = trpay.orderno LEFT JOIN dwd_bkpf_r bkpf ON bkpf.bukrs = a_1.company_code AND bkpf.gjahr = a_1.fiscal_year AND bkpf.belnr = a_1.gl_document_nbr LEFT JOIN dwd_ztbpm_post_head_r head ON a_1.bpm_order_no = head.orderno LEFT JOIN dwd_pa0001_r pa001 ON pa001.pernr = head.pernrjb) a WHERE a.cnt = 1 用rownumber会导致sql运行较慢,该怎么改能让sql运行快一点且数据结果与之前保持一致 DISTINCT ON LATERAL 不支持 改完后的sql具体给我写一下
03-31
SELECT a.company_code, a.company_name, a.gl_account_nbr, a.clearing_date, a.clear_account_document_nbr, a.doc_assignment, a.fiscal_year, a.gl_document_nbr, a.document_item_nbr, a.doc_posting_date, a.document_date, a.document_currency, a.doc_reference, a.document_type, a.fiscal_period, a.doc_posting_key, a.doc_account_debit_or_credit, a.business_scope, a.doc_tax_code, a.doc_local_currency_amount, a.doc_currency_amount, a.tax_amount_standard, a.doc_currency_tax, a.doc_item_text, a.doc_source_order_nbr, a.plant_code, a.cost_center, a.doc_payment_starting_date, a.doc_open_item_management, a.doc_value_date, a.bpm_order_no, a.process_code, a.paymethod, a.paystract, a.zshare_ctr, a.cl_document_nbr, a.handling_accountant, a.handling_accountant_name, a.z_proid, a.pernr, a.dr_amount, a.cr_amount, a.paymethod_name, a.gl_account_name, a.anti_accounting_mark, a.enter_time, a.wb_debit_amount, a.wb_crebit_amount, a.ts_ms, a.cnt FROM ( SELECT a_1.company_code, a_1.company_name, a_1.gl_account_nbr, a_1.clearing_date, a_1.clear_account_document_nbr, a_1.doc_assignment, a_1.fiscal_year, a_1.gl_document_nbr, a_1.document_item_nbr, a_1.doc_posting_date, a_1.document_date, a_1.document_currency, a_1.doc_reference, a_1.document_type, a_1.fiscal_period, a_1.doc_posting_key, a_1.doc_account_debit_or_credit, a_1.business_scope, a_1.doc_tax_code, a_1.doc_local_currency_amount, a_1.doc_currency_amount, a_1.tax_amount_standard, a_1.doc_currency_tax, a_1.doc_item_text, a_1.doc_source_order_nbr, a_1.plant_code, a_1.cost_center, a_1.doc_payment_starting_date, a_1.doc_open_item_management, a_1.doc_value_date, a_1.bpm_order_no, head.procode AS process_code, payment.paymethod, a_1.paystract, a_1.zshare_ctr, a_1.cl_document_nbr, CASE WHEN head.pernrjb IS NOT NULL AND head.pernrjb <> ''::text THEN head.pernrjb ELSE bkpf.usnam END AS handling_accountant, pa001.sname AS handling_accountant_name, head.proid AS z_proid, head.pernr, a_1.dr_amount, a_1.cr_amount, payment.paymethodtxt AS paymethod_name, a_1.gl_account_name, a_1.anti_accounting_mark, a_1.enter_time, a_1.wb_debit_amount, a_1.wb_crebit_amount, a_1.ts_ms, row_number() OVER (PARTITION BY a_1.company_code, a_1.gl_account_nbr, a_1.fiscal_year, a_1.fiscal_period, a_1.gl_document_nbr, a_1.document_item_nbr ORDER BY head.procode DESC) AS cnt FROM table_01 a_1 LEFT JOIN dwd_ztbpm_payment_view payment ON a_1.bpm_order_no = payment.orderno LEFT JOIN dwd_ztfi_trpay_view trpay ON a_1.bpm_order_no = trpay.orderno LEFT JOIN dwd_bkpf_r bkpf ON bkpf.bukrs = a_1.company_code AND bkpf.gjahr = a_1.fiscal_year AND bkpf.belnr = a_1.gl_document_nbr LEFT JOIN dwd_ztbpm_post_head_r head ON a_1.bpm_order_no = head.orderno LEFT JOIN dwd_pa0001_r pa001 ON pa001.pernr = head.pernrjb) a WHERE a.cnt = 1 用rownumber会导致sql运行较慢,该怎么改能让sql运行快一点且数据结果与之前保持一致
03-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值