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

sample coding for multiple table join

Former Member
0 Likes
771

Hi,

i need a sample coding for multiple table join. can anyone help me out.

regards

Gokul

8 REPLIES 8
Read only

Former Member
0 Likes
730

What results r u after?????????????????????????????????????????????

ARE WE MIND READERS.

Read only

Former Member
0 Likes
730

See demo programs:

DEMO_SELECT_INNER_JOIN

and DEMO_SELECT_LEFT_OUTER_JOIN

Read only

Former Member
0 Likes
730

Hi,

check this.

SELECT FCARRID FCONNID F~FLDATE

INTO (CARRID, CONNID, DATE)

FROM SFLIGHT AS F INNER JOIN SPFLI AS P

ON FCARRID = PCARRID AND

FCONNID = PCONNID

WHERE P~CITYFROM = 'FRANKFURT'

AND P~CITYTO = 'NEW YORK'

AND F~FLDATE BETWEEN '20010910' AND '20010920'

AND FSEATSOCC < FSEATSMAX.

WRITE: / DATE, CARRID, CONNID.

ENDSELECT.

check this link

http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_InnerJoinStatement.asp

Regards,

Sruthi

Read only

Former Member
0 Likes
730

hi gokul,,

I am getting output for your program ,

check the tables if they have data in them ,

i am getting lots of records with your program

Read only

Former Member
0 Likes
730

Hi,

See the sample code:

select

a~aufnr " Order Number

a~kappl " Application

a~zschl " Overhead Key

b~knumh " Cond.Record Number

c~kbetr " Overhead Rate

into table it_head

from aufk as a join a014 as b

on akappl = bkappl and

azschl = bzschl

join konp as c

on bknumh = cknumh

for all entries in it_header

where a~aufnr = it_header-aufnr and

b~kappl = 'KA' and

b~kschl = 'C110' and

b~kokrs = 'GSI1' and

b~aufza = '1' .

Regards,

Anji

Read only

Former Member
0 Likes
730

Hi Gokul,

FIrst of all please be sure if you want to read all the data from the table, as there is no where condition in the select statements.

The use of MODIFY ITAB FROM WA in the last loop statement has no use at all.

Please remove unwanted code from the existing code and try to run the code. If you have huge data in the database then your program will run on and on....

Regards,

George

Read only

Former Member
0 Likes
730

SELECT AVBELN AFKDAT AVTWEG ASPART AWAERK AKURRF AKUNAG AKNUMV

BPOSNR BFKIMG BNETWR BMATNR

DBEGRU ELABOR E~MATKL

INTO CORRESPONDING FIELDS OF TABLE ITAB

FROM VBRK AS A INNER JOIN VBRP AS B

ON AVBELN EQ BVBELN

INNER JOIN J_1IEXCHDR AS C

ON AVBELN EQ CRDOC

INNER JOIN KNVV AS D

ON DKUNNR EQ AKUNAG AND

DVKORG EQ AVKORG AND

DSPART EQ ASPART AND

D~BEGRU NE SPACE

INNER JOIN MARA AS E

ON EMATNR EQ BMATNR

WHERE A~FKDAT IN S_FKDAT AND

A~FKART EQ 'F2' AND

A~VTWEG IN S_VTWEG AND

A~SPART IN S_SPART AND

A~KUNAG IN S_KUNAG AND

A~FKSTO NE 'X' AND

B~WERKS IN S_WERKS AND

C~TRNTYP = 'DLFC' AND

E~LABOR IN S_LABOR AND

  • C~SRGRP IN ('01','02','03','31','32','33','41','42','43',

  • '81','82','83','95','55','45', '48') AND

B~MATNR IN S_MATNR AND

D~BEGRU IN S_BEGRU AND

E~MATKL IN S_MATKL.

but my suggestion not to use more than 2 table in inner join it will affect in performance use for all entries instead of join.

regards

shiba dutta

Read only

Former Member
0 Likes
730