Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem in select query

Former Member
0 Likes
1,520

hi all,

i have a collection table which contains huge data. there are 11 indexes already created. I am using a select query to fecth data from this table comparing some fields . there is a secondary index already available which contains 'MANDT' field along with two other fields.

In my select query i am using only 2 fields except MANDT.

but as i said there is huge data, this select query is not working ( not fetching the data ) but in normal senario we can get the data evenif we dont use mandt field.

also i tried the same query on database.but still its not fetching the records.

so wat could be the problem.

one more thing if i m using mandt field in select query i can get the required data.

so pls can anybody tell me wat the problem could be?

9 REPLIES 9
Read only

Former Member
0 Likes
1,123

Hi Manisha,

Either remove the MANDT from Index or use MANDT key also if it is working. The problem i think is because you have created index on MANDT field.

Regards,

Pankaj

Read only

Former Member
0 Likes
1,123

Hi Manisha,

  • fst check the database has any records and chk whethr if there are any records satisfying ur where condtion.

  • Make sure the sequence of declaration of fields in internal table should be same as sequence in selection statment.

  • no need to create any index for mandt as it is default primary key it has primary index

  • no need to pass mandt field into ur internal table.

Regards

Edited by: Rasheed salman on Dec 2, 2008 11:49 AM

Read only

0 Likes
1,123

hi rasheed,

1 )i have already told above that if i am using mandt field i am able to fetch the records that means

there are records of the given criteria .

3) if you are using non primary fields in selection you need to create a secondary index.

in secondary index we usually put those fields for which we can pass the values and make the database access more feasible. so evenif mandt is primary key its need to put mandt in secondary index along with other two fields.

Read only

Former Member
0 Likes
1,123

Hi,

Why are you not using MANDT in your SELECT Statement?

What is the SY-SUBRC value after your SELECT Statement?

Can you please share your SELECT Query.....

Read only

Former Member
0 Likes
1,123

Hi manisha...

i dont know whether it will work or not.. but why dont you try.. splitting the select into two.. ie.. having two selects on the same table......split the WHERE clause appropriately.. into two halves..and try APPENDING TABLE in the second SELECT query.....

Cheers

Read only

Former Member
0 Likes
1,123

Hi,

I don't think that its working if you are putting MANDT,it should even work if you don't put MANDT,what is actually happening is your other two fields are not working at all,so when you put mandt its working,it might be taking all the records for that mandt only not corresponding records of the other two fields,so what the reason could be:

check if there exist any COnversion Exits for the other two,i think before directly putting the other two fields in the where clause first you have to convert them using FM CONVERSION_EXIT_........._INPUT

Regards,

Neha

Read only

0 Likes
1,123

hi neha,

thanks for ur reply,

but just think if there is any need of the conversion then logically it should not fetch the records even if i am using mandt field. rite?

but i am getting records whenevr i am using the mandt field in where condition.

Read only

Former Member
0 Likes
1,123

In my select query i am using only 2 fields except MANDT.

This is not required , because internally the MANDT will be added to the query anyways.

Did you check the trace for the query in ST05 ?

regards,

Advait

Read only

Former Member
0 Likes
1,123

thank you all