Skip to Content
2
Jun 05, 2021 at 10:57 AM

ABAP 7.52 Inner Join with an internal table

15160 Views Last edit Jun 05, 2021 at 11:07 AM 5 rev

As from ABAP 7.52 on SAP HANA, it is now possible to do a direct SELECT from an internal table.

SELECT a  FROM  @lt_it
  INTO TABLE @DATA(lt_it2)  
  WHERE b EQ 'E'.

This can also be used to replace SELECTS with for all entries.

SELECT a~field1, a~field2
  FROM dbtable AS a INNER JOIN @lt_it AS b    
  ON a~field3 EQ b~field1 AND
     a~field4 EQ b~field2.

However, I have been noticing a few issues.

When there are different key combinations in the internal table, some values tend to be left out from the DBTABLE.

When I use a single value for example field1 is the same throughout the internal table, I have no problem.

Note that I have not done a SORT of the Internal Table before the SELECT.

What are the main principles before doing such a select? Does the internal table need to be sorted before being used in the inner join?