cancel
Showing results for 
Search instead for 
Did you mean: 

Highlight a cell of table if the value entered in that cell is wrong.

mahesh_jagnani
Participant
0 Kudos

Hi Expert,

My requirement is that once the user enter any wrong data in the cell of the table , that particular cell should be Highlight .There should be a line in the message area above the table which will display the message corresponding to the error and beside that error message there should be a button(Hyperlink) so that once user will click that hyperlink , it will take the cursor to that error cell.

Can u plz help.

Thanks

Mahesh.

Accepted Solutions (1)

Accepted Solutions (1)

former_member450736
Active Participant
0 Kudos

Hi,

i guess you can use REPORT_ATTRIBUTE_ERROR_MESSAGE method of interface if_wd_message_manager to raise error message, in this method we have ENABLE_MESSAGE_NAVIGATION parameter which enables message navigation.

get the current element in the table and then pass element and attribute to raise error message.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi , use report_attribute_error_message method of if_wd_message_manager

you have to write code to identify row number from your table where you want to give error ,

where lv_index is the index of row

like

lo_el_items_details = lo_nd_items_details->get_element( index = lv_index ).

and then

CALL METHOD wd_comp_controller->gref_msg_manager->report_attribute_error_message

EXPORTING

message_text = your error message'

element = lo_el_items_details " this is the index of row in the table where the error is

attribute_name = 'name of column as per context'.

Former Member
0 Kudos

hI,

Use REPORT_ATTRIBUTE_ERROR_MESSAGE at validation time to highlight cell colour. OR

create one attribute of type WDUI_TABLE_CELL_DESIGN and bind TableColumn Property CellDesign.

Dynamically based on certain condition change cell color according to your wish.

CALL METHOD lo_message_manager->REPORT_ATTRIBUTE_ERROR_MESSAGE

EXPORTING

MESSAGE_TEXT = 'Please Input Delivery TO Date...'

ELEMENT = lo_el_it_ledat_range

ATTRIBUTE_NAME = 'HIGH' .

Hope it helps..

Cheers,

Kris.

mahesh_jagnani
Participant
0 Kudos

Hi Kris,

Thanks for your input.

By using your solution i will get the changed color of the cell.But my requirement is little different.

There is one table and if there are 4 cells in the table where there is error, then in the message area four lines will be displayed corresponding to each error message.

Beside every line there will be a different button which corresponds to hyper link.(In this case there will be 4 Buttons)

Once the user click on that button it will navigate to that particular error cell.

Can u Please give me idea how to do this.

Thanks

Mahesh

Former Member
0 Kudos

Hi,

Create an attribute of type ref to IF_WD_VIEW in tehe context. under the main context node itself. give its name as view.

write some code in the wddomodify. like as shown below.

if first_time eq abap_true.

data node type ref to if_wd_context_node.

data ele type ref to if_wd_context_eleMENT.

node = wd_context->get_child_node( '<node name>' ). "write your node name here which is used as data source for table

ele = node->get_element( 1 ).

DATA VEL TYPE REF TO IF_WD_VIEW_ELEMENT.

VEL ?= lv_view->GET_ELEMENT( '<view ele id>' ). "write the view element id of the cell editor's id

lv_view->REQUEST_FOCUS_ON_VIEW_ELEM(

view_element = VEL

CONTEXT_ELEMENT = ELE ).

wd_context->set_attribute(

name = 'VIEW'

VALUE = VIEW ).

endif.

Cheers,

Kris.

former_member389677
Active Participant
0 Kudos

Hi,

I hope this information can also help to solve your problem .

Binding TableColumn Property CellDesign to context attribute defined in the data node allows to define the background color of each cell dynamically. so that u can higlight the perticular cell.

So define a color node type (WDUI_TABLE_CELL_DESIGN) in context and bind to CellDesign property of Tablecolumn.

Regards

Shaira