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: 

How to compare the mask field values?

Former Member
0 Kudos

Hi,

For my program I will get input no as 45XXXXXX234(like mask no)

and i need to compare this no in table(table also havinig the numbers same way 45XXXXXX234 with masking, I want to get this record by matching with input)

but when I am giving select statement using my input its not able to match the record in the table.

for masking field values how to compare the values?

thanks for ur time.

Kiran.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Why don't you replace all X by single '*' in the value and then pass this value while selecting data. this way it will look for that pattern -

For eg 45XXXXXX234 will become 45*234. And in SELECT it will look for this pattern in db table.

3 REPLIES 3

Former Member
0 Kudos

Why don't you replace all X by single '*' in the value and then pass this value while selecting data. this way it will look for that pattern -

For eg 45XXXXXX234 will become 45*234. And in SELECT it will look for this pattern in db table.

former_member181962
Active Contributor
0 Kudos

declare the parameter or select-option referring to the original table.

select-options: s_matnr for mara-matnr.

select *

from mara

into t_mara

where matnr in s_matnr.

in the selection screen if you give 45++++++234, then it would get you all the materials with same pattern.

or else you can use like % statement

Example to select all customers whose name begins with 'M':

DATA SCUSTOM_WA TYPE SCUSTOM.

SELECT ID NAME FROM SCUSTOM

INTO CORRESPONDING FIELDS OF SCUSTOM_WA

WHERE NAME LIKE 'M%'.

WRITE: / SCUSTOM_WA-ID, SCUSTOM_WA-NAME.

ENDSELECT.

Example to select all customers whose name contains 'huber':

DATA SCUSTOM_WA TYPE SCUSTOM.

SELECT ID NAME FROM SCUSTOM

INTO CORRESPONDING FIELDS OF SCUSTOM_WA

WHERE NAME LIKE '%huber%'.

WRITE: / SCUSTOM_WA-ID, SCUSTOM_WA-NAME.

ENDSELECT.

Example to select all customers whose name does not contain 'n' as the second character:

DATA SCUSTOM_WA TYPE SCUSTOM.

SELECT ID NAME FROM SCUSTOM

INTO CORRESPONDING FIELDS OF SCUSTOM_WA

WHERE NAME NOT LIKE '_n%'.

WRITE: / SCUSTOM_WA-ID, SCUSTOM_WA-NAME.

ENDSELECT.

Regards,

Ravi

0 Kudos

Hi Thanks

I got the answer.