10-02-2008 8:14 AM
Retreiving field from EKKO, EKPO , EKET
Condition EKKO-IHREZ = "XXX" AND EKKO-BEDAT = "DATE"
select xxx from EKKO INTO i_EKKO. key EKKO-IHREZ = "XXX" AND EKKO-BEDAT = "DATE" Select xxx xxx from EKPO into i_EKPO for all entries in i_EKKO key EBELN Select xxx xxx xxx from EKET into i_EKEP for all entries in i_EKET KEY EBELN and EBELP
Please advise whether inner join can be done with 3 table
10-02-2008 8:52 AM
Hi..,
Consider Eric's suggestion..,
And ..,
Declare 3 internal tables,
1. To handle structure of EKKO and EKPO,
2. To handle EKET table structure
3. To handle final output table with all abov three structures.
Link EKKO and EKPO with inner joins and then link these two with EKET with for all entries method.
Now pass all into final internal table...
Hope its clear.
Thanks,
Naveen.I
10-02-2008 8:21 AM
hi,
yes, theoretically no problem. In actual case: EKKO-EKPO could be joined without any performance problems, to JOIN eket to the above two depends on how many lines are in EKET for one PO document. I think you have to test the performance (between join of all the three and join of EKKO-EKPO plus a separate select for EKET) and make decision...
hope this helps
ec
10-02-2008 8:23 AM
Hi, yes you can it would be something like
select ekko~ebeln ekpo~ebelp ekko~etenr into table gt_po
from ekko
inner join ekpo on ekpo~ebeln = ekko~ebeln
inner join eket on eket~ebeln = ekpo~ebeln
and eket~ebelp = ekpo~ebelp
where ekko~ebeln in s_ebeln.
Darren
10-02-2008 8:24 AM
hi,
Another alternative which you can try out is join ekko ,ekpo and select data from eket using for all entries of above.
10-02-2008 8:52 AM
Hi..,
Consider Eric's suggestion..,
And ..,
Declare 3 internal tables,
1. To handle structure of EKKO and EKPO,
2. To handle EKET table structure
3. To handle final output table with all abov three structures.
Link EKKO and EKPO with inner joins and then link these two with EKET with for all entries method.
Now pass all into final internal table...
Hope its clear.
Thanks,
Naveen.I
10-02-2008 9:21 AM
You mean
select ekko~ebeln ekpo~ebelp ekko~etenr into table i_itab1
from ekko
inner join ekpo on ekpo~ebeln = ekko~ebeln
Select xxx
from EKET into table i_itab2
for all entries i_itab1
key eket-ebeln = i_itab1-ebeln
and eket-ebelp = i_itab1-ebelp
Where do you have 3 internal table??? i have
1st internal table joining EKKO and EKPO
2nt internal table for all entries table1 and EKET
10-02-2008 9:31 AM
Hi..
So here your first table contains only contents of EKKO, EKPO and second table contains contents of EKET..
So there is no common table for these all...
Thats what i mentioned above decalre on final internal table if neccessary with all these three table fields...
and then pass itab1, itab2 to final internal table...like..
loop at itab1 into wa1. <---contents of EKKO,EKPO
waf-filed1 = wa1-filed1
read table itab2 into wa2 with key f1 = wa1-f1. <----Contents of EKET
if sy-subrc = 0.
waf-field2 = wa2-field2.
endif.
append waf to final internal tabel.
clear waf.
endloop.
There is no other better way in this case... to have all contents in one table..
Thanks,
Naveen.i
10-02-2008 11:27 AM