‎2005 Nov 30 8:38 AM
Hi all,
I have to used 5 different table in my report
create a internal table with 5 table
how to retrive data from table into internal table
Plz send sample logic
Reward point
advanced tahnks to your reply
Regards
Sek
‎2005 Nov 30 8:39 AM
Hi Raja,
Plzzz let me know the actual requirment.
tables....
Thanks.
‎2005 Nov 30 8:43 AM
Hi
There are lot of different ways to do this.
One way is u can use joins.
For instance..
SELECT a~num1
b~name1
c~name2
d~name3
e~name4
INTO TABLE itab5
FROM tab1 AS a INNER JOIN tab2 AS b
ON anum1 = bnum1
INNER JOIN tab3 AS c ON anum1 = cnum1
INNER JOIN tab4 AS d ON bnum1 = dnum1
INNER JOIN tab5 AS e ON cnum1 = enum1.
Abdul
‎2005 Nov 30 8:44 AM
Using JOIN or For all entires you can achieve.
regrads
vijay
‎2005 Nov 30 8:45 AM
Hi Raja,
Have a look at demo program DEMO_SELECT_INTO_TABLE,DEMO_SELECT_INNER_JOIN and DEMO_SELECT_LEFT_OUTER_JOIN
Thanks
Lakshman
Message was edited by: Lakshman Tandra
‎2005 Nov 30 8:49 AM
Hi Raja,
There are many ways to fill your internal table.
You can Use Joins, or For All Entries.
My suggestion is:
Declare one final internal table from all 5 tables.
Declare one temp internal tables for each table which you use.
Move all fields including Key fields to final internal table which you want from the first temp table.
Use Read statement to fill your final internal table from the remaining 4 tables using 'with Key = '.
Regards,
Sudhakar.
‎2005 Nov 30 8:51 AM
Hi Sekhar,
Please see the sample code for joining 3 tables.
You can extend it to 5 tables.
DATA: CARRID LIKE SFLIGHT-CARRID,
CONNID LIKE SFLIGHT-CONNID,
DATE LIKE SFLIGHT-FLDATE,
NAME LIKE SCARR-CARRNAME.
SELECT F~CARRID F~CONNID F~FLDATE C~CARRNAME
INTO (CARRID, CONNID, DATE, NAME)
FROM ( SFLIGHT AS F INNER JOIN SPFLI AS P
ON F~CARRID = P~CARRID AND
F~CONNID = P~CONNID )
INNER JOIN SCARR AS C
ON F~CARRID = C~CARRID
WHERE P~CITYFROM = 'FRANKFURT'
AND P~CITYTO = 'NEW YORK'
AND F~FLDATE BETWEEN '19970910' AND '19970920'
AND F~SEATSOCC < F~SEATSMAX.
WRITE: / NAME, DATE, CARRID, CONNID.
ENDSELECT.
Hope this is helpful to you.
Thanks & Regards,
Siri.
‎2005 Nov 30 8:57 AM
Hi Raja,
check the demo program
<b>demo_select_inner_join</b>
and also check these links....
http://help.sap.com/saphelp_erp2005/helpdata/en/cf/21ec77446011d189700000e8322d00/frameset.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/fc/eb39c4358411d1829f0000e829fbfe/frameset.htm
hope this helps you
regards,
venu.
‎2005 Nov 30 9:53 AM
Hell Raja,
Provide 5 tables names, we will try to give function module rather using tables.
Regards, Suresh