Application Development 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: 

problem in select statement

Former Member
0 Kudos

hi,

i have a small problem in select statement.

i need to select some data based on some inputs and the condition is i need all the records where one field say field1(string type) conatins anything which starts with POL .

select aufnr into it_data from aufk where ktext STARTS WITH 'POL'.

but this is not working can anyone suggest me the right method.

urgent plz.

1 ACCEPTED SOLUTION

former_member632991
Active Contributor
0 Kudos

Hi,

use

select aufnr into it_data from aufk where ktext like 'POL%'.

Regards,

Sonika

Message was edited by: Sonika Ahuja

sorry use like instead of =

Sonika Ahuja

5 REPLIES 5

former_member632991
Active Contributor
0 Kudos

Hi,

use

select aufnr into it_data from aufk where ktext like 'POL%'.

Regards,

Sonika

Message was edited by: Sonika Ahuja

sorry use like instead of =

Sonika Ahuja

0 Kudos

use -

Select field1 from dbtab into corresponding fields of itab

where field2 like 'POL%'.

AMIT

Amit Tyagi

Former Member
0 Kudos

HI,

Refer sample code:

data: ws_ZSUBSEG type ZSEG,

wa_KONTOKLASSET type KONTOKLASSET,

ws_KTOKL type KTOKLASSE.

data: iZSEG type table of KONTOKLASSET with header line.

ranges: r_ZSEG for iZSEG-KTOTX.

r_ZSEG-sign = 'I'.

r_ZSEG-option = 'CP'.

concatenate '' <b>POL</b> '' into r_ZSEG-low.

condense r_ZSEG-low.

append r_ZSEG.

clear ws_KTOKL.

select single KTOKL

into ws_KTOKL

from KONTOKLASSET

where KTOTX in r_ZSEG

and spras = sy-langu.

if sy-subrc eq 0.

$S$ = ws_KTOKL.

endif.

endif.

Reward points if this Helps.

Manish

Former Member
0 Kudos

HI,

You need to write the select statment like this way

select aufnr into it_data from aufk where ktext EQ 'POL%'

Regards

Sudheer

Former Member
0 Kudos

Hi Ravi ,

Try doing this

Data : v_string type string.

v_string = 'POL%'.

select aufnr into it_data from aufk where ktext LIKE V_STRING.

Regards

Arun