Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

11/27/2017 Sort Key Functionalities | SAP Blogs

Products
Products Industries
Industries Support
Support Training
Training Community
Community Developer
Developer Partner
Partner

About
About


Home / Community / Blogs + Actions

Sort Key Functionalities


January 16, 2013 | 7,611 Views |

G. Ajit Kumar
more by this author

FIN (Finance)
SAP ERP | allocation | assignment | enterprise resource planning | erp financials | finance solutions | Financial Excellence | item
overview

share
0 share
0 tweet share
0

Follow

Contents of the Document:

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

https://blogs.sap.com/2013/01/16/sort-key-functionalities/ 1/18
11/27/2017 Sort Key Functionalities | SAP Blogs

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.
https://blogs.sap.com/2013/01/16/sort-key-functionalities/ 2/18
11/27/2017 Sort Key Functionalities | SAP Blogs

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:

Illustration of Sort Key Functionality:

Step 1:

SAP Configuration Define Sort Key:

Descrip on Transac on Code

Determine Standard Sor ng for Line Items SPRO/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

https://blogs.sap.com/2013/01/16/sort-key-functionalities/ 3/18
11/27/2017 Sort Key Functionalities | SAP Blogs

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.

Parameters of standard sort key 002 Screen Shot:

https://blogs.sap.com/2013/01/16/sort-key-functionalities/ 4/18
11/27/2017 Sort Key Functionalities | SAP Blogs

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:

Descrip on Transac on Code

Create/change Customer master FD01/FD02/XD01/XD02

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

Assignment of Sort Key in Customer Master Record Screen Shot:

https://blogs.sap.com/2013/01/16/sort-key-functionalities/ 5/18
11/27/2017 Sort Key Functionalities | SAP Blogs

(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:

Descrip on Transac on Code

Enter Customer Invoice FB70/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).

Automatic population of Assignment Number field in the customer


invoice Screen Shot:

https://blogs.sap.com/2013/01/16/sort-key-functionalities/ 6/18
11/27/2017 Sort Key Functionalities | SAP Blogs

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:

Descrip on Transac on Code

Customer Line Item Display FBL5N

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 Report Screen Shot:

Step 5:

Transactional data for illustrating Sort Key Functionality:

Modify Assignment number field of the customer invoice:

Descrip on Transac on Code

Change Customer Document Line Item FB02

https://blogs.sap.com/2013/01/16/sort-key-functionalities/ 7/18
11/27/2017 Sort Key Functionalities | SAP Blogs

The Assignment number field of the customer invoice 7500205569 is


modified manually and the content is changed from 20120720 to 20120920

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:

Descrip on Transac on Code

Customer Line Item Display FBL5N

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.

https://blogs.sap.com/2013/01/16/sort-key-functionalities/ 8/18
11/27/2017 Sort Key Functionalities | SAP Blogs

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.

Alert Moderator

https://blogs.sap.com/2013/01/16/sort-key-functionalities/ 9/18
11/27/2017 Sort Key Functionalities | SAP Blogs

30 Comments
You must be Logged on to comment or reply to a post.

Debarun Sinha

February 7, 2013 at 11:34 am

its very helpfull

G. Ajit Kumar Post author

September 16, 2013 at 2:27 pm

Thanks Debarun!

Sankar AK

September 16, 2013 at 6:06 am

Hi Ajit kumar,

Helped me to understand the functionaries of Sort key and also helped me to analyse
our clients issue in this regards. Thanks for this nice document.

Thanks

G. Ajit Kumar Post author

September 16, 2013 at 2:18 pm

Most welcome SKA!

https://blogs.sap.com/2013/01/16/sort-key-functionalities/ 10/18
11/27/2017 Sort Key Functionalities | SAP Blogs

Cecil D'Souza

September 16, 2013 at 10:48 pm

I am a newbie and I found that it is impossible to get to the sort key screen by entering
SPRO and Enter. I then used tcode SM30 and it asks for the table name. Can you
please adjust the procedural steps to fill the gap?.

G. Ajit Kumar Post author

September 17, 2013 at 11:59 am

Hi Cecil,

Please use the transaction code OB16 to access the details of Sort Keys.

Thanks and regards,

Ajit

Cecil D'Souza

September 17, 2013 at 12:42 pm

Thank you very much Ajit for your timely help. Its great to get
professional help and guidance like this. What a system this
internet has created.

Ranu Eugene

September 17, 2013 at 12:20 pm

Hi Ajit,

Very helpful and self explanatory doc.

