05-24-2011 2:40 PM
Hi all,
my requirement is to show an warning message on non key field if validation is not correct and edit on the same screen.
solution: I have created an event new-entry in table maintance and tried to validate that field field (email)
form new_entry.
if table-email na '@'.
message w001(incorrect email id)
endif.
enfdform.
- In this way it show the warning correctly but i am not able to edit that email field on the same screen.
do i need to validate in chain endchain. If yes how ??
Can anyone suggest the solution with demo code .
Thanks,
Aisha
05-24-2011 4:03 PM
Simple set sy-subrc some value after message statement and change message type as 'S' like below.
FORM new_entry.
IF table-email NA '@'.
MESSAGE s001(incorrect email id). " Message type 'S' to stay in same screen
sy-subrc = 1. " Set some value other than zero to abort saving
ENDIF.
ENDFORM. "new_entry
05-24-2011 4:07 PM
this isssue is resolved . we need to valididate the field in chain endchain with module modulename and write the logic inside that.
not in the event new-entry.
Thanks,
Aisha
05-24-2011 8:52 PM
Hi Aisha, thank you for the feedback. Could you set the thread as answered. Thanks!
Sandra
05-24-2011 9:21 PM
no....never never put logic in a table maintance screen....if you make changes in your table y regenerate the table maintenance you will loose all the validations....
always use events..
regards, Sebastiá
05-24-2011 10:41 PM
Sebastian is correct. Have a look at: [Custom Validation on Table Maintenance Generator (SM30)|http://musicodez.wordpress.com/2010/09/13/custom-validation-on-table-maintenance-generator-sm30/] to see how to handle this with events.
Rob