Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Delete adjacent duplicates comparing all fields. Sorting clarififcation

former_member450822
Participant
0 Likes
6,907

Hi All,

When we use Delete adjacent duplicates comparing all fields, do we need to sort table with all fields ? or "Sort Itab" will be suffiecient .

Regards,

Sri

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
5,868

Just press F1 on SORT and click on further hyperlinks.

Documentation 7.53 of SORT:

  • If no explicit sort key is entered using the addition BY, the internal table itab is sorted by the primary table key.
  • It is best to specify an explicit sort key behind BY, if possible. An implicit sort behind the primary table key (which can itself, in standard tables, be defined implicitly as a standard key) makes a program difficult to understand and possibly unpredictable.

Documentation of primary table key:

  • either a self-defined key or the standard key

Documentation of standard key:

  • ... whose key fields (if the row type is structured) are all table fields with character-like data types and byte-like data types.

If you use DELETE ADJACENT DUPLICATES FROM itab COMPARING ALL FIELDS, it can be preceded with SORT and the pseudo component table_line equivalent to ALL FIELDS (I can't find it in the documentation):

SORT itab BY table_line.

Hi All,

When we use Delete adjacent duplicates comparing all fields, do we need to sort table with all fields ? or "Sort Itab" will be suffiecient .

Regards,

Sri

2 REPLIES 2
Read only

former_member199306
Participant
0 Likes
5,868

Hi,

generally we short table with key fields, then we delete adjacent duplicates comparing those fileds

like sort EKPO by EBELN EBELP

Regards,

Bhupendra

Read only

Sandra_Rossi
Active Contributor
5,869

Just press F1 on SORT and click on further hyperlinks.

Documentation 7.53 of SORT:

  • If no explicit sort key is entered using the addition BY, the internal table itab is sorted by the primary table key.
  • It is best to specify an explicit sort key behind BY, if possible. An implicit sort behind the primary table key (which can itself, in standard tables, be defined implicitly as a standard key) makes a program difficult to understand and possibly unpredictable.

Documentation of primary table key:

  • either a self-defined key or the standard key

Documentation of standard key:

  • ... whose key fields (if the row type is structured) are all table fields with character-like data types and byte-like data types.

If you use DELETE ADJACENT DUPLICATES FROM itab COMPARING ALL FIELDS, it can be preceded with SORT and the pseudo component table_line equivalent to ALL FIELDS (I can't find it in the documentation):

SORT itab BY table_line.