Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

For All Entries In vs Left Join

absakalli
Explorer
0 Kudos
209

Hi Experts,

Can you explain, whats the differences between two blocks? Which one should be preferred in which situation?

SELECT mara~matnr
FROM @lt_itab as it
LEFT JOIN mara ON mara~matnr eq it~matnr
INTO TABLE @DATA(lt_matnr).

SELECT matnr
FROM mara
INTO TABLE @DATA(lt_matnr)
FOR ALL ENTRIES IN @lt_itab
WHERE matnr eq lt_itab-matnr.
1 REPLY 1

Sandra_Rossi
Active Contributor
0 Kudos
136

I guess it's an interview question. In that case, it's more important to know what you think, to have a discussion, because the interviewers want to evaluate your perspicacity.

FROM lt_itab?

Do you mean:

SELECT ...
FROM @lt_itab ...

Avoid FOR ALL ENTRIES anyway.

FOR ALL ENTRIES corresponds to a INNER JOIN.

Recent ABAP versions allow AMDP, FROM @itab, WITH, GTT...