Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to search records in a standard table with * ?

Hi everyone,

Can anyone tell me how to search records in a standard table with * ?

That is, in screen if user type * abc * for searching the records in which the field MC_STEXT contains 'abc'. What the code should be? How to complete the code below?

SELECT SINGLE objid FROM p1000 INTO p1000-objid,

WHERE MC_STEXT = ? .

Thanks!

Tags:
replied

Hi

There are several way to do that, probably just as some guys wrote the easier way is to use LIKE in WHERE condition and the sign % instead of *:

V_STRING = '%ABC%'.

SELECT SINGLE objid FROM p1000 INTO p1000-objid,

WHERE MC_STEXT LIKE V_STRING.

U can also use a range (just like select-options):

RANGES: R_MC FOR P1000-MC_STEXT.

R_MC-LOW = 'ABC'.

R_MC(3) = 'ICP'.

APPEND R_MC.

SELECT SINGLE objid FROM p1000 INTO p1000-objid,

WHERE MC_STEXT IN R_MC.

Max

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question