2013 Nov 26 6:04 AM
Hi ALL
I have got the following error when i am running code inspector,
"Large table SETNODE: No first field of a table index in WHERE Condition"
My code is like below:
SELECT setname FROM setnode INTO l_bu_name UP TO 1 ROWS
WHERE setname BETWEEN s_bunit-low and s_bunit-high AND subsetname = l_bu_name.
ENDSELECT.
Thanks in advance.
Regards,
praveen.
2013 Nov 26 6:08 AM
2013 Nov 26 6:08 AM
This is because your query is not using any Primary/Secondary index.
2013 Nov 26 6:08 AM
Hi Praveen
Code inspector does throw this error if we do not use key fields of the large table. I feel its ok because sometime your requirement is to fetch data based on non key field.
Nabheet
2013 Nov 26 7:08 AM
Hi Praveen,
Yes it is necessary at times to use the non key fields, so the message will be displayed in the code inspector. to hide the message use pragmas/ Pseudo comments in your code.
Regrads,
Umar Syed.
2013 Nov 26 8:53 AM
thanks everyone for ur reply..umar can u tell me in brief on how to hide the message,because i am new to abap.
regards,
praveen
2013 Nov 26 10:14 AM
Hi Praveen,
Add inline comment
"#EC CI_NOFIELD to the select statment. this should hide the message.
Regards,
Umar Syed.
2013 Nov 26 10:26 AM
It's rather brave of some of the replies above to suggest the best approach is to hide this message with a pseudo comment, based on so little context.
In the overall context of your program is it not possible to have either the Set Class or Org Unit available to you when you make the SELECT from SETNODE? This should be your first investigation.
Regards,
Nick
2013 Nov 27 6:14 AM
@ Nick
I understand your concern, but use of the key fields was alreaddy suggested in Farid Hasan's and Abhishek's reply
But in some cases it is needed at times to use the non key fields, in such cases code inspector will give you the error.
i know this is not the best approach , but the sugestion was to hide the message, only if it is unavoidable to use non key fields. but first try and use the key fields for selection if possible.
Also agree to the fact that i should have asked for the context of the requirement. Will do so next time.
Thanks and Regards,
Umar