06-02-2015 1:42 PM
Hi All,
In my code i have written a statement to select records from KNA1 database table.
SELECT kunnr name1 name2 ort01 pstlz stras stceg FROM kna1 INTO CORRESPONDING FIELDS OF TABLE lt_data
WHERE stceg <> ''.
I need to select all records which have a VAT number(STCEG).
I am not getting any syntax error, but when i check using code inspector i am getting 'error: Large table KNA1: No field of a table index in where condition'.
How to improve the above syntax to avoid this error?
Thanks in advance,
regards,
NarsiReddy.
06-02-2015 1:59 PM
Hi,
To Avoid this error you will have to pass Kunnr in the selection criteria.
Define a selection options may be . or else you can read the code inspector to find a Pseudocode to remove this error .
Hope this helps.
06-02-2015 1:55 PM
Narsi,
As you have already mentioned, the syntax of the select is correct. SAP is suggesting that the select would be of high cost since there is no index that matches your select criteria.
The easiest way is to create an index on the system with STCEG. Please use caution before you approach creation of index as it can potentially slowdown DB inserts.
If there is another way for you to fetch the list of customers and then filter based on STCEG, try following that else run a trace using ST05 and check the cost of the select.
If your requirement states that you have to run the query on KNA1 only using STCEG, then there is no harm creating the index by taking proper measures.
Thanks,
Vikram.M
06-02-2015 1:59 PM
Hi,
To Avoid this error you will have to pass Kunnr in the selection criteria.
Define a selection options may be . or else you can read the code inspector to find a Pseudocode to remove this error .
Hope this helps.
06-02-2015 2:13 PM
Gaurav Dubey wrote:
or else you can read the code inspector to find a Pseudocode to remove this error .
Gaurav,
Suppressing the error message via a pseudo code does not resolve the issue as such. It only takes out the message from SLIN/code inspector.
Thanks,
Vikram.M
06-02-2015 2:14 PM
If this is a one time only program, don't worry about it. Just run it in the background and wait.
Rob
06-02-2015 4:00 PM
HI NarsiReddy,
uh, what`s the number range of VAT number?
Say from 0001 to 9999, then you could use
SELECT kunnr name1 name2 ort01 pstlz stras stceg FROM kna1 INTO TABLE lt_data
WHERE stceg between '0001' and '9999'.
Regards,
Archer