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

Contains pattern in select

Hi All,

I have a requirment in select statement as below.

SELECT anln1

anln2

typbz

FROM anla

INTO TABLE it_anla

FOR ALL ENTRIES IN it_asset

WHERE typbz = it_asset-purch. "Contains pattern

IF sy-subrc EQ 0.

SORT it_anla BY typbz anln1 anln2.

ENDIF.

i need to select the ANLA table entries which contains the pattern IT_ASSET-purch which is not constant. like it_asset-purch* .

but its giving error if i write like this.

can any one suggest me good way of doing this.

Thanks.

replied

Hi - Best way is using a range table :

"Define Range table and Work area
data:  i_rng    TYPE RANGE OF typbz   INITIAL SIZE 0,    "table 
data:  wa_wng LIKE LINE OF  i_rng    " Work area

wa_rng-sign = 'E'.
wa_rng-option = 'CP'
wa_rmg-low = " Put concatenated value

" Now use this range table for you selection, as you use select-option, when selecting.

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