‎2010 Apr 15 2:54 PM
Hi ,
I am debugging one z program..
Though Select Single statement is there, it is fetching 4 th record from standard data base table ..
can any one help me on this...
‎2010 Apr 15 2:58 PM
‎2010 Apr 15 3:03 PM
I am nt supposed to change the code..Just I am analysing the data..
‎2010 Apr 15 3:09 PM
‎2010 Apr 15 3:11 PM
Ya...
In that Select single statement, in where condition they dont have mentioned primary key ....
‎2010 Apr 15 3:13 PM
So
Open SQL/SQLJ does not allow to process the result set of a SELECT * in a single-row query. The reason is that Open SQL does not guarantee the order of the columns. It may be different at runtime and at design time.
Regards,
Raymond
Moderator message - next time, please note where you are quoting from (help.sap.com here)
Edited by: Rob Burbank on Apr 15, 2010 2:11 PM
‎2010 Apr 15 7:06 PM
Select single should be use if you have full primary keys else use select up to one rows.
‎2010 Apr 15 7:37 PM
To add to Raymond's explanation:
If SELECT SINGLE selects more than one line from the database, the first line that is found is entered into the resulting set
(source: [http://help.sap.com/abapdocu_70/en/ABAPSELECT_CLAUSE_LINES.htm])
And the first record found by the SELECT query might not be 4th record of the DB table. Also note that the table records you see in SE16 are sorted & at the actual DB level the order of records might be different.
BR,
Suhas
‎2010 Apr 16 6:16 AM
Hi Krishna,
Use select single if you get all the primary key in where cluse, otherwise use select upto 1 rows.
Regards,
Tutun
‎2010 Apr 16 7:26 AM
Hi
Use this SELECT FLD1 FLD2 ELD3 FLD4 FROM Tab INTO ITAB where <Condition> ,
might be because you are selecting lot of data , so hav to use Where condition . try it out , also chk the same fields are define in internal table , and chk the order also , u ll get
Regards
Sarath P G
‎2010 May 12 4:14 PM
‎2010 May 12 6:53 PM
hi krishna,
pass all the primary key fields in the select single statement....
thanks
Krishna Dussa