

G/L Account line item grouping
source link: https://blogs.sap.com/2022/05/27/g-l-account-line-item-grouping/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

G/L Account line item grouping
Introduction
Following the SAP Best Practice approach regarding the setup of GL accounts ins SAP ERP and SAP S/4HANA any account allows a detailed reporting on line item level.
We can select any available field to sort or group accounts. So far all seems to be set and further discussion is needed on the question how to group line items. And indeed, as long as there is a common field the selected items shall be sorted everything is fine.
However, things are getting more complex when crossing the border of a company code and processes are not 100% alike, since in company code the grouping criteria may for an account may be the customer number whereas in another it may be the customer order.
Background
In reporting this can be handled by executing certain reports multiple times. In automatic clearing things are different since the clearing rule setup seems to be show stopper:

Customizing: Additional Rules for Automatic Clearing
At first sight this seems to be no-brainer: we just unter BUKRS as Criterion 1 and the job is done… Taking a closer look at the underlying table TF123 shows that this idea is never going to fly, since none of the five criteria are part of the table key:

Definition of table TF123
So what we need is a different approach. And taking a closer look to table TF123 requires us to rephrase the question. So instead of asking:
- How can we group G/L accounts specific to certain company codes?
the question must be rephrased to
- Which common field allows as to have company code specific information automatically recorded on line item level?
To answer this question we must have closer look on the account maintenance, especially to the tab “Control Data”:

G/L Account Maintenance: Control Data
The relevant entry is the highlighted “Sort key”. Looking back to the early days of SAP like R/2 this information was really relevant for sorting since sorting was limited to certain fields of which one was the assignment. But this is history. Looking at SAP S/4HANA the functionality to take over certain field values and field names still exist, whereas sorting is no longer limited to any field.
So one can think that since sorting functionality is no longer required the same applies to the “Sort key”. Actually the “Sort key” is tightly connected to the field ZUONR. The functionality in a nutshell is, it copies a value from one filed or a combination of fields into another one.
Example:
In each line item where the account from the screenshot above is used in company code 0001 the value of the “Settlement period” is copied over into the field ZUONR.
Solution
Since the “Sort key” is assigned on company code level all what there is to do, is to answer the initial question:
- How can we group G/L accounts specific to certain company codes?
and after that assign in each company code the correct sort key to these company codes.
In standard there already exists some pre-defined “Sort keys”:

Sort key
If you can’t find what you are looking for you may define a key that you like. The only restriction is that it must be a field in one of the database tables BKPF, BSEG, BSEC, or BSED.

Definition: T-Code SH02 – Determine Standard Sorting for Line Items
Another restriction is that the result cannot be longer than 18 characters. But despite of this limitation we are free to transfer any value on line item level (combination) we want just out-of-the-box without having to develop anything.
Assume you want to clear items in company code referring to the document number and in another one based on the reference document number. In this case you would assign this very general ledger account for the first company code to sort key 002 and for the last one to 009:

Sort Key 002 – Document Number / Fisc Year

Sort Key 009 – Reference Document Number
Remember how the default customizing regarding Chart of Accounts INT looks like:

Customizing: Additional Rule for Automatic Clearing
In order for an automatic clearing of such an account to work, it must have an entry in this table. Regarding Chart of Accounts INT this setup would work for the general ledger accounts 113101, 113102 and 131511. In all other cases we still would get the according information into our line item, however, automatic clearing would not consider this information.
Conclusion
If you want certain accounts to get considered differently by the automatic clearing, the sort key in combination with the assignment do provide a sophisticated solution. The only limitation is that the basic setup is part of customizing and based on the Chart of Accounts.
This means for the business to take the full capacity of automatic clearing an accounting manual is required that considers the dependency between
- Chart Of Account
- Account Number
- Sort Key.
Recommend
-
15
Work Item Command Line 4.3 Posted on January 17, 2019 I worked with a colleague on the Work Item Command Line who was addin...
-
12
RTC Work Item Command Line Work Item Command Line Version 5.3 See Work Item Command Line 5.0 for instructions how to setup and install WCL....
-
25
Make line item quantities adjustableConfigure the Checkout Session so customers can adjust line item quantity during checkout.Only Checkout payment mode is su...
-
8
New Feature: Line-of-code-based Error Grouping Thijs Cadier on Aug 2, 2021 “I absolutely love AppSignal.” Discover AppSignal
-
5
const biggestItem = arr => Math.max(...arr); Enter fullscreen modeExit fullscreen mode Returns the biggest numerical item of the array. The reposi...
-
6
const closestTo = (arr, number) => arr.reduce((acc, current) => (Math.abs(current - number) < Math.abs(acc - number) ? current : acc) ); Enter fullscreen modeExit fullscreen mode
-
4
-
11
Ruchi Kesharwani 54 secs ago How to prevent PO's line item from being deleted if there was an open invoice in SAP S4hana cloud.
-
8
B1 SDK: Adding Freight To Sales Order to Line Items ...
-
3
Balancing field "Segment" in line item 001 not filled ...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK