12-22-2006 4:54 AM
HI All.
Actually i done Validation for MATNR ,Message Displays if i enter Invaild material no.
Message Example: This Material no 24000 Does not exist in MARA.
I removed leading zeros of Material no,Now i Want remove Leading SPACE also.like
"This Material no 24000 Does not exist in MARA" ,
How can remove extra leading space of material no.
Help me.
Regards,
Jay
12-22-2006 7:35 AM
use fm 'conversion_exit_alpha_output'
data: lv_matnr type matnr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = itab-matnr
IMPORTING
OUTPUT = lv_matnr
.
message e000(msgclass) with lv_matnr.
in Message class msgclass
000: This Material no & Does not exist in MARA.
12-22-2006 4:57 AM
12-22-2006 7:22 AM
12-22-2006 4:58 AM
shift matnr left deleting leading space.
or
shift matnr right deleting trailing space.
regards
shiba dutta
12-22-2006 5:01 AM
use <b>CONDENSE</b> key word.
data: lv_matnr(10) type ,
lv_matnr = itab-matnr.
condense lv_matnr.
message e000(msgclass) with lv_matnr.
in message class msgclass:
000: This material no '&' does not exist in MARA.
cheers!
12-22-2006 7:34 AM
Hi Jai,
Try to use conversion exit for matnr.
conversion_exit_matn1_output.
Regards
Ashutosh
Reward points if helpful
12-22-2006 7:35 AM
use fm 'conversion_exit_alpha_output'
data: lv_matnr type matnr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = itab-matnr
IMPORTING
OUTPUT = lv_matnr
.
message e000(msgclass) with lv_matnr.
in Message class msgclass
000: This Material no & Does not exist in MARA.
12-22-2006 7:53 AM
Hi Keshi.
Iam using FM "CONVERSION_EXIT_MATN1_INPUT"
like
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = p_matnr
IMPORTING
output = p_matnr
EXCEPTIONS
length_error = 1
OTHERS = 2.
it displays message without leading Zeros but with SPACE.
i want remove that SPACE.
please help me.
Regards.
Jay.
12-22-2006 8:11 AM
Check this code below...
its working fine ...
REPORT ztest_xyz MESSAGE-ID ztst.
DATA: lv_matnr LIKE mara-matnr.
PARAMETERS: p_matnr LIKE mara-matnr.
SELECT SINGLE matnr
FROM mara INTO lv_matnr
WHERE matnr = p_matnr.
IF sy-subrc NE 0.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = p_matnr
IMPORTING
output = p_matnr.
MESSAGE e000(ztst) with p_matnr.
ENDIF.
in message class ztst, for message no 000 give your error description something like this:
000: The material '&' does not exist in mara.
12-22-2006 10:05 AM
12-22-2006 8:05 AM
12-22-2006 8:17 AM
report zex1 .
parameters : p_matnr like mara-matnr obligatory.
data : matnr like mara-matnr.
at selection-screen.
select single matnr into matnr from mara where matnr = p_matnr.
if sy-subrc eq 0.
else.
message e000(zvij) with p_matnr .
endif.
in ur message class say zvij u maintain this as
000 material & does not exist.
since matnr data type is char i think this is working fine as no gaps is found as the default alignment is left justified for data type char.
regards,
vijay
12-22-2006 8:51 AM
Hi,
Suppose p_matnr is holding your input value.
data v1(18).
at selection-screen on p_matnr.
if not p_matnr is initial.
v1 = p_matnr.
pack v1 to v1.
..use v1 for message
endif.