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

Select without into clause

Former Member
0 Likes
12,703

Hi gurus!

It is often necessary to know if some entry exists in the database table. There is an addition 'TRANSPORTING NO FIELDS' for read table statement. But I couldn't find something like it for the select statement. Maybe I should use another statement for my requirement?

Thanks in advance.

7 REPLIES 7
Read only

Former Member
0 Likes
4,972

tables : mara.

select single * from mara where .....

if sy-subrc = 0.

<record exist>

else.

<no>

endif.

regards

shiba dutta

Read only

0 Likes
4,972

> tables : mara.

> select single * from mara where .....

> if sy-subrc = 0.

> <record exist>

> else.

> <no>

> endif.

Thanks, but here you declare structure mara, i.e. you use this structure as container for the selection...

Read only

0 Likes
4,972

that is correct but that is table work area where it should take the value...i think no other options are there to check that.

regards

shiba dutta

Read only

0 Likes
4,972

Ok. Most likely you are right. But it is still a little bit strange for me why didn't SAP foresee such a request to the database...

p.s. Points were awarded.

Read only

h_senden2
Active Contributor
0 Likes
4,972

i dont think that there is a statement like that.

You can use a SELECT SINGLE or SELECT * UP TO 1 ROWS statement

regards,

Hans

Please reward all helpful answers !!!!!

Read only

Former Member
0 Likes
4,972

Hi Pavel,

Declare the table in the report using TABLES.

example.


TABLES: MARA.

SELECT MATNR FROM MARA WHERE MATNR IN S_MATNR.

for this you do not require any into clause......

Thanks and Regards,

Kunjal Patel

Read only

Former Member
0 Likes
4,972

You can use the table itself

REPORT YCHATEST1.

TABLES: MARA.
 
SELECT MATNR FROM MARA into mara-matnr WHERE MATNR IN S_MATNR.