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

comparing strings while executing a select statement

Former Member
0 Likes
3,040

hi,

i need to compare select the rows from table dd02t into the internal table li_tabdef where dd02-ddtext contains the string s_string(taken as a parameter)

i can't write the where clause as

*where dd02t-ddlanguage CS s_string* since CS is not a valid comparison operator. i need to compare the value of sy-fdpos.

can you please help me with the select statement

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,564

Define a field of the same type as the database field. CONCATENATE '%' parameter string and '%' into this field and use a database-field LIKE work-field in the SELECT statement.

Regards

5 REPLIES 5
Read only

Former Member
0 Likes
1,564

HI,

You have use like 'ABC%' in where condition, like will work for wild card search not CS. If you want to search for a string which starts with ABC.

Thanks,

Sri,

Edited by: Sriram Ponna on Jan 18, 2008 7:25 PM

Read only

0 Likes
1,564

the string is entered by the user. it is stored as a parameter s_string.

i need to use s_string for comparison.

Read only

0 Likes
1,564

refer this

data : begin of itab occurs 0,

pernr like pa0001-pernr,

end of itab.

data : a type string.

a = '123'.

concatenate '%' a '%' into a.

select pernr from pa0001 into table itab where pernr like a and begda le sy-datum and endda ge sy-datum.

if sy-subrc = 0.

sort itab by pernr.

loop at itab.

write 😕 itab-pernr.

endloop.

endif.

now u get all pernrs containing 123......

Read only

Former Member
0 Likes
1,564

Hello,

Use like.

COncatenate S_STRING '%' INTO S_STRING.

where dd02t-ddlanguage LIKEs_string

Vasanth

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,565

Define a field of the same type as the database field. CONCATENATE '%' parameter string and '%' into this field and use a database-field LIKE work-field in the SELECT statement.

Regards