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

Slection condition with Like

mrahhaoui
Participant
0 Likes
925

Hi Gurus,

I try to extrat from the table CSKS the cost element (KSTAR) only those starting by 8. I have written this code but I always receive a sy-subrc = 0.

PARAMETERS srch_str TYPE cska-kstar.

TYPES: BEGIN OF ty_cska,
        kstar TYPE cska-kstar,
       END OF ty_cska.

data:
      i_cska  TYPE STANDARD TABLE OF ty_cska.

CONCATENATE '8'  '%' INTO srch_str.


select kstar from cska
             into table i_cska
             where kstar like srch_str.

Anybode has an idea?

Thanx in advance for your help.

Regards,

Mohamed.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
891

select x y from table name where x LIKE '%RV,DZ,F2%' .

Hi Gurus,

I try to extrat from the table CSKS the cost element (KSTAR) only those starting by 8. I have written this code but I always receive a sy-subrc = 0.

PARAMETERS srch_str TYPE cska-kstar.

TYPES: BEGIN OF ty_cska,
        kstar TYPE cska-kstar,
       END OF ty_cska.

data:
      i_cska  TYPE STANDARD TABLE OF ty_cska.

CONCATENATE '8'  '%' INTO srch_str.


select kstar from cska
             into table i_cska
             where kstar like srch_str.

Anybode has an idea?

Thanx in advance for your help.

Regards,

Mohamed.

6 REPLIES 6
Read only

Former Member
0 Likes
892

select x y from table name where x LIKE '%RV,DZ,F2%' .

Read only

0 Likes
891

the records are stored like this : 0088993939, 004448488, 0073733888, 00639999, 008373733

I would need only the 0088993939 and 008373733.

The problem is with my code it took me all records which contain 8.

Read only

0 Likes
891

Hello

Try direct condition:


select kstar from cska
             into table i_cska
             where kstar like '008%'.

Read only

0 Likes
891

Thx for your quick response but sometimes it could happen some records like 0803373 0008777373 and I also need those.

Read only

0 Likes
891

check if this works for you ,

where kstar like '% 08, 008,0008,00008%'

Read only

Former Member
0 Likes
891

maybe should think by yourself (hint: write several conditions and connect them with 'OR')