Application Development 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: 

Inner join to For all entries convert

Karan_Chopra_
Active Participant
0 Kudos

Plz tell me how to convert this code from <b>Inner join</b> to <b>For all entries</b>

<b>select afruaplzl afruarbid afruaufnr afruaufpl afru~budat

crhdarbpl crhdobjid crhdobjty crhdverwe

zvafvc_vuaplzl zvafvc_vuaufpl zvafvc_vu~ktsch

aufk~auart

into table int_hrs

from ( afru

inner join crhd

on

crhdobjid = afruarbid and

crhdwerks = afruwerks

inner join zvafvc_vu

on zvafvc_vuaufpl = afruaufpl and

zvafvc_vuaplzl = afruaplzl

inner join aufk

on aufkaufnr = afruaufnr

inner join afko

where

afru~werks in s_werks and

crhd~objty in s_objty and

crhd~verwe in s_verwe.</b>

7 REPLIES 7

Karan_Chopra_
Active Participant
0 Kudos

u can give code for two tables also if it is convinient

Former Member
0 Kudos

Why do you want to do this? Joins generally perform better than for all entries. See:

<a href="/people/rob.burbank/blog/2007/03/19/joins-vs-for-all-entries--which-performs-better">JOINS vs. FOR ALL ENTRIES - Which Performs Better?</a>

Rob

Karan_Chopra_
Active Participant
0 Kudos

plz help

Karan_Chopra_
Active Participant
0 Kudos

no i want to convert it to for all entries

Former Member
0 Kudos

Hi ,

select aplzl arbid aufnr aufpl budat from afru into itab afru~werks in s_werks.

select arbpl objid objty verwe from crhd for all entries of afru

where crhd-objid = afru-arbid

and crhd-werks = afru-werks.

same as pick from zvafvc_vu table for all entreis of afru.

Karan_Chopra_
Active Participant
0 Kudos

but how do i put it into final internal table as these are selected seperately to different internal table

Former Member
0 Kudos

loop at itab1.

move corresponding itab1 to itab_final.

read table itab2 with key field1 = itab1-field1.

if sy-subrc = 0.

move-corresponding itab2 to itab_final.

endif.

read table itab3 with key field1 = itab1-field1.

if sy-subrc = 0.

move-corresponding itab3 to itab_final.

endif.

append itab_final.

clear itab_final.

endloop.

Proceed this way with individual internal tables you got to get final internal table.

Regards

Vasu