‎2014 Aug 08 6:16 AM
Hello Experts,
I need to create a list from table sbook containing booking number (sbook-bookid), customer number (sbook-customid), customer name (scustom-name) , customer class (sbook-class) and ticket price (sflight-price). I am new to ABAP and am very confused I tried reading up some examples and came up with the attached program
Attached is my program for inner join
Kindly Help
Thanks Su
‎2014 Aug 08 6:24 AM
Hi,
First Provide your Join then into table, Also check for the valid values in IT_FLIGHT-CONNID
SELECT SBOOK~BOOKID SBOOK~CUSTOMID SBOOK~CLASS
SCUSTOM~ID SCUSTOM~NAME FROM SBOOK
INNER JOIN SCUSTOM ON SCUSTOM~ID = SBOOK~ID
into TABLE itbook
where CONNID = IT_FLIGHT-CONNID.
Regards
‎2014 Aug 08 6:34 AM
Hi Somendra,
Thanks for responding how do I join the ticket price field (sflight-price) from sflight to the above select statement?
‎2014 Aug 08 6:45 AM
Hi Su K
You May use key fields , Foreign keys for joining , Here
SELECT SBOOK~BOOKID SBOOK~CUSTOMID SBOOK~CLASS
SCUSTOM~ID SCUSTOM~NAME FROM SFILGHT
INNER JOIN SBOOK ON SBOOK~CARRID EQ SFILGHT~CARRID
SBOOK~CONNID EQ SFILGHT~CONNID
SBOOK~FLDATE EQ SFILGHT~FLDATE
INNER JOIN SCUSTOM ON SCUSTOM~ID = SBOOK~ID
‎2014 Aug 08 6:42 AM
Hi,
To join two tables you need common field in both table.
select <db1~f1>
<db1~f2>
<db2~g1>
<db2~g2>
from db1 innerjoin db2 on <db1~f1> = <db2~f1>
into table <it_tab> where f1 = <selection_screen_field>.
regards.
laxman
‎2014 Aug 08 6:43 AM
‎2014 Aug 08 6:55 AM
Hi,
The correct syntax is:
SELECT SBOOK~BOOKID SBOOK~CUSTOMID SBOOK~CLASS
SCUSTOM~NAME sbook~loccuram SCUSTOM~ID FROM SBOOK
INNER JOIN SCUSTOM ON SCUSTOM~ID eq SBOOK~customID into table itbook where sbook~CONNID = IT_FLIGHT-CONNID.
plz try this query.