‎2006 Jul 14 8:48 AM
Hi,
select single *
from mara
where <b>matnr = wa-matnr</b>.
Here matnr is char18. Can we compare string like this?
When <b>wa-matnr</b> is in <b>lower case</b> it is setting sy-subrc = 4, even though the matnr exists in mara. When converted to upper case and used it is setting sy-subrc = 0.
Is there any other solution for the problem? I have checked out with matnr's conversion routine. It is also not working.
‎2006 Jul 14 8:51 AM
Hi ,
You can convert the string to upper case using the function module TERM_TRANSLATE_TO_UPPER_CASE, and then check for the value,
Hope this helps,
Rgds,
‎2006 Jul 14 8:52 AM
Hello,
First translate the WA-matnr to UPPER case using translate to uppercase and then use it in the select query.
If useful reward points.
Vasanth
‎2006 Jul 14 9:03 AM
just try dat way...
<b>ex...</b>
data:wa_matnr like mara-matnr.
data:wa_matnr1 like mara-matnr.
data: gv_matnr like mara-matnr.
wa_matnr = 'comptest'.
CALL FUNCTION 'TERM_TRANSLATE_TO_UPPER_CASE'
EXPORTING
LANGU = SY-LANGU
TEXT = wa_matnr
IMPORTING
TEXT_UC = wa_matnr1
EXCEPTIONS
NO_LOCALE_AVAILABLE = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
select single matnr
from mara into gv_matnr
where matnr = wa_matnr or matnr = wa_matnr1.
write : gv_matnr.
‎2006 Jul 14 9:07 AM
Hi mudhukeshwar,
1. If your field wa-matnr
a) is defined with LIKE MARA-MATNR.
b) is defined as parameter on selection-screen,
(so that the value comes from screen,
and not hardcoded into the program)
2. then automatically
a) uppercase
b) zero padding
will be taken care of , and u will get the record.
regards,
amit m.