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

problem in select statement

Former Member
0 Likes
614

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
Read only

former_member632991
Active Contributor
0 Likes
580

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
Read only

former_member632991
Active Contributor
0 Likes
581

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

Read only

0 Likes
580

use -

Select field1 from dbtab into corresponding fields of itab

where field2 like 'POL%'.

AMIT

Amit Tyagi

Read only

Former Member
0 Likes
580

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

Read only

Former Member
0 Likes
580

HI,

You need to write the select statment like this way

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

Regards

Sudheer

Read only

Former Member
0 Likes
580

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