‎2007 May 16 8:02 AM
Hi,
please help me retrieving the data into followinf internal table:
TYPES: BEGIN OF STR_ITAB1,
CARRID LIKE SPFLI-CARRID,
CONNID LIKE SPFLI-CONNID,
CARRNAME LIKE SCARR-CARRNAME,
CITYFROM LIKE SPFLI-CITYFROM,
CITYTO LIKE SPFLI-CITYTO,
FLDATE LIKE SFLIGHT-FLDATE,
PRICE LIKE SFLIGHT-PRICE,
DEPTIME LIKE SPFLI-DEPTIME,
ARRTIME LIKE SPFLI-ARRTIME,
END OF STR_ITAB1.
the table used are: spfli, sflight, scarr.
the parameters are: cityfrom, cityto, and fldate.
regards
vivek
‎2007 May 16 8:16 AM
Hi,
find below complete program codes:
tables: spfli, sflight, scarr.
parameters: cityfrom like spfli-cityfrom,
cityto like spfli-cityto,
fldate like sflight-fldate.
data : itab type standard table of str_itab1.
select * into corrosponding fields of table itab
from sflight as a inner join spfli as b on acarrid = bcarrid and aconnid = bconnid
innerjoin on scarr as c on a!carrid= c~carrid
where <conditions>
Hope this iwll help u.
Jogdand M B
‎2007 May 16 8:10 AM
Hi
select
a~CARRID
a~CONNID
b~CARRNAME
a~CITYFROM
a~CITYTO
c~FLDATE
c~PRICE
a~DEPTIME
a~ARRTIME
into table ITAB
from spfli as a join scarr as b on
acarrid = bcarrid
join sflight as c on
ccarrid = acarrid and
cconnid = aconnid
where a~cityfrom in s_cityfrom and
a~cityto in s_cityto and
c~fldate in s_fldate.
Reward points if useful
Regards
Anji
Message was edited by:
Anji Reddy Vangala
‎2007 May 16 8:14 AM
PARAMETERS: cityfrom LIKE spfli-cityfrom,
cityto LIKE spfli-cityto,
fldate LIKE sflight-fldate.
TYPES: BEGIN OF str_itab1,
carrid LIKE spfli-carrid,
connid LIKE spfli-connid,
carrname LIKE scarr-carrname,
cityfrom LIKE spfli-cityfrom,
cityto LIKE spfli-cityto,
fldate LIKE sflight-fldate,
price LIKE sflight-price,
deptime LIKE spfli-deptime,
arrtime LIKE spfli-arrtime,
END OF str_itab1.
DATA: itab1 TYPE STANDARD TABLE OF str_itab1 .
SELECT a~carrid a~connid a~cityfrom a~cityto a~deptime a~arrtime
b~fldate b~price
c~carrname
INTO TABLE itab1
FROM spfli AS a JOIN sflight AS b
ON a~carrid = b~carrid AND a~connid = b~connid
JOIN scarr AS c ON a~carrid = c~carrid
WHERE a~cityfrom = cityfrom
AND a~cityto = cityto
AND b~fldate = fldate.
‎2007 May 16 8:15 AM
Hi
Adding to that
You have declared Types:BEGIN OF STR_ITAB1,
it is work area and you need to append it.
use data : begin of itab occurs 0 with header line,
carrid ...
end of itab.
Thanks
‎2007 May 16 8:16 AM
Hi,
find below complete program codes:
tables: spfli, sflight, scarr.
parameters: cityfrom like spfli-cityfrom,
cityto like spfli-cityto,
fldate like sflight-fldate.
data : itab type standard table of str_itab1.
select * into corrosponding fields of table itab
from sflight as a inner join spfli as b on acarrid = bcarrid and aconnid = bconnid
innerjoin on scarr as c on a!carrid= c~carrid
where <conditions>
Hope this iwll help u.
Jogdand M B
‎2007 May 16 8:26 AM
hi, you can go with this one:
DATA: itab type standard table of str_itab1.
SELECT SPFLI~CARRID SPFLI~CONNID SCARR~CARRNAME SPFLI~CITYFROM SPFLI~CITYTO SFLIGHT~FLDATE SFLIGHT~PRICE SPFLI~DEPTIME SPFLI~ARRTIME SFLIGHT~CARRID SFLIGHT~CONNID SCARR~CARRNAME
INTO CORRESPONDING FIELDS OF TABLE itab FROM
(( SPFLI INNER JOIN SFLIGHT ON SPFLI~CARRID = SFLIGHT~CARRID AND
SPFLI~CONNID = SFLIGHT~CONNID )
INNER JOIN SCARR ON SPFLI~CARRID = SCARR~CARRID )
WHERE SPFLI~CITYFROM = '<yourcityfrom>' AND
SPFLI~CITYTO = '<your_cityto> ' AND
SFLIGHT~FLDATE = '<your_fldate>'.Spoken generally, it' s not a too good idea to join to many tables at once.
Please reward if helpful,