2020 Jan 15 4:23 PM
Hello,
Is there a table function feature which allows accessing multiple rows of an internal table at once.
Eg: itab[ 3 to 10 ] should return all rows between index 3 and 10 both inclusive.
2020 Jan 15 5:22 PM
Eventually use this workaround :
VALUE #( ( LINES OF itab FROM 3 TO 10 ) )(see ABAP documentation of LINES OF)
Complete example:
TYPES ty_itab TYPE STANDARD TABLE OF i WITH EMPTY KEY.
DATA: itab TYPE ty_itab,
itab2 TYPE ty_itab.
itab = VALUE #( ( 1 ) ( 2 ) ( 3 ) ( 4 ) ( 5 ) ( 6 ) ( 7 ) ( 8 ) ( 9 ) ( 10 ) ( 11 ) ).
itab2 = VALUE #( ( LINES OF itab2 FROM 3 TO 10 ) ).
ASSERT itab2 = VALUE ty_itab( ( 3 ) ( 4 ) ( 5 ) ( 6 ) ( 7 ) ( 8 ) ( 9 ) ( 10 ) ).
Hello,
Is there a table function feature which allows accessing multiple rows of an internal table at once.
Eg: itab[ 3 to 10 ] should return all rows between index 3 and 10 both inclusive.
2020 Jan 15 5:12 PM
Hi,
Not aware of table expression like you mentioned.
As an alternative, you can loop at table, then you have option to mention start index and end index in ‘loop at ......’ statement.
GK
2020 Jan 15 5:22 PM
Eventually use this workaround :
VALUE #( ( LINES OF itab FROM 3 TO 10 ) )(see ABAP documentation of LINES OF)
Complete example:
TYPES ty_itab TYPE STANDARD TABLE OF i WITH EMPTY KEY.
DATA: itab TYPE ty_itab,
itab2 TYPE ty_itab.
itab = VALUE #( ( 1 ) ( 2 ) ( 3 ) ( 4 ) ( 5 ) ( 6 ) ( 7 ) ( 8 ) ( 9 ) ( 10 ) ( 11 ) ).
itab2 = VALUE #( ( LINES OF itab2 FROM 3 TO 10 ) ).
ASSERT itab2 = VALUE ty_itab( ( 3 ) ( 4 ) ( 5 ) ( 6 ) ( 7 ) ( 8 ) ( 9 ) ( 10 ) ).
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |