on ‎2006 Apr 18 11:04 AM - last edited on ‎2024 Feb 03 9:04 PM by postmig_api_4
Dear All,
I need to know a way in order to raise an error message in programme i.e when there is an error in the programme and if I run this program it should raise an error message.
With Regards,
Madhu.S.N
Request clarification before answering.
Hi Madhu,
The ABAP runtime environment handles messages according to the type declared in the MESSAGE statement and the context in which the message was sent. The following message types exist:
A - Abend : Transaction terminated
E - Error : Error message
I - Info : Information
S - Status : Status message
W - Warning : Correction possible
X - Exit : Transaction terminated with short dump
The message appears in a dialog box and the program terminates. When the user has confirmed the message, control returns to the next- highest area. All the internal sessions are deleted from the stack.
1) MESSAGE E0004(Message class) WITH 'Hugo'.
2) MESSAGE 'File not found.' TYPE 'E'.
The text 'File not found.' is output as the error
message.
Regards,
Shakuntala
Message was edited by: shakuntala Negi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
THE EASIEST SYNTAX IS
MESSAGE 'ERROR' TYPE 'E'.
MESSAGE 'XXXXXXXXXXXXXXX' TYPE 'W'.
.............
MESSAGE <'MESSAGE'> TYPE <'S'/'I'/'E'/'W'/'A'/'X'>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
write the statement :
message E001 with text-001.Depending on the program context, an error dialog appears
here the program stops because of the eerror message, if you correct that and reexecute then this will work.
whateer you give in the TEXT-001, that will come as a message, and this message will show in the status bar...
if you write this in the selection screen : -
Selection screen processing terminates, and the selection screen is redisplayed. The screen fields specified through the additions to the AT SELECTION-SCREEN statement are ready for input. The user must enter a new value. The system then restarts the selection screen processing using the new values. You cannot use error messages with the ON HELP-REQUEST or ON VALUE-REQUEST additions. Instead, a runtime error occurs.
Regards
Sudheer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Madhu,
Following program will be useful to know how to display a message whenever the program encounters a error according to cortain condition.
data: z type i.
parameters: x type i,
y type i.
if x = space or y = space.
MESSAGE E000(ZVAI).
enter valuse in all required fields.
endif.
z = x + y.
write:/ 'The sum is ', z.
To select a message from a message class, you have to create a message class first and then samve some messages in that class using SE91.
Then in the program, to display the message between if and endif statements, click the PATTERN button and select the MESSAGE radio button and enter the required details there.
Hope this will be useful for you.
Regards,
Vaitheeswaran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
As per my understanding to your doubt,
You can use 'if sy-subrc <> 0' and raise an error message with message id including 'E'.
regards
Rakesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check out help on Keyword 'Message', u will get the detailed info about it's usage.
Regds,
Akshay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Madhu,
When do u want to raise an error? Under what conditions?
VJ
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Madhu,
If you run the program with syntax error, system is giving error.
What type of checking you need. ?
Regards,
Naimesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
runtime error can happen for different reasons. and if you dont catch them throw proper messages the system will dump.
to catch errors you have to use try catch block.
for example if you are are doing a multiplication you know it for sure that the if the parameters are not numbers you will get convert_no_number error. to catch that you have to do that within try catch block to catch the error.
check out this link for more info.
http://help.sap.com/saphelp_nw04/helpdata/en/a9/b8eef8fe9411d4b2ee0050dadfb92b/frameset.htm
Regards
Raja
Reward points to helpful answers by choosing appropriate radiobutton in the answers.
Hi ,
If <some condition>
message E000 with 'error message'.
endif.
Regards,
GSR.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Use message statament for a message of type E or A (if you want a abend message)
IF ERROR
MESSAGE E.....
ENDIF.
Max
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 8 | |
| 8 | |
| 6 | |
| 4 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.