2008 Mar 05 8:33 PM
Hi,
Suppose I enter a wrong matnr in selection-screen say 1000.
I need to write a message like, Matnr '000 does not exists. please check entries.
Here how do i populate the 1000 in message
Pls help.
Thanks.
Hi,
Suppose I enter a wrong matnr in selection-screen say 1000.
I need to write a message like, Matnr '000 does not exists. please check entries.
Here how do i populate the 1000 in message
Pls help.
Thanks.
2008 Mar 05 9:04 PM
Hei
If your question was about how to write an error message...I can help you.
Go to SE91 and create a message class. And give all the messages that you want to use by specifying the message id.
You can call this message in your program using this
message-id. Can also use in other programs.
I guess you know the message types as Error, Abort, Warning, information etc.
Use them. Some won't let you to continue...check those
But retrieving the wrong matnr number dynamically..........am not sure how to do it.
I never did it.......Can we do that....I don't think so.
I hope it helps.
thanks
Edited by: Alchemi on Mar 5, 2008 3:04 PM
2008 Mar 05 9:07 PM
TABLES: mara.
SELECTION-SCREEN BEGIN OF BLOCK test.
PARAMETERS: p_matnr LIKE mara-matnr.
SELECTION-SCREEN END OF BLOCK test.
AT SELECTION-SCREEN.
SELECT SINGLE matnr
INTO mara-matnr
FROM mara
WHERE matnr EQ p_matnr.
IF sy-subrc NE 0.
MESSAGE e208 WITH 'Wrong material number'.
ENDIF.
START-OF-SELECTION.
Greetings,
Blag.
2008 Mar 06 6:33 AM
HI,
Create ur message in message class like this.
Se91->Give message class-> Message number(Give new number which does not exist in the message class)->press create.
There fill the message text like this.
Material & does not exists. please check entries. Save and go to ur program.
in the AT SELECTION-SCREEN event do like this.
AT SELECTION-SCREEN ON po_matnr.
CLEAR l_matnr.
SELECT SINGLE matnr FROM mara INTO l_matnr
WHERE matnr EQ po_matnr.
CHECK NOT sy-subrc IS INITIAL.
MESSAGE e123 WITH po_matnr.
If u enter material number 1000 and it does not exist the u will be getting message like this.
Material 1000 does not exists. please check entries.
Thanks,
Vinod.
2008 Mar 06 6:37 AM
Hi,
SELECTION-SCREEN BEGIN OF BLOCK test.
PARAMETERS: p_matnr LIKE mara-matnr.
SELECTION-SCREEN END OF BLOCK test.
AT SELECTION-SCREEN.
SELECT SINGLE matnr
INTO mara-matnr
FROM mara
WHERE matnr EQ p_matnr.
IF sy-subrc NE 0.
MESSAGE e208 WITH 'Wrong material number : ' , p_matnr .
ENDIF.
2008 Mar 06 6:41 AM
Hi,
Message Classes are container of user-defined messages. We can create our own messages to be displayed in the screen and we can create these messages in a message pool inside the message class.
SE91 is the Tcode to create a message class.
The created messages can be called from programs using the statement 'MESSAGE'.
SYNTAX:
MESSAGE <type_of_message><message id>(message_class).
TYPES OF MESSAGES:
-
S - Status message.
I - Information message.
E - Error message.
W - Warning message.
A - Abort message.
T - Terminate message.
You can create up to 1000 messages in a single message class. The message id ranges from 0 - 999.
Sample Code:
SELECTION-SCREEN BEGIN OF BLOCK WITH FRAME TITLE 'MESSAGE'.
Select-Options: so_matnr for mara-matnr.
SELECTION-SCREEN END OF BLOCK 'MESSAGE'.
AT SELECTION-SCREEN.
SELECT matnr
INTO mara-matnr
FROM mara
WHERE matnr in p_matnr.
IF sy-subrc NE 0.
MESSAGE e000(Zmessageclass) WITH ' Material number does not exists'.
ENDIF.
Regards,
kavitha.
2008 Mar 06 6:46 AM
Hi
declare it like this.
MESSAGE text-004 TYPE 'E'
IF v_field = 'WA_KNA1-KUNNR'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING "first_list
input = v_kunnr
IMPORTING
output = v_kunnr.
SELECT kkunnr vvbeln verdat vernam vauart vaudat
INTO TABLE it_vbak
FROM vbak AS v INNER JOIN kna1 AS k ON vkunnr = kkunnr
WHERE v~kunnr = v_kunnr.
PERFORM disp_header.
ELSE.
MESSAGE 'CLICK ON CUSTOMER NO FIELD' TYPE 'E'.
ENDIF.
2008 Mar 06 6:55 AM
Hi
i am sending a sample code.
table:mara.
types:begin of st_mara,
matnr type matnr,
ernam type ernam,
end of st_mara.
data:wa_mara type st_mara,
it_mara type standard table of st_mara.
select-options:so_matnr for mara-matnr.
AT SELECTION-SCREEN ON so_matnr.
SELECT matnr
FROM mara
INTO wa_mara-matnr
WHERE matnr IN so_matnr.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE i002."here give message as this is not valid number and check the entries.
ENDIF.
Thnaks&Regards,
Chaithanya.