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

Test if line exist in table

Former Member
0 Likes
3,088

How can i test if a line exists in a table?

Greets Volker

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,093

Hi,

if you know all the primary field values of that table then go for

select single from table XXXX where "Conditions".

else if you know some fields (not all primary keys) go for

select upto 1 rows from table XXXX where "Conditions".

if the select statement selects the record, that is the confirmation.

Reward if useful.

Thanks,

Sreeram.

Hi,

if you know all the primary field values of that table then go for

select single from table XXXX where "Conditions".

else if you know some fields (not all primary keys) go for

select upto 1 rows from table XXXX where "Conditions".

if the select statement selects the record, that is the confirmation.

Reward if useful.

Thanks,

Sreeram.

4 REPLIES 4
Read only

Former Member
0 Likes
2,093

hi Volker,

You can use Select single form database table with the where clause.

Eg : Select single form <DATABASETABLE> into <WORKAREA>

where <CONDITION>.

Regards

Sourabh Verma

Read only

JozsefSzikszai
Active Contributor
0 Likes
2,093

hi Volker,

if you don't need the line, only the information if it is there, you can use:

SELECT COUNT( * ) FROM ... WHERE ...

IF sy-subrc EQ 0.

==> exists

ELSE.

==> does not exist

ENDIF.

the value in sy-dbcnt will show how many records were found.

hope this helps

ec

Read only

Former Member
0 Likes
2,094

Hi,

if you know all the primary field values of that table then go for

select single from table XXXX where "Conditions".

else if you know some fields (not all primary keys) go for

select upto 1 rows from table XXXX where "Conditions".

if the select statement selects the record, that is the confirmation.

Reward if useful.

Thanks,

Sreeram.

Read only

Former Member
0 Likes
2,093

Database table or internal table?

Rob