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

Where condition on text fields

Former Member
0 Likes
655

Hi Experts,

I'm trying to select materials based on description on where condition using contains pattern as a range, though there are materials, none of are found, Can you advise me what am I doing wrong please?

st_matnr-sign = 'I'.

st_matnr-option = 'EQ'.

st_matnr-low = w_matnr_low.

st_matnr-high = w_matnr_high.

APPEND st_matnr TO t_matnr.

st_maktg-sign = 'I'.

st_maktg-option = 'CP'.

st_maktg-low = p_desc.

APPEND st_maktg TO t_maktg.

SELECT a~mandt

a~matnr

a~spras

a~maktx

a~maktg

FROM makt as a

INNER JOIN mara as b

on amatnr = bmatnr

INTO TABLE t_alv_makt

WHERE a~matnr IN t_matnr

AND a~maktg IN t_maktg

AND b~mtart = 'ZIZS'.

Thanks,

GP.

6 REPLIES 6
Read only

former_member186741
Active Contributor
0 Likes
620

TRY:

st_matnr-option = 'BT'.

ALSO, what is in p_desc. The CP needs '*' or similar to work properly.

Read only

0 Likes
620

Hi Neil,

Thanks for your reply, I've added 'BT' still no entries found in the table, yes I'm keying in with material in the description.

Please advise...

Read only

0 Likes
620

if your material is in lower case it will not work...try MATERIAL.

Read only

0 Likes
620

Hi Neil,

I'm refering to the data element maktg which is for uppercase for search help in MAKT table, it automatically is converting the description into upper case regardless how it was entered, without having to translate w_desc to uppercase. Still doesn't return values.

Please advise.

Thanks...

GP.

Read only

0 Likes
620

It will convert it if it's being entered uinto a screen field referring to that but if it's copie from another variable it won't convert.

try a process of elimination. take out the where clause components until you get some data and then you will have something to focus on. i.e. the culprit will be revealed even if you don't know why he's guilty.

It's also possible that the matnr field has a conversion exit attached and you need to take that into account when populating your variable. eg to remove or add in leading zeroes.

Read only

Former Member
0 Likes
620

gibve like this and try...

st_matnr-sign = 'I'.

st_matnr-option = 'EQ'.

st_matnr-low = w_matnr_low.

APPEND st_matnr TO t_matnr.

st_matnr-sign = 'I'.

st_matnr-option = 'EQ'.

st_matnr-high = w_matnr_high.

APPEND st_matnr TO t_matnr.