Wednesday 24 December 2014

SORT KEY FUNCTIONALITY

Contents of the Document:

This document is an attempt at analyzing the functionality of sort key in SAP.

This document provides a framework for understanding:

  • What is a Sort Key
  • What is the functionality of a sort key
  • What are the uses of Sort Key
  • General process flow for using sort key
  • Example for illustrating the sort key functionality

Sort Keys:

Sort Keys are used to populate the Assignment number field in the line items of customers or vendors or general ledgers.

The content of this Assignment number field can be populated in a customer or vendor or general ledger document when the document is created:

  • either manually
  • or automatically by the system

Whenever a document is created, the Assignment number field in the document line items will be populated automatically, if the requisite sort keys are assigned to the customers or vendors or general ledgers master record.

Use of Sort Key - Benefits of Automatic Population of Assignment Field:

Whenever any standard reports are executed for displaying the line items of customers or vendors or general ledgers, SAP uses the content of the Assignment number field as one of the criteria to sort and display the line items.

What are the contents that can be populated automatically in the Assignment number field:

The Assignment number field of a customer or vendor or general ledger document line item can be populated automatically with the contents of one or more fields which are:


  • Either the data derived from the header of the document
  • Or the data derived from the line item of the document


The only requirement is that the above mentioned data proposed to be populated automatically in the Assignment number field should be available in one of the database tables – BKPF or BSEG or BSEC or BSED.


Can partial contents be populated in the Assignment number field:


The contents of the fields available in the database tables – BKPF or BSEG or BSEC or BSED can be populated automatically in the Assignment number field of the document, either completely or partially.


This can be controlled by mentioning the length of the field to be transferred in the fields – Length and Offset.


Applicability of the Sort Key logic:


The logic defined in the Sort Key is applicable across the client.


General Process Flow Describing Sort Key Functionality:


Sort Key - Process Flow1.png

Illustration of Sort Key Functionality:

Step 1:
SAP Configuration - Define Sort Key:

DescriptionTransaction Code
Determine Standard Sorting for Line ItemsSPRO/OB16

The standard sort keys provided by SAP can be used to automatically populate the Assignment number field.

But custom sort keys can also be defined if the requirements of the client cannot be met with the standard sort keys available.

For example, if the standard sort key – 002 is assigned to the customer or vendor or general ledger master record, it would populate the Assignment number field of the document with the document number (BELNR) followed by the fiscal year (GJAHR).

Similarly, the standard sort key – 001, would populate the Assignment number field of the document with the posting date.

Sort Key SPRO 1.PNG

Sort Key SPRO 2.PNG
Parameters of standard sort key 002 - Screen Shot:

Sort Key SPRO 3.PNG
Parameters of standard sort key 001 - Screen Shot:

Step 2:

Master Data maintenance - for illustrating Sort Key Functionality:

Assigning Sort Key in the customer master:

DescriptionTransaction Code
Create/change Customer masterFD01/FD02/XD01/XD02

In the example, the standard sort key – 001 has been assigned to the customer master.

Customer Master - Assign Sort Key 001.PNG

Assignment of Sort Key in Customer Master Record - Screen Shot:

(Similar assignment can be made in the case of vendor or general ledger master record also)

Step 3:

Transactional data - for illustrating Sort Key Functionality:

Post Invoice against customer:

DescriptionTransaction Code
Enter Customer InvoiceFB70/VF01

An invoice is posted against the customer referred above, without entering anything in the Assignment number field.

After the document is saved, if the Assignment number field is checked, it can be seen that the field is automatically populated with the posting date of the document.

In the example below, the sort key assigned in the customer master record is 001 - Posting Date.

Since the posting date of the customer invoice - 7500205569, is 07/20/2012, the Assignment number field in the document is automatically populated with the posting date in the format YYYYMMDD (20120720).

Allocation Field in Invoice.PNG

Automatic population of Assignment Number field in the customer invoice - Screen Shot:

Similarly, for subsequent documents posted, the posting date would automatically get populated in the Assignment number field.

In the example, the posting date of the document 7500208207 is 08/03/2012, and hence the Assignment number field is automatically populated as 20120803.

Similarly, the posting date of the document 7500210765 is 08/17/2012, and hence the Assignment number field is automatically populated as 20120817.

Step 4:

Transactional data - for illustrating Sort Key Functionality:

Customer Line Item Display:

DescriptionTransaction Code
Customer Line Item DisplayFBL5N

When the transaction code is executed to display the customer line items, it can be observed that the line items are displayed sorted on the basis of the content of the Assignment number field.

Customer Line Item Display.PNG

Customer Line Item Display Report - Screen Shot:


Step 5:

Transactional data - for illustrating Sort Key Functionality:

Modify Assignment number field of the customer invoice:

DescriptionTransaction Code
Change Customer Document Line ItemFB02

The Assignment number field of the customer invoice - 7500205569 is modified manually and the content is changed from 20120720 to 20120920

Modified Allocation Field in Invoice.PNG

Modification of Assignment Number field in Customer Invoice - Screen Shot:

Step 6:

Transactional data - for illustrating Sort Key Functionality:

Re-run Customer Line Item Display:

DescriptionTransaction Code
Customer Line Item DisplayFBL5N

When the transaction code is re-executed to display the customer line items, it can be observed that the line items are displayed sorted on the basis of the content of the modified Assignment number fields.

The customer invoice - 7500205569 which was previously displayed as the first invoice in the report is currently being displayed as the third invoice, because the content of the Assignment number field has been modified.

Modified Customer Line Item Display.PNG

Customer Line Item Display Report after modification of Assignment number field - Screen Shot:

Conclusion:

Based on the above discussion, it can be concluded that:

  • The Assignment number field of a customer or vendor or general ledger document, if not manually populated, will be automatically populated with the data from the header or line item of the document as per the sort key assigned to the customer or vendor of general ledger master record.
  • The content that will be populated in the Assignment number field will be derived from the database tables –BKPF or BSEG or BSEC or BSED.
  • The customer line items are displayed in standard SAP reports after being sorted on the basis of the content of the Assignment number field.
Hi

1. When you give the sort key the assignment field in FBL3N gets filled with the value that has been gien in the sort key.

2. The second use is you can sort the assignment field in FBL3N.

Another functionality or use of sort key is

Where Sort Keys are created

Use Tcode OB16.

Why we are using sort keys.

Straight answer to this is sort key offers great help in Automatic Clearing.

First we understand how does it function. If you have created Bank GL and there you have used 001 (posting date) as sort key then whenever you make entry for that bank Gl your sort key "Posting date" is automatically updated in "Assignment" field unless you manually insert anything in assignment field.

Let's take a simple example for why sort keys are helpful.

Suppose, there is GR/IR account created with sort key 014 (Purchase Order) so at the time of

1. Goods receipt Purchase order with item no will automatically filled in assignment field.

Inventory dr. 15000

GR/IR cr 15000.

In GR/IR account item Assignment would be 150000 10.

2. Invoice through MIRO will also feed Purchase Order with item no in assignment field.

GR/IR dr . 15000
Tax dr. 5000
Vendot cr. 20000

In GR/IR account item Assignment would be 150000 10.

Now your entry is over. There are large number of such entries posted in the period for the GR/IR account.
So, manual clearing becomes very tedious for GR/IR clearing account. In order to avoid that Automatic Clearing program is configured in OB74, where you give field ZUONR i.e. assignment in first criterion. So, line items with same assignment and amount will be cleared automatically upon F.13 transaction.

No comments:

Post a Comment