‎2008 Oct 21 10:56 AM
Hi ,
when using select query like
Select VDATU BDATU LIFNR NOTKZ from EORD into table IT_EORD
where MATNR = WA_FINAL-MATNR
And WERKS = WA_FINAL-WERKS.
is it is mandatory to keep all key fields in where condition.
IS above query is correct(performance wise).Because in EORD key fields are MATNR,
WERKS,ZEORD.
In which case it's mandatory to keep all key fields in where condition.
‎2008 Oct 21 11:03 AM
Hi,
The Select query is fine, it is not mandatory to include all the key fields in the where clause, it all depends on the requirements.
Yes, putting all the key fields in the where clause will definitely help to fetch data faster. Since system has to less check for data, it can directly go keeping all the key fields as search criteria.
Thanks & Regards,
Navneeth K.
‎2008 Oct 21 11:00 AM
Hi Boss,
TO improve the performance of the program in select querey the key fields are must and should in the where condition.
Best Regards,
Narasimha Rao.
‎2008 Oct 21 11:03 AM
Hi,
The Select query is fine, it is not mandatory to include all the key fields in the where clause, it all depends on the requirements.
Yes, putting all the key fields in the where clause will definitely help to fetch data faster. Since system has to less check for data, it can directly go keeping all the key fields as search criteria.
Thanks & Regards,
Navneeth K.
‎2008 Oct 21 11:04 AM
looks like the SELECT is in a LOOP (because of the wa_...), which is not a good technique, however you have to run SE30 first to analyse where are the performance issues in the program.
‎2008 Oct 21 11:07 AM
praveena you can yourself judge your program's performance,
SAP has provided SLIN check,code inspector etc..
one way i can tell you :open your program and in the menu :
Program -> Check -> Code Inspector
another way you can goto tcode SE30 for runtime analysis.
Also search for your querry on sdn forum, i think so many posts had already been on this topic.
Sid
‎2008 Oct 21 11:12 AM
Hi,
Whenever you are using the select statements it is advisory to use the key fields otherwise some performance issues will come sometime run time errors can also occurs .
Thanks,
Thiru. R
‎2008 Oct 21 11:16 AM
It is good to have key fields in the select queries where clause,but as we all know its not always possible due to various reasons, example we might want to find sales orders for a particular partner etc.
This is when indices come handy.
In your case, the query look good , but it seems that you are looping at some internal table into work area and then writing the select query. Avoid writing select queries in a loop, instead use FOR ALL ENTRIES or even better JOIN if you can join the tables.
example :
Select VDATU BDATU LIFNR NOTKZ from EORD into table IT_EORD
for all entries in it_final " assuming your internal table is it_final and you are using an internal table
where MATNR = it_FINAL-MATNR
And WERKS = it_FINAL-WERKS.
You just need to be sure that in this case the table it_final is not initial.
regards,
Advait.
‎2008 Oct 21 11:19 AM
Hi Praveena,
For better performance we try to use all the key fields in that table in where condition.
but it is not mandatory to use all.
regards
Kumar M.