Use this tag for questions regarding ABAP internal tables.
Questions tagged [internal-tables]
141 questions
4
votes
2 answers
Using AT FIRST to initialise loop variables
It seems like the AT FIRST statement of control level processing is ideal for any commands that have to be run or variables that have to be initialised before the loop itself starts running. Given how AT commands clear columns in the work area it's…

Lilienthal
- 4,327
- 13
- 52
- 88
4
votes
2 answers
DELETE ADJACENT DUPLICATES does not delete duplicates
I have an internal table that is filled with 108 entries. From 9 to 9 entries it's repeating the entries and I wanted to delete those duplicates. Since they're exactly the same I used the delete adjacent duplicates from itab comparing all fields.…

Eva Dias
- 1,709
- 9
- 36
- 67
3
votes
1 answer
When sorting of itab is done in SQL query?
I have a select like this
DATA lt_data TYPE SORTED TABLE OF T_TYPE1 WITH NON-UNIQUE KEY col1.
SELECT col1, col2 INTO CORRESPONDING FIELDS OF TABLE lt_data where...
My question is: will the sorting operation be performed on the DB or on the…

Skalozub
- 539
- 7
- 26
3
votes
1 answer
Performant way to filter itab against another itab values with 7.40+ syntax?
Suppose I have 2 internal tables:
TYPES:BEGIN OF LTY_FILE,
SOKEY TYPE CHAR5,
SOPONO TYPE CHAR15,
SOCONO TYPE CHAR15,
FLAG TYPE C,
END OF LTY_FILE.
data:IT_ARCHIVE TYPE TABLE OF LTY_FILE,
IT_SAP TYPE TABLE…

CoderW
- 123
- 3
- 14
3
votes
5 answers
is it a structure or an internal table?
TYPES: BEGIN OF PPP
------
END OF PPP,
xxx TYPE STANDARD TABLE OF PPP
My question is will xxx be an internal table or a structure?

kc3
- 4,281
- 7
- 20
- 16
3
votes
2 answers
How to add a new row into a nested internal table?
DATA: BEGIN OF line,
CUOBJ TYPE CUOBJ,
tab_atinn TYPE STANDARD TABLE OF ATINN WITH DEFAULT KEY,
END OF line.
DATA:
CUBOBJ_TABLE LIKE STANDARD TABLE OF line WITH DEFAULT KEY.
...
DATA(table) = CUBOBJ_TABLE[ CUOBJ =…

OmatoSoup
- 265
- 3
- 11
3
votes
1 answer
Delete internal table lines where field contains the "+"?
I want to delete entries from an internal table, which has not a "+" in one column. Now, if I want to delete it like this:
DELETE internal_table where field1 <> '+'.
it doesn't work. This means, it takes the "+" as a regex and just selects any…

Sasku
- 517
- 7
- 23
3
votes
2 answers
Behavior of a SORT without BY on standard internal tables? Is it safe?
What exactly does the SORT statement without key specification do when run on a standard internal table? As per the documentation:
If no explicit sort key is entered using the addition BY, the internal table itab is sorted by the primary table key.…

Lilienthal
- 4,327
- 13
- 52
- 88
3
votes
3 answers
Calculate total and subtotal without loop?
I am starting learning the new abap. But i have problems. I want to make result output as below without using "LOOP" and "AT" statements.
I have internal table like:
Category Amount
AAA 10
AAA 20
BBB 30
CCC 40
CCC…

Joey
- 43
- 1
- 5
3
votes
4 answers
Shortest notation to split ABAP internal table into smaller pieces
In ABAP, I have a pretty large internal table, say 31,000 rows. What's the shortest and most efficient way to split that into multiple smaller tables of fixed size, say 1,000 rows each?
Naive way would be:
DATA lt_next_package TYPE…

Florian
- 4,821
- 2
- 19
- 44
3
votes
4 answers
Very slow itab loop with nested SELECTs
I have declare an internal table like:
DATA: wa_collectoraction TYPE zcollectoraction,
it_collectoraction LIKE STANDARD TABLE OF zcollectoraction.
Then I fill the table with:
SELECT bukrs kunnr yearmonth MAX( dat ) AS dat
FROM zcollectoraction
…

ekekakos
- 563
- 3
- 20
- 39
3
votes
2 answers
Dynamic query from internal table
I had a requirement in which I wanted to dynamically run this query. Has anyone have worked on this kind of query?
READ TABLE table_name TRANSPORTING feild_name INTO table_name
WITH KEY key_feild1 = value1,
…

Ankit Chaurasia
- 163
- 2
- 5
- 14
3
votes
6 answers
Optimize LOOP AT with conditions =, >=, <= in WHERE
My internal table contains a lot of data.
I have the following code:
LOOP AT lt_tab INTO ls_tab
WHERE value1 EQ lv_id1
AND value2 LE lv_id2
AND value3 GE lv_id3.
IF ls_tab-value4 IS NOT INITIAL.
IF ls_tab-value4 NE lv_var.
…

Twity 56876
- 125
- 1
- 2
- 7
3
votes
2 answers
What's the fastest way to concatenate items from several lines into one field?
In ABAP, what would be the fastest way to concatenate items of the same field from multiple lines into a field of one line?
My program is supposed to report a list of payments, the vendor's ID, and the vendor's email addresses.
Email addresses are…

Cutter
- 1,673
- 7
- 27
- 43
3
votes
1 answer
Only the last entry is selected to itab
At my selection Screen you can choose with a radio button Group with which kind of number you want to select the information. (material number, construction contract or customer order).
After choosing a kind, the User have to fill in the number(s)…

Jay
- 113
- 12