Skip to Content
0
Dec 07, 2022 at 10:06 AM

How do I read the last entry of an internal table using READ TABLE?

115 Views

How do I read the last entry of an internal table? Assuming that sometimes the entries of the internal is not fixed as sometime it has 1,2,3, or 4 entries.

I want to read the the last entry of T_EKBE table. Sorting the Material Document Number is prohibited as the material document numbers is not always in sequential form. Here's my code and I believe that READ TABLE only selects the first entry.

    READ TABLE t_ekko_ekpo ASSIGNING FIELD-SYMBOL(<lfs_ekko_ekpo>)
WITH KEY ebeln = t_ekbe-ebeln
ebelp = t_ekbe-ebelp
waers = t_ekbe-waers
BINARY SEARCH.

Currently, the first line is being read here. I want the last line to be read instead.

image.png

Attachments

image.png (85.4 kB)