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: 

Doubt in message class.

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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 REPLIES 12

Former Member
0 Kudos

Shift p_mara left deleting leading space.

0 Kudos

hi

I not working please help me

Regards,

Jay

Former Member
0 Kudos

shift matnr left deleting leading space.

or

shift matnr right deleting trailing space.

regards

shiba dutta

Former Member
0 Kudos

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!

former_member508729
Active Participant
0 Kudos

Hi Jai,

Try to use conversion exit for matnr.

conversion_exit_matn1_output.

Regards

Ashutosh

Reward points if helpful

Former Member
0 Kudos

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.

0 Kudos

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.

0 Kudos

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.

0 Kudos

Hi Kesi Rahul.

you are sloved my Problem.

Thank you so much ,

former_member404244
Active Contributor
0 Kudos

hi,

use condense matnr no-gaps. and try...

Regards,

Nagaraj

Former Member
0 Kudos
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

jayanthi_jayaraman
Active Contributor
0 Kudos

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.