Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
Showing results for 
Search instead for 
Did you mean: 

Opening Statement

The following document and the opinions expressed within are based solely on my own personal experiences working with multiple SAP customers over the years.  Take guidance from my suggestions, but ultimately the end results are dependent on the SAP ECC or S/4HANA environment in which you are working.


During my many years of SAP Finance consulting, I encountered multiple instances of incorrect or inefficient use of the SAP automatic clearing process, in ECC using transaction F.13, or in S/4HANA with the app “Schedule General Ledger Jobs”, job template “Automatic Clearing”.

In this blog post, I will share with you my experiences on using less commonly understood clearing program parameters to successfully clear a large backlog of clearable, open items, with emphasis on the GR/IR clearing account, however these suggestions can also be applied to other open-item managed accounts.

The screenshots in this document will reference SAP GUI, but the same concepts also apply to the equivalent Fiori apps.

Using these strategies, I was able to successfully clear in excess of 218,000,000 open items in the GR/IR account for a single company code in a productive environment.

Figure 1 - SAP GUI Transaction F.13 – Automatic Clearing

Figure 2 - SAP Fiori App Schedule General Ledger Jobs, template Automatic Clearing


Target Audience

If you are an end-user responsible for the management of the GR/IR account, are you noticing the number of open items growing each month?  Is this preventing you from identifying and resolving GR/IR discrepancies with your suppliers?  If so, then blog post is of relevance to you.  You may need some assistance from a member of your support team to check the automatic clearing configuration on your behalf.

Are you a support team member, or part of a project team engaged to prepare a system for a migration to S/4HANA?  Then this is will be of significance for you.

The Problem To Be Addressed

For one reason or another, some customers end up with significant volumes of clearable, open items in their GR/IR account.  Attempts to clear these open items using the automatic clearing program, either with foreground or background execution often leads to the clearing process terminating with the following runtime error:

Figure 3 - Clearing program runtime error

Being unable to clear this account eventually leads to the volume of open items growing to an unmanageable amount, and this can have other undesirable consequences, such as poor system performance and being unable to convert a landscape from ECC to S/4HANA in a reasonable time period.

Note that any other errors encountered during the clearing process, such as those triggered by custom validations will still occur and will need to be addressed separately.


