on 11-24-2008 9:18 AM
Dear all,
I have two date inputs. In both inputs i have to select a date. I want to check that date in second date field is always equal or greater than date value in first field. for eg if i select 20/11/2008 from the first field then i should only be able to select a date value equal to 20/11/2008 or something greater than that. kindly help me how should i validate it.
Regards,
Bharath
Hi Bharath,
You need to associate this validation with some event like button click or enter key... Read the values enetred by the user in to the 2 input fields and use 1 of the many FM's available within ABAP to get the difference between 2 dates like:
HR_99S_INTERVAL_BETWEEN_DATES, HR_HK_DIFF_BT_2_DATES, DAYS_BETWEEN_TWO_DATES etc,.. Check the number of days value returned by the FM & raise error messages accordingly.
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
answered
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bharath,
there is a method "WDDOBEFOREACTION" (Method for Validation of User Input).
You can use this method to validate the user input.
Within this method, get the attributes you want to check from the context node and do the validation.
Than use e.g. method REPORT_ATTRIBUTE_ERROR_MESSAGE.
Some sample coding:
data: l_element type TYPE REF TO if_wd_context_element.
data: l_attribute type string.
*todo: get l_element
(...)
* name of element
l_attribute = 'NAME_OF_ELEMENT'.
CALL METHOD lo_message_manager->REPORT_ATTRIBUTE_ERROR_MESSAGE
EXPORTING
MESSAGE_TEXT = 'Test message'
ELEMENT = l_element
ATTRIBUTE_NAME = l_attribute.
Please have a look at message for handling messages in WDDOBEFOREACTION.
Regards,
Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bharat,
you can validate it in 2 ways.
1. on enter of date field 2 you can get the field1 value by get_element then you compate it and valdiate it.
2. on save also the same validations you can do.
Regards,
mahesh.gattu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.