SAP VIRTUAL SORT COMBINED ABEXA



Get Example source ABAP code based on a different SAP table
  



ABAP_ITAB - Virtual Sort of Two Tables
This example demonstrates the virtual sorting of two internal tables.

ABAP_SOURCE_CODE
DEMO CL_DEMO_VIRTUAL_SORT_COMBINED

ABAP_DESCRIPTION
An internal table itab1 containing random numbers and an internal table itab2 containing random letters are sorted together virtually using the method VIRTUAL_SORT of system class CL_ABAP_ITAB_UTILITIES, which sorts both columns of itab1 in ascending order and both columns of itab2 in descending alphabetical order. The returned array contains the line numbers in the sort order. This array is used to fill the internal table comb_tab, combined from the columns of the involved tables, according to the sorting. For comparison, another combined table test_tab, with the content from itab1 and itab2, is constructed and sorted using the statement SORT. The results are the same. However, in a real example the combined tables are not usually of interest. See the executable example Virtual Sorting of Flight Data.