2007 Jun 04 8:03 AM
Hello everyone,
I am trying to fetch data from LIKP and LIPS using INNER JOIN. The following are my selection criteria :
1. Shipping point/receiving point - LIKP-VSTEL (Mandatory)
2. Delivery Date - LIKP-LFDAT (Mandatory)
3. Receiving plant for deliveries - LIKP-KUNNR (Optional)
4. Ship-to party - LIKP-KUNNR (Optional)
5. Delivery Doc. No. - LIKP-VBELN (Optional)
The query I have written is as below :
SELECT PVBELN PVSTEL PLFDAT PKUNNR PLIFNR PBLDAT
P~WADAT_IST
FVGBEL FPOSNR FMATNR FLGORT FCHARG FLFIMG
FMEINS FVRKME FBRGEW FGEWEI FLGMNG FARKTX
FSPART FWERKS F~LFIMG
FROM LIKP AS P
INNER JOIN LIPS AS F
ON PVBELN EQ FVBELN
AND PERNAM EQ FERNAM
INTO CORRESPONDING FIELDS OF TABLE I_LIKP_LIPS
WHERE P~LFDAT IN S_DATE
AND P~VSTEL EQ S_VSTEL
AND P~VBELN IN S_DOCNO
AND P~KUNNR IN S_RWERKS
AND P~KUNNR IN S_CUSTNO
AND P~WADAT_IST EQ GIDATE
AND F~LFIMG NE 0.
Now the above query is taking a lot of time because the user does not feeds the primary key data i.e. VBELN as it is not suppose to be mandatory as per our requirement. There is also a secondary index on LFDAT but still the data access is slow.
Can anybody suggest me how to enhance this query performance.
THANX IN ADVANCE.......
Hello everyone,
I am trying to fetch data from LIKP and LIPS using INNER JOIN. The following are my selection criteria :
1. Shipping point/receiving point - LIKP-VSTEL (Mandatory)
2. Delivery Date - LIKP-LFDAT (Mandatory)
3. Receiving plant for deliveries - LIKP-KUNNR (Optional)
4. Ship-to party - LIKP-KUNNR (Optional)
5. Delivery Doc. No. - LIKP-VBELN (Optional)
The query I have written is as below :
SELECT PVBELN PVSTEL PLFDAT PKUNNR PLIFNR PBLDAT
P~WADAT_IST
FVGBEL FPOSNR FMATNR FLGORT FCHARG FLFIMG
FMEINS FVRKME FBRGEW FGEWEI FLGMNG FARKTX
FSPART FWERKS F~LFIMG
FROM LIKP AS P
INNER JOIN LIPS AS F
ON PVBELN EQ FVBELN
AND PERNAM EQ FERNAM
INTO CORRESPONDING FIELDS OF TABLE I_LIKP_LIPS
WHERE P~LFDAT IN S_DATE
AND P~VSTEL EQ S_VSTEL
AND P~VBELN IN S_DOCNO
AND P~KUNNR IN S_RWERKS
AND P~KUNNR IN S_CUSTNO
AND P~WADAT_IST EQ GIDATE
AND F~LFIMG NE 0.
Now the above query is taking a lot of time because the user does not feeds the primary key data i.e. VBELN as it is not suppose to be mandatory as per our requirement. There is also a secondary index on LFDAT but still the data access is slow.
Can anybody suggest me how to enhance this query performance.
THANX IN ADVANCE.......
2007 Jun 04 8:08 AM
HI,
you can create a view consisting of those tables and in that specify the joining conditions and then write the remaining conditions in select querry
Regards,
Naveen
2007 Jun 04 8:09 AM
Also if any FM for finding Delivery data using vstel and lfdat is there please suggest.
2007 Jun 04 8:10 AM
Hi
Change the sequence of the fields in the Where condition as
check once that this statement P~KUNNR IN S_RWERKS it may be
P~WERKS in S_RWERKS .
<b>
WHERE P~VBELN IN S_DOCNO
AND P~VSTEL EQ S_VSTEL
AND P~WADAT_IST EQ GIDATE
AND P~LFDAT IN S_DATE
AND P~KUNNR IN S_CUSTNO
AND P~WERKS IN S_RWERKS
AND AND F~LFIMG NE 0.</b>
Reward points if useful
Regards
Anji
2007 Jun 04 8:12 AM
HI,
First of all I suggest you to use for all entries..
Say your VBELN is not mandatory, It does not mean you neeed not use this,,
This selection criteria is for the user..
If he need only particular VBELN he gives the Vblen numbers,..
else if he leaves blank then all the VBLEN from database will be as output..
First check whether you are fetching data from LIKP in sequence..
see the LIKP table for seqeunce..
Then use for all entries for LIPS..
Eg:
select VBELN VSTEL ..... (this field should be in sequence as in LIKP table)
into it_likp (define all your fields in it_likp table which you are fetching from LIKP)
from LIKP
where vbeln = s_vbeln and VSTEL = s_VSTEL...
Now
SELECT VBLEN POSNR WGBEL...
into table it_LIPS (define your LIPS fileds in this table)
from lips
for all entries in it_LIKP
where vbeln = it_likp-vbeln.
This will increase your performance
rewards if useful..
regards,
nazeer
2007 Jun 04 8:14 AM
Hi,
Make us of Logical Database, it gives u the option of dynamic selection screen and the join conditions will be automatically taken care of. Your program code also reduces.
Regards,
Pramod
2007 Jun 14 6:18 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |