cancel
Showing results for 
Search instead for 
Did you mean: 

shall i use inner joint for my code?

Former Member
0 Kudos

Hi,

i written the below select statements.Can i wrote one inner joint for this below statements.

please help me regarding this

SELECT objid arbpl FROM crhd

INTO TABLE gt_chrd

WHERE arbpl in so_mdv01

AND werks in so_werks.

IF NOT gt_chrd[] IS INITIAL.

SELECT objnr ppsid FROM iflo

INTO TABLE gt_iflo

FOR ALL ENTRIES IN gt_chrd

WHERE ppsid = gt_chrd-objid.

ENDIF.

IF NOT gt_iflo[] IS INITIAL.

SELECT mpobj point FROM imptt

INTO TABLE gt_imptt

FOR ALL ENTRIES IN gt_iflo

WHERE mpobj = gt_iflo-objnr

and mptyp = 'P'.

ENDIF.

Accepted Solutions (1)

Accepted Solutions (1)

former_member217544
Active Contributor
0 Kudos

Hi,

Yes, you can use Joins.

Try something like this: (I didnt check for any syntax errors)

SELECT cobjid carbpl

I~objnr

m~point

INTO CORRESPONDING FIELDS OF TABLE ITAB1

FROM imptt as m

INNER JOIN

iflo as i

ON mmpobj = iobjnr

AND m~mptyp = 'P'

INNER JOIN

crhd as c

ON ippsid = cobjid

WHERE c~arbpl in so_mdv01

AND c~werks in so_werks.

Regards,

Swarna Munukoti

Answers (4)

Answers (4)

ThomasZloch
Active Contributor
0 Kudos

You can use joints, but don't let your boss find out

Thomas

kesavadas_thekkillath
Active Contributor
0 Kudos

Wow ... Thats Cool ))))

Former Member
0 Kudos

First do runtime analysis of existing code and also check the index used by ST05.

After this make a join between the tables ( between 2 or 3 tables) and then again do runtime analysis and check index.

You can then compare the results.

Also, you can check the where use list of these tables to find any view with these database tables.

If you get one , check the result for view also.

Hope it helps you.

Former Member
0 Kudos

HI,

Use can use join.

Take an internal table with required fields and join.

Check the below SQL.

SELECT c~objid c~arbpl 
I~objnr 
m~mpobj
m~point 
INTO TABLE  IT_join
FROM crhd as c join
imptt as m
ON  c~mandt = i~mandt and 
c~ppsid = i~objid
JOIN
iflo as i
ON i~mandt = m~mandt
i~mpobj = m~objnr
WHERE c~arbpl in so_mdv01
AND c~werks in so_werks
AND m~mptyp = 'P'.

kesavadas_thekkillath
Active Contributor
0 Kudos

Hi,

You can test it of your own .

write two sample programs ans do sql trace in ST05.

Steps for ST05 are available in SCN,please search.