2006 Dec 15 4:43 PM
hi,
i'm doing a select on a table and i want to avoid the endselect . is there anyway to code this in order to avoid the select...endselect.
your help will be appreciated.
Regards,
ravi.
SELECT number date time
INTO (v_number, v_date, v_time)
FROM ztable
UP TO 1 ROWS
WHERE zpro = sy-repid AND
werks IN r_plant
ORDER BY number descending.
ENDSELECT.
2006 Dec 15 4:49 PM
Try:
data: begin of itab occurs 0,
v_number like ztable-number,
v_date like ztable-date,
v_time like ztable-time,
end of itab.
SELECT number date time
INTO table itab
FROM ztable
UP TO 1 ROWS
WHERE zpro = sy-repid AND
werks IN r_plant
ORDER BY number descending.
Rob
That's because of the error in your original statment. If you put the data directly into the table or work area, you will avoid the problem.
rob
2006 Dec 15 4:46 PM
write as select single...
SELECT single number date time
INTO (v_number, v_date, v_time)
FROM ztable
WHERE zpro = sy-repid AND
werks IN r_plant
ORDER BY number descending.
up to 1 rows also is not a problem (select...endselect) as it will fetch only 1 record and it wont hit the database too much...
Message was edited by:
Ramesh Babu Chirumamilla
2006 Dec 19 4:58 AM
Fine ur answer...
But before we going to use Select Single we must be knw the filed/fields wch r in where condition is key field or not...if it is key field it is better suppose it is not key filed "Up to 1 rows" is only better thing...
anyhow for select single no need endselect.
for up to 1 rows alos we can avoid endselect by using TABLE key word..
2006 Dec 15 4:46 PM
What are the key fields in ZTABLE and why do you want to get rid of endselect?
2006 Dec 15 4:46 PM
hi,
SELECT single number date time
INTO (v_number, v_date, v_time)
FROM ztable
UP TO 1 ROWS
WHERE zpro = sy-repid AND
werks IN r_plant
ORDER BY number descending.
This should work.
Regards,
Vinod.
2006 Dec 15 4:49 PM
Try:
data: begin of itab occurs 0,
v_number like ztable-number,
v_date like ztable-date,
v_time like ztable-time,
end of itab.
SELECT number date time
INTO table itab
FROM ztable
UP TO 1 ROWS
WHERE zpro = sy-repid AND
werks IN r_plant
ORDER BY number descending.
Rob
2006 Dec 15 5:00 PM
Ramesh,
im getting incorrect spelling or comma error. even thing seems to be perfect but i dont understand why?
Regards,
ravi.
2006 Dec 15 5:09 PM
That's because of the error in your original statment. If you put the data directly into the table or work area, you will avoid the problem.
rob
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |