on 02-09-2011 7:04 AM
Hi Everyone,
I have one input enable table with 5 fields. and one save button to save records in ztable. when i am entering any value in first field and other fields blank and clicks on SAVE button it should show message that 2nd field is mandatory.
i used following code and i have made 2nd field as state property Required.
but it is showing mandatory message for entire column.although i am entering 2 row entry of first field. it should show mandatory message for 2 rows of 2nd column.
data l_view_controller type ref to if_wd_view_controller.
l_view_controller = wd_this->wd_get_api( ).
cl_wd_dynamic_tool=>check_mandatory_attr_on_view( view_controller = l_view_controller ).
can anybody help me.
Thanx in advance.
Hi,
Use the GET_ELEMENTS of your node, Loop through the elements and check wether the fields are intial as per row wise and try to throw the error by urself.
Have you tried using CL_WD_DYNAMIC_TOOL=>CHECK_MANDATORY_ATTRIBUTES method for the same.
Regards,
Lekha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello john,
in that case you cannot use the utility class you have to manually generate the error message like as shown below.
write this code in your eventhandler of SAVE button.
data ct_el type ref to if_wd_context_element.
DATA STR TYPE STRING.
DATA RESULT TYPE WDY_BOOLEAN VALUE ABAP_FALSE.
ct_el = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).
ct_el->get_attribute(
EXPORTING
NAME = 'TEST' "HERE GIVE THE NAME OF THE ATTRIBUTE FOR THE SECOND COL
IMPORTING
VALUE = STR
).
if STR is initial.
RESULT = abap_true.
endif.
IF RESULT EQ ABAP_TRUE.
* get message manager
data lo_api_controller type ref to if_wd_controller.
data lo_message_manager type ref to if_wd_message_manager.
lo_api_controller ?= wd_This->Wd_Get_Api( ).
CALL METHOD lo_api_controller->GET_MESSAGE_MANAGER
RECEIVING
MESSAGE_MANAGER = lo_message_manager
.
* report message
CALL METHOD lo_message_manager->REPORT_ATTRIBUTE_ERROR_MESSAGE
EXPORTING
MESSAGE_TEXT = 'MANDATROY fIELD !!!!!!!'
ELEMENT = CT_EL
ATTRIBUTE_NAME = 'TEST' "NAME OF THE ATTRIBUTE
.
ENDIF.
thanks
sarbjeet singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.