‎2007 Jul 05 11:59 AM
Hi,
I want to have an effective select query with inner join for retrieving the fields
LIKP~LFDAT
VBRK~FKDAT
VBRP~FKIMG
VBEP~BMENG
with the common field VBELN that is there in all these tables...
If inner join is used four joins will come. Is it acceptable?
Thanks
Dinesh
‎2007 Jul 05 12:04 PM
Hi,
See using joins are acceptable becoz of the fast access than writing more than one query...So you can work with the same format...
Plz try to check with the se30 runtime analysis...Try the two form of the queries..you can see the difference
<b>TRY TO REWARD IF USEFUL</b>
‎2007 Jul 05 12:03 PM
hi,
here we have to have use inner join and that is acceotable.
Jogdand M B
‎2007 Jul 05 12:04 PM
Hi,
See using joins are acceptable becoz of the fast access than writing more than one query...So you can work with the same format...
Plz try to check with the se30 runtime analysis...Try the two form of the queries..you can see the difference
<b>TRY TO REWARD IF USEFUL</b>
‎2007 Jul 05 12:04 PM
Hi,
ANother option would be splitting it into two queries and then working on the Internal tables instead.
Check both approaches and see which ones performance is better.
Regards,
Sesh
‎2007 Jul 05 12:04 PM
Hi,
plz go through the following example------
----
TABLE DECLERATION
----
TABLES : MARA ,
MARC ,
MARD ,
MAKT.
----
DATA DECLERATION
----
TYPES : BEGIN OF STRUCT_MAT,
MATNR TYPE MATNR,
MEINS TYPE MEINS,
WERKS TYPE WERKS_D,
LGORT TYPE LGORT_D,
MAKTX TYPE MAKTX,
END OF STRUCT_MAT.
----
INTERNAL TABLE
----
DATA : ITAB TYPE STANDARD TABLE OF STRUCT_MAT WITH HEADER LINE.
----
SELECTION SCREEN
----
SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.
----
S T A R T - O F - S E L E C T I O N
----
START-OF-SELECTION.
SELECT
A~MATNR
A~MEINS
B~WERKS
C~LGORT
D~MAKTX
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM MARA AS A
INNER JOIN MARC AS B ON
AMATNR = BMATNR
LEFT OUTER JOIN MARD AS C ON
BMATNR = CMATNR AND
BWERKS = CWERKS
INNER JOIN MAKT AS D ON
AMATNR = DMATNR
WHERE A~MATNR IN S_MATNR .
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
----
W R I T E
----
WRITE :5 'MATERIAL NO' COLOR 3,
25 'PLANT' COLOR 3,
40 'STORAGE LOC' COLOR 3,
60 'DESCRIPTION' COLOR 3,
120 'UOM' COLOR 3.
ULINE.
LOOP AT ITAB.
WRITE :/5 ITAB-MATNR COLOR 6 INVERSE,
25 ITAB-WERKS COLOR 6,
40 ITAB-LGORT COLOR 6,
60 ITAB-MAKTX COLOR 6,
120 ITAB-MEINS COLOR 6.
ENDLOOP.
*****do rewards if usefull
vijay
‎2007 Jul 05 12:06 PM
Hi,
Use JOIN condition and check the performance. If it is good then continue otherwise comment some table and do some trial and error method.
then detach the tables with more time and delete the duplicate entries from the first table and move it to a temp table
the use for all entries
this will work faster
Regards
Shiva
‎2007 Jul 05 2:10 PM