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

Search records with Select statement

Former Member
0 Likes
772

Hi Experts

I am having three records in data base like

TESTPP001

TESTSS002

TESTPP003

If I will give “PP” in my input then I required output

TESTPP001

TESTPP003

If I will give “0” in my input then I required output

TESTPP001

TESTSS002

TESTPP003

Please send the solution with code

Urgent……..

Hi Experts

I am having three records in data base like

TESTPP001

TESTSS002

TESTPP003

If I will give “PP” in my input then I required output

TESTPP001

TESTPP003

If I will give “0” in my input then I required output

TESTPP001

TESTSS002

TESTPP003

Please send the solution with code

Urgent……..

6 REPLIES 6
Read only

Former Member
0 Likes
748

Hi

Have your WHERE condition of SELECT stmnt as

1. <b>WHERE field like '%PP%'</b>

2. <b>WHERE field like '%0%'.</b>

Regards

Raj

Read only

Former Member
0 Likes
748

u can use CS (contains string ) to compare in where clause.

select <fields>

from table

where field1 cs input.

Reward points if helpful

Read only

0 Likes
748

CAN YOU SEND ME ANY EXAMPLE

Read only

0 Likes
748

Hi,

use this code and check :

tables : ekko.

TYPES: BEGIN OF ts_test,

ernam type ekko-ernam,

END OF ts_test.

DATA: it_test TYPE TABLE OF ts_test.

DATA: ls_test TYPE ts_test.

SELECT ernam

FROM ekko

INTO corresponding fields of table it_test

WHERE ernam like '%SUD%'.

loop at it_test into ls_test.

write 😕 ls_test-ernam.

endloop.

Reward, if helpful,

Sandeep Kaushik

Read only

Former Member
0 Likes
748

Hi,

You can search with the Select statment using the % symbols,

WHERE FIELD like '%0%'.    " This wil search the recird for 0 with in the value

Regards

Sudheer

Read only

Former Member
0 Likes
748

Hi Gupta,

Mention like

This is for TESTPP001

TESTPP003

SELECT F1 F2 F3 FROM ZXXXX INTO ITAB

WHERE F1 LIKE '%PP%'.

This is for TESTPP001

TESTSS002

TESTPP003

SELECT F1 F2 F3 FROM ZXXXX INTO ITAB

WHERE F1 LIKE '%0%'.

Hope this helps you. Reply for queries, shall post the updates.

Regards.

Kumar.