Secondary indexes for internal tables

In this recipe, we will see the new concept of secondary keys/index within internal tables. This lets you optimize your programs when accessing data residing within an internal table.

Getting ready

In this recipe, we will create a program that will store all data of table VBAK into an internal table. Then we will use the secondary key in order to fetch a record pertaining to a given order number, aufnr. The primary emphasis of this recipe is on the definition and usage of a secondary key for internal tables.

How to do it...

For creating a program using secondary index in internal tables, follow the steps below:

  1. We first declare a type ty_vbak based on the database table vbak. We create two keys for this table type. ...

Get SAP ABAP Advanced Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.