Problem: Need to set an error message programmatically for selection screen field without changing screen. Example: if selection screen contains plant field. We have to make this field mandatory without using obligatory statement. Error message will be shown at the time clicking on execute button but the screen should not be changed.
Solution: An error message needs to be set with apropriate logic. But the message type should be 'S' and message should be displayed like 'E'. Then 'LEAVE LIST-PROCESSING' statement needs to be implemented which will return to selection screen as soon as the error is shown.
ABAP Code Example:
IF s_plant IS INITIAL. "Where s_plant is an input field parameters
MESSAGE 'Please enter plant' TYPE 'S' DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
ENDIF.
MESSAGE 'Please enter plant' TYPE 'S' DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
ENDIF.
'
Comments
Post a Comment