‎2008 Mar 13 7:44 AM
how to join 3-4 tables with good performance with coding
reply me soon.......
‎2008 Mar 13 8:05 AM
hi
you can achieve it using internal tables. select 1st table and move it to internal table.
now use one more select with 'for all entries' in the internal table . make sure you dont write ur code with nested loop.
regards
Manoharan
‎2008 Mar 13 7:48 AM
You can do it in two ways:
1. Use inner joins to select the data from each of these tables together. But you need to be careful and sure about he joining conditions.
2. Select serially from one table and use for all entries in the next select statement.
This will also work.
- Guru
Reward points if useful
‎2008 Mar 13 7:48 AM
Joining 3 tables is not suggested by SAP.
First try to fetch all the Master entries into an Internal table.
Use a Join for the remaining 2 tables with a FOR ALL ENTRIES condition on the Master Internal table.
Don't forget to put sy-subrc checks, DELETE Duplicates..., SORT, READ, etc. before for all Entries.
Hope this helps
Regards
Vinayak
‎2008 Mar 13 7:50 AM
hi,
by apply inner join condition.
select irecdv icdiff iitime iidate ivlcod ipoint imdtxt imdocm mobjnr mswerk eeqktx tatinn e~equnr into CORRESPONDING FIELDS OF table it
from imrg as i
inner join imptt as t on ipoint = tpoint
inner join mcipmis as m on mobjnr = tmpobj
inner join eqkt as e on eequnr = mequnr
where m~swerk in swerk
and i~idate in idate
and t~atinn in ('0000000058' , '0000000151' , '0000000152')
and i~cancl <> 'X'.
use this type of condition in your program
reward point if helpful.
regards,
pankaj
‎2008 Mar 13 7:53 AM
Hi Ashwani,
Check this report....
*&---------------------------------------------------------------------*
*& Report ZCUSTOMER_DETAIL *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT ZCUSTOMER_DETAIL .
TABLES : KNA1, VBAK, VBAP, LIPS, VBRP, VBRK, KNKK.
PARAMETERS : KUNNR LIKE KNA1-KUNNR.
DATA : BEGIN OF IT OCCURS 0,
KUNNR LIKE KNA1-KUNNR,
NAME1 LIKE KNA1-NAME1,
FKDAT LIKE VBRK-FKDAT,
KLIMK LIKE KNKK-KLIMK,
KKBER LIKE KNKK-KKBER,
END OF IT.
SELECT SINGLE
KNA1~KUNNR
KNA1~NAME1
VBRK~FKDAT
KNKK~KLIMK
KNKK~KKBER
INTO IT FROM KNA1 INNER JOIN VBAK ON
KNA1~KUNNR = VBAK~KUNNR
INNER JOIN KNKK ON
KNA1~KUNNR = KNKK~KUNNR
INNER JOIN VBAP ON
VBAK~VBELN = VBAP~VBELN
INNER JOIN LIPS ON
VBAP~VBELN = LIPS~VGBEL
INNER JOIN VBRP ON
LIPS~VBELN = VBRP~VGBEL
INNER JOIN VBRK ON
VBRP~VBELN = VBRK~VBELN
WHERE KNA1~KUNNR = KUNNR.
APPEND IT.
LOOP AT IT.
WRITE :/ IT-KUNNR,
IT-NAME1,
IT-FKDAT,
IT-KLIMK,
IT-KKBER.
ENDLOOP.
Reward points if useful....
Regards
AK
‎2008 Mar 13 8:05 AM
hi
you can achieve it using internal tables. select 1st table and move it to internal table.
now use one more select with 'for all entries' in the internal table . make sure you dont write ur code with nested loop.
regards
Manoharan