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

display error message

Former Member
0 Likes
14,119

Hi

I have create a validation with 2 database table and i wanted to create an error message when an invalid fields is input. How do i create the message using se80 or se11 like "Invalid ID is entered"?

10 REPLIES 10
Read only

Former Member
0 Likes
3,230

Hi,

Just do like this.

MESSAGE 'Your text' TYPE 'E'.

Thanks.

Read only

Former Member
0 Likes
3,230

Hi,

Create Foreign key relationship between the required field and the field of the database table with which you want to compare your input.

whenever you enter an invalid input this wil check if the value exists in check table or not.

if it does not exists then it will show standard SAP error message.

hope this will help.

Thanks

Rajesh Kumar

Read only

Former Member
0 Likes
3,230

Hi,

Please do like this:

MESSAGE 'Your text' TYPE 'E' and not I since 'E' is for error message and 'I' is for informative message

Read only

Former Member
0 Likes
3,230

Hi Tay,

In PAI

chain.

field : field1, field2.

modue check_field on request(input).

endchain.

in program.

module check_field.

if not field1 is initial.

check with database for correct entry.

if not sy-subrc is initial.

message 'Please enter Valid ID' type 'E'.

endif.

For More info Please take F1 help on FIELD or CHAIN key words

endif.

Regards

Ramchander Rao.Krishnamraju

endmodule.

Edited by: ramchander krishnamraju on Dec 16, 2008 6:48 AM

Read only

Former Member
0 Likes
3,230

Hi,

You can validate the table as i have validated the plant.

CHECK s_werks[] IS NOT INITIAL.

SELECT werks

INTO w_werks

FROM t001w

UP TO 1 ROWS

WHERE werks IN s_werks.

ENDSELECT.

CHECK sy-subrc NE 0.

MESSAGE e003(zmtv). " Invalid Plant

Thanks & Regards,

Khushboo.

Read only

Former Member
0 Likes
3,230

hello,

Simple use :

Message ' Error' Type 'E'.

Thanks

Read only

Former Member
0 Likes
3,230

Hi,

Create a message id say ZID and declar the messge id using statement,

REPORT ZTEST

NO STANDARD PAGE HEADING

MESSAGE-ID zID

LINE-SIZE 200 "page width

LINE-COUNT 65(0). "page length.

now where you want to display the error message write,

SELECT SINGLE <field-name> FROM <table-name>

INTO <table-name>

WHERE <condition>.

IF sy-subrc <> 0.

MESSAGE e300 WITH <field-name>.

ENDIF.

Now to write the messge Invalid ID is entered, double click on e300, enter the message and save it.

Hope this will help you.

Best Regards,

Deepa Kulkarni

Read only

Former Member
0 Likes
3,230

Hi,

Just see the following example.

CHAIN.

FIELD LFA1-LIFNR, LFA1-LAND1.

MODULE USER_MODULE.

ENDCHAIN.

NOTE: Now double click on bolded USER_MODULE above and write the following code.

SELECT SINGLE * FROM LFA1 WHERE LIFNR = LFA1-LIFNR AND LAND1 = LFA1-LAND1.

IF SY-SUBRC NE 0.

MESSAGE E000(0) WITH 'ENTER VALID INPUT'.

ENDIF.

Regards,

BBR.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
3,230

Hi Shirleen Tay,

To display any kind of messages create a message class.

Simply while creating a report write:-


REPORT z_vendr MESSAGE-ID zmsg_cl.

While use se80, declare this message-id in the top module same as above.

Now double click on zmsg_cl to create a message class and then enter your messages against the three number codes.

You can use this three digit code with the message type to display the message to user.

Now while displaying any message use:-


IF <condition>.
    MESSAGE e000. "e for error messages
ENDIF.
"w for warning messages w001
"i for information messages i002

Hope this solves your problem.

Thanks & Regards

Tarun Gambhir

Read only

Former Member
0 Likes
3,230

Create Message Class in transaction se91

and call that message in your program

MESSAGE e000(Message Class)

For further information check this link

http://help.sap.com/saphelp_nw04/helpdata/EN/d1/801b3e454211d189710000e8322d00/frameset.htm