2008 Dec 10 1:24 PM
hi
i am writting a selection in order to know if there is a line in the table according to my conditions and i dont want to use into...
i am writting
select single *
from pa0014
into wa_pa0014 <--- i dont want to this line
where endda......
if sy-subrc eq o .
endif.
thanks.
2008 Dec 10 1:27 PM
Hi,
You can skip the "Into......" line and define the DB table pa0014 in the begining of the program as
tables: pa0014.
Thanks
vivekanand
hi
i am writting a selection in order to know if there is a line in the table according to my conditions and i dont want to use into...
i am writting
select single *
from pa0014
into wa_pa0014 <--- i dont want to this line
where endda......
if sy-subrc eq o .
endif.
thanks.
2008 Dec 10 1:27 PM
Hi,
Check the below code.
Tables : MARA.
select single * from MARA where MATNR = '1234'.
2008 Dec 10 1:27 PM
Hi,
You can skip the "Into......" line and define the DB table pa0014 in the begining of the program as
tables: pa0014.
Thanks
vivekanand
2008 Dec 11 7:46 AM
>
> You can skip the "Into......" line and define the DB table pa0014 in the begining of the program as
> tables: pa0014.
If anyone still follows: The TABLES statement is obsolate in "traditional" ABAP and prohibited in ABAP Objects (even if points were assigned....)
2008 Dec 11 8:01 AM
>
> If anyone still follows: The TABLES statement is obsolate in "traditional" ABAP and prohibited in ABAP Objects (even if points were assigned....)
In addition: what sense does it make to replace the into clause in that way? The only affect is that i cant see it, but its still there, the data is still transfered, not to the explicit given work area but to the implicit assigned work area.
2008 Dec 10 1:30 PM
hi you can use it ...if you want to get all the fields from the table ...the table name it self creates a work area .
2008 Dec 10 1:30 PM
This is only possible when you define
TABLES: PA0014.
But this is not allowed in ABAP OO.
In fact
SELECT * FROM PA0014 WHERE....
is the same as
SELECT * INTO PA0014 FROM PA0014 WHERE...
So it is a workarea, the same like your WA_PA0014.
What is the problem with the INTO WA_PA0014 part ? YOu don't have to use it.
regards,
Hans
2008 Dec 10 1:33 PM
if you really don't need that line, only want to know if it exists or not, than you should use SELECT COUNT( * )
SELECT COUNT( * )
FROM ...
WHERE ...
IF sy-subrc eq 0.
==> line exists
ELSE.
==> line does not exist
ENDIF.(additionally sy-dbcnt will tell how many such lines exist)
2008 Dec 10 1:34 PM
Maybe you can use SELECT COUNT(*) FROM ... if you just want to know the number of rows matching the WHERE-condition.
Thomas
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |