07-15-2005 4:35 PM
hi folks,
Here I have the following select statement which is posing a performance issue. I just need a single field record from this table
hence the query goes like this..
select name_org1 INto adname from
but000 where partner = adnumber.
endselect.
If I do not include endselect statement the query poses an error, and select .... endselect poses performance issue.
How can i improve this query without using the internal table. Because I have to create another internaltable just to get one field of data. Is there a better way of doing it?
Thanks
Santhosh
07-15-2005 4:37 PM
select single name_org1 INto adname from
but000 where partner = adnumber.
07-15-2005 4:43 PM
07-15-2005 4:46 PM
It is not working. I have delcared this select statement within a FORM ..... PERFORM statement and it is shwoing me an error Incorrect nesting.. you have to use end select statement.
santhosh
07-15-2005 4:47 PM
the adnumber is a partner number and while I use endselect the query works but when populating large amounts of data it is taking alot of time to execute.
leading to short dump.
santhosh
07-15-2005 4:49 PM
No you don't use ENDSELECT for a SELECT SINGLE. Post the code of the form.
example....
*---------------------------------------------------------------------*
* FORM test *
*---------------------------------------------------------------------*
form test.
data: adname(30) type c.
data: adnumber type kunnr.
select single name_org1 into adname
from but000
where partner = adnumber.
endform.
Regards,
Rich Heilman
Message was edited by: Rich Heilman
07-15-2005 4:50 PM
If you use SELECT SINGLE then NO NEED to give the ENDSELECT. You may be getting the error due to some other problem. Please let me know the exact error.
You can also use SELECT ..... UPTO 1 RECORD.
07-15-2005 4:50 PM
Now I took of that FORM... ENDFORM it is asking to end the select statement by endselect.
07-15-2005 4:53 PM
07-15-2005 4:54 PM
Here is the code... where I am using this slect statement
types: begin of boxdata,
inserent type zzjhtfp-inserent,
regulierer type jhaga-regulierer,
end of boxdata.
data: boxdataitab type standard table of boxdata WITH HEADER LINE,
adnumber type JHAGA-INSERENT,
agencynumber type JHAGA-REGULIERER,
adname type but000-name_org1,
agencyname type but000-name_org1,
bphone type kna1-telf1.
select single * from jhaga INTO corresponding fields of boxdataitab where jhaga~inserent = p_advnum.
adnumber = boxdataitab-inserent.
agencynumber = boxdataitab-regulierer.
write:boxdataitab-inserent.
select name_org1 INto adname from
but000 where partner = adnumber.
endselect.
select name_org1 INTO agencyname from but000
where partner = agencynumber.
endselect.
select telf1 into bphone from kna1 where kunnr = p_custid.
endselect.
07-15-2005 4:56 PM
Try this way.
select single * INTO corresponding fields of boxdataitab from jhaga where jhaga~inserent = p_advnum.
Vinod
07-15-2005 5:07 PM
hi Vinod,
I hope you did not get my point, the other queries are fine From the other query i am getting the 'adnumber' and 'agency number'That works fine.
using this data I have to pull the corresponding 'adname' and the 'agency name' from but000 table.
It is a single field data I need to pull using the separate query statements.
Santhosh
07-15-2005 5:12 PM
Thanks guys,
There was a probelm in some other area. I fixed it.
Able to figure it out.
Santhosh
07-15-2005 5:17 PM
Infact I was anwering your problem regarding the error 'Missing Endselect'.
Your SELECT statement is like this.
select single * from jhaga INTO corresponding fields of boxdataitab where jhaga~inserent = p_advnum.
adnumber = boxdataitab-inserent.
agencynumber = boxdataitab-regulierer.
And in this the variable boxdataitab is an internal table. Such cases you have to give INTO CORRESPONDING FIELDS OF TABLE boxdataitab.
I do not have access to system now. I think the syntax should be;
select single * INTO corresponding fields of boxdataitab from jhaga
where ....
Not
select single * from jhaga INTO corresponding fields of boxdataitab
where ....
07-15-2005 6:12 PM
07-15-2005 6:46 PM