on 11-07-2013 6:51 AM
Hi K,
Field validation in Web Dynpro must be programmed by the developer, and this is usually done in hook method WDDOBEFOREACTION in the view. If the action being executed is Standard and an error message is issued during validation, process flow halts so the user can correct the error. If, on the other hand, the action is Validation-Independent, process flow continues even if an error message is issued.
Whether a field's value is valid or not must be checked manually according to the field's requirements. For checking whether all the view's required fields are filled or not can be done using one of two static methods in class CL_WD_DYNAMIC_TOOL...
Mandatory fields are UI elements whose state property is set to required. Once you determine that an error message needs to be generated, you can use the code wizard to issue a message. Take a look at interface IF_WD_MESSAGE_MANAGER to see the methods available for generating a message. Messages issued via this interface will be displayed in the view's MESSAGEAREA.
Cheers,
Amy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
You must have created a method for the button on search in which you are fetching your data .
just before fetching the data , call the node:attribute that is binded to the field matnr and call its value there.If it is initial you can throw the error message.
data :
lo_api_controller TYPE REF TO if_wd_controller.
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.
CALL METHOD lo_message_manager->report_error_message
EXPORTING
message_text = 'Please enter the value in Matnr field ' ..
Feel free to ask .Close the thread if it solves .
Regards
vaibhav Juneja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Add the below code in method 'WDDOBEFOREACTION' of your view.
****CHECK FOR MANDATORY FIELDS
DATA LO_API_CONTROLLER TYPE REF TO IF_WD_VIEW_CONTROLLER.
DATA LO_ACTION TYPE REF TO IF_WD_ACTION.
LO_API_CONTROLLER = WD_THIS->WD_GET_API( ).
LO_ACTION = LO_API_CONTROLLER->GET_CURRENT_ACTION( ).
IF LO_ACTION IS BOUND.
CASE LO_ACTION->NAME.
WHEN 'ACT_ADD_SUCC'. "Replace ACT_ADD_SUCC with the Name of Action attached with ur button
CL_WD_DYNAMIC_TOOL=>CHECK_MANDATORY_ATTR_ON_VIEW(
EXPORTING
VIEW_CONTROLLER = LO_API_CONTROLLER " Web Dynpro: API of a View
* DISPLAY_MESSAGES = ABAP_TRUE " Replacement for Real Boolean Type: 'X' == True '' == False
* IMPORTING
* MESSAGES =
).
ENDCASE.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.