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 with select single statement

Former Member
0 Likes
2,368

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...

11 REPLIES 11
Read only

Former Member
0 Likes
1,493

Hi,

Try using select single upto 1 row.

Thanks,

Vinod.

Read only

0 Likes
1,493

I am nt supposed to change the code..Just I am analysing the data..

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,493

If you do not give the full key list or a sort criterion there is no guarantee relative to the order of the records returned by a SELECT statement in Open SQL, neither for the choice of a record in a SELECT SINGLE.

Regards,

Raymond

Read only

0 Likes
1,493

Ya...

In that Select single statement, in where condition they dont have mentioned primary key ....

Read only

0 Likes
1,493

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

Read only

0 Likes
1,493

Select single should be use if you have full primary keys else use select up to one rows.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,493

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

Read only

Former Member
0 Likes
1,493

Hi Krishna,

Use select single if you get all the primary key in where cluse, otherwise use select upto 1 rows.

Regards,

Tutun

Read only

Former Member
0 Likes
1,493

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

Read only

Former Member
0 Likes
1,493

answered..

Read only

Former Member
0 Likes
1,493

hi krishna,

pass all the primary key fields in the select single statement....

thanks

Krishna Dussa