Application Development and Automation 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: 
Read only

Doubt in message class.

Former Member
0 Likes
1,134

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
Read only

Former Member
0 Likes
1,109

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.

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
Read only

Former Member
0 Likes
1,109

Shift p_mara left deleting leading space.

Read only

0 Likes
1,109

hi

I not working please help me

Regards,

Jay

Read only

Former Member
0 Likes
1,109

shift matnr left deleting leading space.

or

shift matnr right deleting trailing space.

regards

shiba dutta

Read only

Former Member
0 Likes
1,109

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!

Read only

former_member508729
Active Participant
0 Likes
1,109

Hi Jai,

Try to use conversion exit for matnr.

conversion_exit_matn1_output.

Regards

Ashutosh

Reward points if helpful

Read only

Former Member
0 Likes
1,110

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.

Read only

0 Likes
1,109

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.

Read only

0 Likes
1,109

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.

Read only

0 Likes
1,109

Hi Kesi Rahul.

you are sloved my Problem.

Thank you so much ,

Read only

former_member404244
Active Contributor
0 Likes
1,109

hi,

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

Regards,

Nagaraj

Read only

Former Member
0 Likes
1,109
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

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,109

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.