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

how can i do selct without using into....

Former Member
0 Likes
1,801

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,768

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.

8 REPLIES 8
Read only

Former Member
0 Likes
1,768

Hi,

Check the below code.


Tables : MARA.

select single * from MARA where MATNR = '1234'.

Read only

Former Member
0 Likes
1,769

Hi,

You can skip the "Into......" line and define the DB table pa0014 in the begining of the program as

tables: pa0014.

Thanks

vivekanand

Read only

0 Likes
1,768

>

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

Read only

0 Likes
1,768

>

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

Read only

former_member203501
Active Contributor
0 Likes
1,768

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 .

Read only

h_senden2
Active Contributor
0 Likes
1,768

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

Read only

JozsefSzikszai
Active Contributor
0 Likes
1,768

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)

Read only

ThomasZloch
Active Contributor
0 Likes
1,768

Maybe you can use SELECT COUNT(*) FROM ... if you just want to know the number of rows matching the WHERE-condition.

Thomas