‎2008 Dec 16 5:37 AM
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"?
‎2008 Dec 16 5:45 AM
‎2008 Dec 16 5:47 AM
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
‎2008 Dec 16 5:48 AM
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
‎2008 Dec 16 5:48 AM
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
‎2008 Dec 16 5:48 AM
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.
‎2008 Dec 16 5:54 AM
‎2008 Dec 16 6:04 AM
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
‎2008 Dec 16 6:20 AM
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.
‎2008 Dec 16 6:40 AM
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
‎2008 Dec 16 7:04 AM
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