Very well described by you and it made very clear the use of sort keys in Master Data.

Nice job done.

https://blogs.sap.com/2013/01/16/sort-key-functionalities/ 11/18
11/27/2017 Sort Key Functionalities | SAP Blogs

Keep up the good work.

Best of Luck.

Regards

Eugene

G. Ajit Kumar Post author

September 17, 2013 at 12:26 pm

Thanks Eugene

deepa p

September 17, 2013 at 4:35 pm

Hi Ajit,

Nice doument of sort keys i guess its really helpful for beginners like me, mainly
sharing the knowledge on customization of sort keys is appreciated.

regards

Deepa

Krishna Bhandari

November 24, 2013 at 3:27 am

Very useful thank you

Lakshmi Sama

https://blogs.sap.com/2013/01/16/sort-key-functionalities/ 12/18
11/27/2017 Sort Key Functionalities | SAP Blogs

January 3, 2014 at 7:12 am

Hello Arjit,

Very helpful and a good concept. And very well explained. Thanks for sharing the
knowledge on a new concept and keep sharing

Regards,

Lakshmi S

narin kamuni

January 6, 2014 at 6:01 am

Very well documented Very useful document Thanks for the efforts.

Regards,

Narin Kamuni

Arvind Pereira

March 24, 2014 at 1:32 pm

Hello Arjit,

Very helpful, Very useful, very clear.

Thanks

Arvind

Pankaj Bansal

March 24, 2014 at 2:03 pm

Arjit,

Very helpful !

https://blogs.sap.com/2013/01/16/sort-key-functionalities/ 13/18
11/27/2017 Sort Key Functionalities | SAP Blogs

pulak samantaray

March 24, 2014 at 3:53 pm

thanks ajit,

nice document

regards

pulak

Karteek k

May 28, 2014 at 9:03 am

beautiful explanation!! thanks for sharing your knowledge

Kiran T

July 18, 2014 at 2:37 am

Very Very Helpful

Thanks

Regards

KIran

eliud maina

August 27, 2014 at 3:48 am

Thanks for sharing a great document sir !!!


https://blogs.sap.com/2013/01/16/sort-key-functionalities/ 14/18
11/27/2017 Sort Key Functionalities | SAP Blogs

Kiran MMD

November 9, 2014 at 7:22 am

Thank you very much for the detailed explanation regarding Sort key. Its self explanatory
and really helpful.

Suresh B

November 18, 2014 at 4:35 am

Its very good notes.

CA. Prasad Atmakuri

November 18, 2014 at 10:22 am

Hi Ajith

Thanks for sharing nice document

Regards

Prasad

Sethuraman Ganesamurthy

November 24, 2014 at 10:37 am

Hi Ajith,

Thanks a lot for sharing.

It is very useful info.


https://blogs.sap.com/2013/01/16/sort-key-functionalities/ 15/18
11/27/2017 Sort Key Functionalities | SAP Blogs

Regards,

GSR

Prakash Sutar

July 11, 2015 at 5:54 am

Hi Ajit,

Very useful information and nicely presented.

Thanks,

Prakash

Manasi kulkarni Phatak

August 27, 2015 at 9:36 am

Very useful Info..

Selvakumar Natarajan

September 17, 2015 at 7:38 pm

very very useful info.. the area often user fail to do the appropriate sort key thank u for
your efforts..

Karteek k

May 18, 2016 at 3:52 am

Hi Ajit,

https://blogs.sap.com/2013/01/16/sort-key-functionalities/ 16/18
11/27/2017 Sort Key Functionalities | SAP Blogs

Nice document. beautiful explanation.

Regards

Karthi

Hoysala SAP

August 19, 2016 at 11:41 am

Thanks a lot, Ajith.

Can you pls clarify my doubt. We will need to populate #Shipment number in Assignment
field and that Shipment number is available in Material document. However, I do not find
any Logistic related fields in OB16. Can you pls let me know how can we achieve this
requirement.

Thank you.

Vishwanath Gamanagatti

March 10, 2017 at 1:59 pm

Its very informative and very well documented. Thanks for taking affects and sharing
with us.

Sateesh Suripally

November 12, 2017 at 10:40 pm

Well explained

https://blogs.sap.com/2013/01/16/sort-key-functionalities/ 17/18
11/27/2017 Sort Key Functionalities | SAP Blogs

Share & Follow


Privacy Terms of Use Legal Disclosure Copyright Trademark Sitemap Newsletter

https://blogs.sap.com/2013/01/16/sort-key-functionalities/ 18/18

You might also like