on 08-08-2011 12:54 PM
Hello Experts,
I have a table UI element in a view and a user can manually enter the values in the columns.
I have 3 columns for that table.
Now when i enter values in four rows then i am taking 3rd column of 1st row and second column of 2nd row and then comparing them.
If there is an error in the comparision then i am using REPORT_ATTRIBUTE_ERROR and thus giving the attribute and element name.
Now the issue i am facing is the column that is being marked red is always of the 1st row no matter the error is from 3 or 4 or any other row.
Now how can i mark the exact column in red.
Please help.
Thanks in Advance,
Shravan
1. get all the elemets of the node...
2. loop at all_elements into ls_elements.
ls_elements=>get_static_att
exporitng
ls_values
" check for error
if ls_values-sdate > ls_value-edate...
report message
CALL METHOD lo_message_manager->REPORT_ELEMENT_ERROR_MESSAGE
EXPORTING
MESSAGE_TEXT = 'edate is less than sdate'
MESSAGE_TYPE = CO_TYPE_ERROR
ELEMENT = lo_el_ref_no_tbl_view. " this is a wrong one ,,,, you have to use "ls_elements."
ATTRIBUTE_NAME = 'EDATE'.
endif.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can make use of methods which will give you all the elements in the table
and then you can read those elements using get_static_att methods for the values..
and then you can compare ,,, now you will have the exact element as well
1. put this code outside the loop..
lo_api_controller ?= wd_This->Wd_Get_Api( ).
CALL METHOD lo_api_controller->GET_MESSAGE_MANAGER
RECEIVING
MESSAGE_MANAGER = lo_message_manager.
2. you are looping at the table which holds value, instead you need to loop at the table which has elements
node->get_elements ...something like that.... use this to get all the elements
loop at all_elements into ls_elements.
ls_elements=>get_static_att
" check for error
if sy-subrc eq 0.
report message
CALL METHOD lo_message_manager->REPORT_ELEMENT_ERROR_MESSAGE
EXPORTING
MESSAGE_TEXT = 'edate is less than sdate'
MESSAGE_TYPE = CO_TYPE_ERROR
ELEMENT = lo_el_ref_no_tbl_view. " this is a wrong one ,,,, you have to use "ls_elements."
ATTRIBUTE_NAME = 'EDATE'.
endif.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can actual do this one...
your value of the context element is wrong...
i believe as you are comparing the values in a table...
now you hold the context element of the first row...
you can make use of methods which will give you all the elements in the table
and then you can read those elements using get_static_att methods for the values..
and then you can compare ,,, now you will have the exact element as well
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Thanks for the quick reply...
Here is the code i am using.But not able to get what i require....
CALL METHOD LO_ND_REF_NO_TBL_VIEW->GET_STATIC_ATTRIBUTES_TABLE
EXPORTING
FROM = 1
TO = 2147483647
IMPORTING
TABLE = lt_ref_no_tbl_view
.
LOOP at lt_ref_no_tbl_view INTO lw_ref_no_tbl_view.
if lw_ref_no_tbl_view-edate lt lw_ref_no_tbl_view-sdate.
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_ELEMENT_ERROR_MESSAGE
EXPORTING
MESSAGE_TEXT = 'edate is less than sdate'
MESSAGE_TYPE = CO_TYPE_ERROR
ELEMENT = lo_el_ref_no_tbl_view.
ATTRIBUTE_NAME = 'EDATE'.
When the error is in the second row the 1st row column is being highlited....
Please help
Thanks,
Shravan
Hello Shravan,
then I would go with what SSM proposed.
data lt_elements type WDR_CONTEXT_ELEMENT_SET.
data lo_element type ref to if_wd_context_element.
lo_api_controller ?= wd_This->Wd_Get_Api( ).
CALL METHOD lo_api_controller->GET_MESSAGE_MANAGER
RECEIVING
MESSAGE_MANAGER = lo_message_manager.
"Get all the elements in the table
lt_elements = LO_ND_REF_NO_TBL_VIEW->get_elements( ).
"Loop thru all the elements
loop at lt_elements into lo_element.
lo_element->get_static_attributes( lw_ref_no_tbl_view ).
if lw_ref_no_tbl_view-edate lt lw_ref_no_tbl_view-sdate.
CALL METHOD lo_message_manager->REPORT_ELEMENT_ERROR_MESSAGE
EXPORTING
MESSAGE_TEXT = 'edate is less than sdate'
* MESSAGE_TYPE = CO_TYPE_ERROR
ELEMENT = lo_element
ATTRIBUTE_NAME = 'EDATE'.
endif.
endloop.
BR, Saravanan
User | Count |
---|---|
81 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.