155 questions
-2
votes
1
answer
81
views
What means the key in the declaration of a STANDARD internal table?
I see in many existing ABAP programs that standard internal tables are declared without key fields, for instance:
TYPES type_itab TYPE STANDARD TABLE OF sflight WITH DEFAULT KEY.
DATA itab_0 TYPE ...
1
vote
2
answers
383
views
SORT Issue in SAP ABAP
Even though I am sorting the internal table LT_DATA by the FKDAT field, the POSNR field is still being sorted in an unexpected order. For example, in the original data of the internal table, POSNR ...
0
votes
1
answer
315
views
ABAP insert internal table with dynamic name
In ABAP we can insert value into internal table with:
insert wa into table my_table.
Question is, if the name of my_table can only be determined at runtime, how to tackle it? Something like ...
5
votes
1
answer
301
views
Alternative to EXPANDING NESTED TABLES on old version of ABAP?
As one probably knows we have such handy clause of MOVE-CORRESPONDING as EXPANDING NESTED TABLES:
MOVE-CORRESPONDING: <m_source> TO <m_target> EXPANDING NESTED TABLES.
What it basically ...
1
vote
1
answer
950
views
Split an internal table into batches dynamically
In a class based framework where a method (process_in_batch) in the parent class generates batches of data (for a given batch size) for any data coming from a method (prepare_data) redefined in each ...
0
votes
4
answers
7k
views
How can I transform a SELECT with FOR ALL ENTRIES statement into a JOIN?
Suppose if I have a statement like this:
select * from city into table it_city_table
for all entries in it_metropolitans
where city_id eq it_metropolitans-city_id
and winter ne 'cold'.
Now if ...
0
votes
3
answers
6k
views
Read internal table - field symbol has not been assigned yet
I have wrote this small piece of code which updates the data in it_alv based on values in another internal table it_alv_to_check.
At some point while executing the code in the ELSE statement block, I ...
0
votes
1
answer
1k
views
Clearing rows of dynamic internal table with empty value in one column
I am trying to remove rows that have empty values in one column segment. The table is declared dynamically so it does not have a standard type that I can use in DATA declaration like I used to do (...
0
votes
1
answer
742
views
ABAP flag duplicate values in internal table
I need to flag the duplicate values and I found a solution using the code below:
sort result_package stable by knumh zzklfn1.
data lv_prev_knumh type c length 10.
loop at result_package assigning <...
0
votes
3
answers
4k
views
How to avoid nested looping over internal tables in ABAP?
Can you avoid the nested loop on these two internal tables?
DATA: t_fieldcat TYPE slis_fieldcat_alv,
t_fcat TYPE kkblo_t_fieldcat.
LOOP AT T_FIELDCAT INTO LX_FIELDCAT.
LOOP AT T_FCAT INTO ...
0
votes
1
answer
1k
views
ABAP determine internal table duplicates
I need to flag the duplicate fields in a table but sy-tabix is always increasing. I expect for every knum group, a 1 in sy-tabix. Here is the code.
sort result_package stable by knumh zzklfn1.
loop ...
1
vote
1
answer
14k
views
ABAP 7.4 way of filling one itab from another?
Consider, I have GT_KUNNR internal table like below:
KUNNR
TEXT
123
demo text
456
test inv
I have second GT_TEXT internal like below:
KUNNR
TEXT
EXPIRED
123
welcome
X
I am writing the code till now in ...
4
votes
1
answer
7k
views
Best way to check if a line with non-initial field exists?
Let's say I have a table quants and want to find out if any line exists, where the field lenum is not initial. The table is declared inline using a select statement, so I do not have a key available.
...
2
votes
1
answer
104
views
Using REF within a FOR expression - unexpected behaviour
I have some example code below:
DATA(t_strings) = VALUE char10_t( ( 'S1' ) ( 'S2' ) ( 'S3' ) ).
TYPES : BEGIN OF gty_ref,
string_ref TYPE REF TO data,
END OF gty_ref,
...
1
vote
2
answers
6k
views
Dynamically read an internal table with more than one key field
Let us say I have the following code:
iob_typedescr ?= cl_abap_typedescr=>describe_by_name( 'HOUSES' ).
iob_structdescr_table ?= iob_typedescr.
it_ddic_all = iob_structdescr_table->...
1
vote
1
answer
5k
views
Looping through a dynamic internal table
I am trying to split internal table to smaller chunks.
In below example the internal table big_table is split into small tables.
My question is how do we get the actual data from lt_small_tables for ...
-1
votes
2
answers
9k
views
How to create a txt-file on the application server filled with an internal table?
I'm learning ABAP at the moment and got the task to build a function that creates a .txt file or a .csv file from an internal table and save it on the application server.
I know you can use, for ...
0
votes
2
answers
8k
views
Concatenate using 'FOR' loop in VALUE operator with 'BASE' addition?
Is it possible to mix in a FOR with CONCATENATE along with BASE statement?
Normally, itab1 = VALUE #( BASE itab1 ( value1 ) ) will append line1 into itab1 without overwriting. Shouldn't it be the same ...
3
votes
1
answer
36k
views
MOVE-CORRESPONDING for internal tables?
I want MOVE fields from itab1 to itab2 based on their field names. I have tried following:
CLEAR itab2.
MOVE-CORRESPONDING itab1 TO itab2.
This is working out, but only as long as the FIELDS are ...
0
votes
1
answer
6k
views
JOIN of DB table and internal table produces "is not defined in the ABAP Dictionary"
First: I'm working on a existing code and want to add some new stuff to it and I'm really new to ABAP
My goal: I want to duplicate an existing table and remove all values that occur multiple times. ...
0
votes
2
answers
17k
views
How to update internal table without using MODIFY?
I have created internal tables where I want to update age of employee in one internal table by calculating it from another table, I have done arithmetic calculations to get age but now how can I ...
1
vote
2
answers
6k
views
how to improve the performance in nested loops with 2 tables having huge number of entries in abap?
Both tables sorted by key KNO
LOOP AT lt_header INTO lwa_header.
LOOP AT lt_items INTO lwa_item
WHERE key = lwa_header-KNO
“……….
ENDLOOP.
...
0
votes
1
answer
9k
views
How to read an .xlsx file stored in the application server into an ABAP internal table?
I have an Excel (.xlsx) file stored in a known path in AL11 which consists of, let's say, 20 columns and 51 rows of data (one of those rows is the column description which is already known to me ...
1
vote
1
answer
2k
views
LOOP vs parallel cursor LOOP performance?
I'm interviewing for a job, and on the test they sent me they provided the following image of 2 ABAP loops on an internal table, and asked which loop will execute faster:
After checking heavily on ...
3
votes
1
answer
8k
views
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 ...