SAP ABAP - Sorted Internal Table With INDEX Access (With Example)
Submitted By: Shilpa Gunjan (L&T Infotech) Here's an example on sorted internal table using INDEX access. This example will help you to understand how to improve performance using Sorted Internal Tables. REPORT z_internal_table_test. *Sorted Internal Table (Performance) TYPES: BEGIN OF x_marc, matnr LIKE marc-matnr, werks LIKE marc-werks, pstat LIKE marc-pstat, flag TYPE c, END OF x_marc. *Internal Table Declaration DATA: it_marc TYPE SORTED TABLE OF x_marc WITH NON-UNIQUE KEY werks. * Table Workarea Declaration DATA: wa_marc TYPE x_marc. * Variable Declaration DATA: v_counter TYPE i, v_runtime1 TYPE i, v_runtime2 TYPE i, v_tabix LIKE sy-tabix. SELECT matnr " Material Number werks " Plant pstat " Maintenance status FROM marc INTO TABLE it_marc. GET RUN TIME FIELD v_runtime1. READ TABLE it_marc INTO wa_marc WITH KEY werk...