Sort and Read Internal Table
Task
Sort an internal table by quantity and read a specific entry using READ TABLE.
- Use SORT statement
- Use READ TABLE with INDEX or KEY
- Handle SY-SUBRC properly
Write Your ABAP Code
Loading...
📥 Sample Input & Output
MATNR MENGE A100 10 A200 5 A300 20 After Sort (DESC): A300
💡 Hint
Use SORT it_data BY menge DESCENDING beforeREAD TABLE.
✅ View Reference Solution
SORT it_data BY menge DESCENDING. READ TABLE it_data INTO ls_data INDEX 1. IF sy-subrc = 0. " ls_data contains highest quantity ENDIF.