cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

I would like to use a SQL stmts like this:

SELECT * FROM tab WHERE key1 LIKE '%<i>variable</i>%'.

Using LIKE in the WHERE clause requieres a character field. But I want to use a vairable...

how should i write that?

thx,

holger

0 Likes
View Entire Topic
Former Member
0 Likes

hi,

Check out this sample code.

concatenate sy-cprog '%' into <b>w_bdcerr</b>.

SELECT * FROM APQI UP TO 1 ROWS

WHERE GROUPID LIKE <b>W_BDCERR</b> AND

QSTATE NE 'F'.

ENDSELECT.

You concatenate the variable and % into a string and use that in select. This meets your requirement.

Regards,

Sailaja.