user2969234
user2969234

Reputation: 11

How to make a search in SAP with multiple values

My question is how can I make a search in SAP like the search in MySQL.

For example:

select * from [table] where id in (1,2,3,4)

Upvotes: 0

Views: 3152

Answers (2)

Bryan Cain
Bryan Cain

Reputation: 1776

In addition to the other suggestions (for all entries, range table) you should be able to use the format specified in your question.

For example, the below works in my system.

data: t_t001w type STANDARD TABLE OF t001w.

select * 
  from t001w 
  into table t_t001w
 where werks in (1001, 1002).

Upvotes: 1

PATRY Guillaume
PATRY Guillaume

Reputation: 4337

there are several possibilities.

  • you can use the addtion to select statement 'for all entries in t' where t is an internal table. you can then use the internal table in the WHERE statement
SELECT carrid connid fldate     
  FROM sflight     
  INTO CORRESPONDING FIELDS OF TABLE result_tab   
   FOR ALL ENTRIES IN entry_tab   
 WHERE carrid = entry_tab-carrid   
   AND connid = entry_tab-connid.
  • you can also use a range table (as shown in this answer) and use it in your WHERE condition :
... WHERE field in range_table...

Upvotes: 2

Related Questions