Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Please Help me

Former Member
0 Likes
809

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

8 REPLIES 8
Read only

Former Member
0 Likes
778

Hi Raja,

Plzzz let me know the actual requirment.

tables....

Thanks.

Read only

abdul_hakim
Active Contributor
0 Likes
778

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

Read only

Former Member
0 Likes
778

Using JOIN or For all entires you can achieve.

regrads

vijay

Read only

Lakshmant1
Active Contributor
0 Likes
778

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

Read only

Former Member
0 Likes
778

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.

Read only

Former Member
0 Likes
778

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.

Read only

Former Member
0 Likes
778
Read only

Former Member
0 Likes
778

Hell Raja,

Provide 5 tables names, we will try to give function module rather using tables.

Regards, Suresh