Select in ABAP 7.40 and Above

When you have same filed name in two different table and you wish to select both the fields.

Select a~kunnr, a~name1, b~name1 as name1_adrc
from kna1 as a
inner join adrc as b on
b~addrnumber = a~adrnr
where a~land1 = ‘NL’
into table @data(lt_kna1).

How to declare new field in Selection
Select a~kunnr, a~name1, b~name1 as name1_adrc
cast( lifnr as Char( 10 ) ) as itab_field
from kna1 as a
inner join adrc as b on
b~addrnumber = a~adrnr
where a~land1 = ‘NL’
into table @data(lt_kna1).

in 7.4
Select a~kunnr, a~name1, b~name1 as name1_adrc
@( value tabkey( ) ) as itab_field
from kna1 as a
inner join adrc as b on
b~addrnumber = a~adrnr
where a~land1 = ‘NL’
into table @data(lt_kna1).

Leave a Reply

Your email address will not be published. Required fields are marked *