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: 

filter on character fields

Former Member
0 Kudos

Hi all,

Is there any way to have filter on character fields to get the data even if the input is not given without padding zeroes before the data. for eg in ALV grid display if the data is having 7 characters but total field length is 10 chars then in filter we have give 3 zeroes leading to the data to get the filtered condition. is there any way to avoid this so that the users can give directly the data without leading zeroes.

7 REPLIES 7

Former Member
0 Kudos

Hi,

use the function module

<b>CONVERSION_EXIT_ALPHA_INPUT</b> converts any number into a string fill with zeroes, with the number at the extreme right

Example:

input = 123

output = 0000000000000...000000000000123

Hope it helps.

Reward if helpful.

Regards,

Sipra

Former Member
0 Kudos

l_var (fild which u declared)

use the function module

CONVERSION_EXIT_ALPHA_INPUT

in export pass l_val

in import get l_val.

ok

Regards,

Ramesh.

Former Member
0 Kudos

Another way is to use the data element for the particular field similar to VBELN. In that case you can enter the filter with or without zero's and it would be taken care off.

Regards

Anurag

Former Member
0 Kudos

Hi sathya,

in your itab declare the same field referring to Db table.

this will take care of the padding of zeros as alpha routine is applied on that filed.

so the user can proceed with the same by not giving the input padded with zeroes.

below code will give u an idea.

data : val1 like  vbak-vbeln value '0005002030'.
data : val(10) type c  value '0005002030'.

write:/ val.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input        = val
 IMPORTING
   OUTPUT        = val.

write:/ val.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input         = val1
 IMPORTING
   OUTPUT        = val1.


write:/ val1.

i agree with anurag ..

regards,

VIjay

0 Kudos

Hi,

I have declared the fields same as the database field only. But in the report only if we pad zeroes manually the filter is working. How can I apply the function module when the user clicks filter for all the character fields. I think it is impossible. but I wnat to avoid the users to enter zeroes before the input. please help

0 Kudos

It does not work like that as it is the property of the domain/data element which drives that ...If you follow my post..you need to define the field like VBELN to use the particular property of the domain.

Former Member
0 Kudos

Hi,

If you have declared the field inside an internal table, loop that internal table and pass the value to the FM CONVERSION_EXIT_ALPHA_INPUT,by which you will be able to filter for all the character fields.

Regards

Yamini.A