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

Reg:LIKE operator

Former Member
0 Likes
451

Hi All,

Can i use the LIKE operator in Select query to compare the Same field that starts with different values i.e.

CONCATENATE c_5051 c_% INTO l_val1.

CONCATENATE c_5101 c_% INTO l_val2.

SELECT prctr

INTO l_prctr

FROM bseg UP TO 1 ROWS

WHERE matnr = l_matnr

AND belnr = l_belnr

AND ( hkont LIKE l_val1

OR hkont LIKE l_val2 ).

ENDSELECT.

but it is failing even though ther is an entry in BSEG table satisfying hte given condition.

Regards,

Padmasri.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
433

HI,

u can use like operator in select statement where condition.

may be it is failing because of some other selections. please make sure whether the record with the corresponding selections is available in database or not.

rgds,

bharat.

3 REPLIES 3
Read only

Former Member
0 Likes
434

HI,

u can use like operator in select statement where condition.

may be it is failing because of some other selections. please make sure whether the record with the corresponding selections is available in database or not.

rgds,

bharat.

Read only

Former Member
0 Likes
433

Insted of concatenating

CONCATENATE c_5051 c_% INTO l_val1.

CONCATENATE c_5101 c_% INTO l_val2

Data: c_vla1 type char5 value '5051%',

c_val2 type char5 value '5101%'.

avoid the select endselect .

Read only

Former Member
0 Likes
433

Hi,

You can use Like operator with select queries.

You should first check if there are any matching records.

regards

rishika