Taking guidance from SAP note 546410 (https://launchpad.support.sap.com/#/notes/546410), the configured GR/IR account should be assigned sort key 014 (refer to Figure 4 - Sort key assignment in the GR/IR clearing GL account), which populates the concatenation of EBELN and EBELP (Purchase order and Purchase order item) into ZUONR (Assignment).

Figure 4 - Sort key assignment in the GR/IR clearing GL account

As seen in Figure 5 - Population of the Assignment field (ZUONR) in accordance with the Sort Key specified in the GL master record, the Assignment field is automatically filled based on the concatenation of the Purchase order and Purchase order item.  This is the desired scenario to commence clearing activities for the GR/IR account.

Figure 5 - Population of the Assignment field (ZUONR) in accordance with the Sort Key specified in the GL master record

If the sort key has been correctly set in the GR/IR GL account as 014, then in the customising activity “Prepare Automatic Clearing”, the GR/IR account should be set to only clear on ZUONR.

Figure 6 - Automatic Clearing Parameters for the GR/IR account

If the sort key assigned to the GR/IR GL account is not 014, then the criteria for automatic clearing should instead be configured for both EBELN and EBELP (Purchase order and Purchase order item) as criterion 1 & criterion 2 respectively.

Clearing Program Parameters

Let us now take a moment to explore some key parameters that can be used to improve the efficiency of the automatic clearing program, namely:

  • GR/IR Account Special Processing

  • Maximum Number of Groups

  • Minimum Number or Line Items

  • Output Control

Figure 7 - Clearing program parameters for efficient processing

GR/IR account special process

As per the reasons documented in SAP note 546410 (https://launchpad.support.sap.com/#/notes/546410), this indicator does not need to be selected.  EBELN and EBELP are stored in the assignment field ZUONR (provided sort key 014 has been used), and this alone is enough for clearing of the GR/IR account.

Maximum Number of Groups

If the GR/IR account contains such a high volume of data causing the runtime error as shown in Figure 3 - Clearing program runtime error, then the usage of this input parameter can be useful as a means to limit the amount of data selected by the clearing program for processing.

For the purpose of this input parameter, a group is defined as one or more line items that contain a unique combination of the clearing characteristics as defined in customising view V_TF123, “Prepare Automatic Clearing”.  Refer to Figure 6 - Automatic Clearing Parameters for the GR/IR account.

As per the example below, three groups are formed, based on the values of ZUONR.

Line item document no. ZUONR Amount Group #
100001 AAA111 100.00Dr 1
100002 BBB222 200.00Dr 2
100003 BBB222 200.00Cr 2
100004 CCC333 300.00Dr 3
100005 CCC333 300.00Cr 3

Figure 8 - Formation of Clearing Groups

Once the number of groups as specified by the parameter is reached, no further groups are created, and those groups that can be cleared are submitted to the clearing interface for further processing.

If this parameter is set to initial, i.e., left empty, then all line items selected in accordance with the general selections are processed, and this often leads to the runtime error

There are no definitive rules to set this parameter correctly.  A series of trial-and-error attempts often leads to a suitable value being determined.  I would suggest starting with a conservative value, e.g.,50,000, and then adjust accordingly.  Working with your project Basis consultant and analysing runtime resource consumption can help to determine the optimum value.

It is important to understand that when using this parameter, the automatic clearing program will have to executed repeatedly, up to a point where the residual volume of open items is at level where the parameter is no longer required.

Refer to the field help for further insights on the usage of this input parameter.

Minimum Number of Line Items

If this parameter is set to initial, a clearing document is created for every group identified for clearing.  In following example, two separate clearing documents will be posted because group id’s 2 and 3 can be cleared as the net balance of each group is zero.

Line item document no. ZUONR Amount Group #
100001 AAA111 100.00Dr 1
100002 BBB222 200.00Dr 2
100003 BBB222 200.00Cr 2
100004 CCC333 300.00Dr 3
100005 CCC333 300.00Cr 3

Figure 9 - Minimum number of line items in the clearing document

Now consider the situation where thousands of clearing documents are due to be posted.  This not only unnecessarily consumes the applicable document number range, but most significantly, generates a runtime processing overhead as the posting interface to generate the clearing posting is repeatedly called for each clearing group.

When this parameter is used, the program collates items to be cleared in an internal table until the minimum count is reached.  Only once this minimum count is reached are the items to be cleared transferred to the posting interface and cleared as a single document.

I have had success using a parameter value of 500.  The field help provides valuable guidance on the usage of this parameter.  Again, working with your project Basis consultant and analysing runtime resource consumption can help to determine the optimum value.

Output Control

These three checkboxes determine the content of the report that is generated upon successful execution of the report.

Except for being used during testing or troubleshooting, the report detail provided by the first two checkboxes add little value, and only place additional burden on system resources as large spool files are created.

With all three output control checkboxes unselected, the following short list is generated, providing the total number of open items analysed and the number of cleared items.

Figure 10 - Runtime Statistics

Therefore, I recommend that the first two checkboxes, i.e., “Documents that can be cleared” and “Documents that cannot be cleared” are left unchecked.

The third checkbox, “Error Messages” should be checked.  This provides messages pertaining to locked profit centres or other issues preventing clearing.

Figure 11 - Error Messages


Closing Comments

The usage of these input parameters to control the clearing process are of most value when attempting to clear a backlog of open items in the GR/IR account.  Once the open item volumes are at a manageable level, the usage of the “Maximum Number of Groups” parameter can be stopped.

I hope that a better understanding of the practical applications of these parameters goes a long way to improve your clearing success rates.

Thanks to my colleagues Mark Barry, Joy Kennedy, and Allan Johnson for their valuable review feedback.
1 Comment