‎2006 Mar 13 2:34 PM
How Do Everyone.
I have declared a Field symbol <compare_field> type c.
I have then assigned a char(10) input field to this
field symbol.
The problem I am now facing is I am trying to select
from the table KNA1 for the matching customer no.
i.e.
SELECT SINGLE *
FROM
kna1
WHERE
kunnr = <compare_field>.
e.g. Customer No held on KNA1 Table is '0002000001'
My <compare_field> doesn't contain leading zeroes, it
has '2000001' stored in it. As a consequence it is saying
that the customer does not exists in the above statement,
when it clearly does. But if through SE11 I enter 2000001
the customer appears.
Can anyone explain this to me.
Cheers
Andy
‎2006 Mar 13 2:37 PM
HI Andy,
Use the fm CONVERSION_EXIT_ALPHA_INPUT before you use that var in the select.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting input = <compare_field>
importing output = <compare_field>.
SELECT SINGLE *
FROM
kna1
WHERE
kunnr = <compare_field>.
‎2006 Mar 13 2:37 PM
Hi,
KUNNR is a CHAR length 10.
and ' 2000001' is different from '0002000001'.
so declare your field-symbols as type CHAR.
Rgd
Frédéric
‎2006 Mar 13 2:37 PM
HI Andy,
Use the fm CONVERSION_EXIT_ALPHA_INPUT before you use that var in the select.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting input = <compare_field>
importing output = <compare_field>.
SELECT SINGLE *
FROM
kna1
WHERE
kunnr = <compare_field>.
‎2006 Mar 13 2:38 PM
Hi andy,
1. Automatic conversion
2. The reason is the field which is ASSIGNED to field symbol
<b>is declared as type c,</b>
hence, automatic conversion
(ie. adding zeroes to the left when fetching from sql)
does not happen AUTOMATICALLY,
3. so that EXACT MATCH is not found.
4.<b> If the original field is declared
like KNA1-KUNNR,
THEN IT WILL WORK FANTASTIC.
</b>
*------- SEE THIS CODE - JUST COPY PASTE AND TRY
REPORT abc.
PARAMETERS : a LIKE kna1-kunnr.
*PARAMETERS : a(10) TYPE C. "<---- WON'T WORK
DATA : kna1 LIKE TABLE OF kna1 WITH HEADER LINE.
FIELD-SYMBOLS : <abc> LIKE kna1-kunnr.
ASSIGN a TO <abc>.
SELECT * FROM kna1
INTO TABLE
kna1 WHERE kunnr = <abc>.
BREAK-POINT.
regards,
amit m.
Message was edited by: Amit Mittal
‎2006 Mar 13 2:39 PM
‎2006 Mar 13 2:39 PM
Hi Andy,
Before going to select,pass the feld symbol value to the FM CONVERSION_EXIT_ALPHA_INPUT,which will add the leading zeros to the field value.
The reason why the table selects the values in SE11 if you enter without zeros is it has the conversion inbuilt.You can see that if you go to the DOMAIN of the KUNNR.If you see the definition of the domain,there exists a Conversion routine field which has value as ALPHA.If you double click you will know the FM used in the background when you check for the values in SE11.
Message was edited by: Phani Kiran Nudurupati
‎2006 Mar 13 2:39 PM
Hello,
you could use the function module 'CONVERSION_EXIT_ALPHA_INPUT'. Should solve your problem.
Regards Wolfgang
‎2006 Mar 13 3:13 PM
Thanks guys for you help, much appreciated.
I used the FM 'CONVERSION_EXIT_ALPHA_INPUT'
as suggested.