Tuesday, May 12, 2026

Example of Sort in Table

 This is example of a sort using both ascending and descending order in the same table.

REPORT ZGB_SORT.

TYPES:
  BEGIN OF line,
    col1 TYPE LENGTH 1,
    col2 TYPE i,
  END OF line.

DATA itab TYPE STANDARD TABLE OF line WITH EMPTY KEY.

itab VALUE #col1 'A' col2 )
                col1 'B' col2 )
                col1 'B' col2 )
                col1 'C' col2 )
                col1 'C' col2 )
                col1 'B' col2 )
                col1 'A' col2 )
                col1 'A' col2 )
                col1 'C' col2 ).

SORT itab BY col1 ASCENDING col2 DESCENDING.

cl_demo_output=>displayitab ).

The output is like:



No comments:

Post a Comment

AI-Powered Warehouse Temperature Automation Using IoT and SAP

  Overview In this project, we present a smart, scalable solution that leverages  AI ,  IoT , and  SAP technologies  to automate and optim...