Thursday, May 29, 2025

πŸ” Internal Tables - READ

 READ:

It reads a single record from Body to Header Line (or) Work Area

Syntax:

READ TABLE it[INTO wa]

[INDEX n][WITH KEY keyexpression]

[TRANSPORTING fieldname]

[Binary Serach]

 

READ TABLE it:

           Reads a single record from Body to Header Line

           Ex: READ TABLE it INTO it.

READ TABLE it INTO wa INDEX n:

           It reads a specific record (Line Number) from Body to Work Area

           Ex: READ TABLE it INTO wa INDEX 5.

READ TABLE it INTO wa WITH KEY keyexpression:

       It reads a specific record which matches a given condition in Work Area

        Ex: READ TABLE it INTO wa WITH KEY customer=wa1-customer

 READ TABLE it INTO wa WITH KEY keyexpression TRANSPORTING <field1> <field2>……….:

Ex: READ TABLE it INTO wa WITH KEY customer=wa1-customer TRANSPORTING city (it will shows only city field)

Binary Search:

It reads data from Body to Work Area based on binary search algorithm

Note:

1. Use binary search if Internal table is large

2. Data should be sorted before applying binary search algorithm

3. There should be no duplicate records in Internal Table

4. Binary search algorithm improves performance of programming.

No comments:

Post a Comment