cancel
Showing results for 
Search instead for 
Did you mean: 

validation for first line item ( table )

Former Member
0 Kudos

Dear Friends,

i have table with multiple line items, i want to validate first line item only, if first line item is initial, it should throw an error message, could any one pls help me with an example

Thanks

Vijaya

Col1

Col2

Col3

Accepted Solutions (0)

Answers (1)

Answers (1)

amy_king
Active Contributor
0 Kudos

Hi Vijaya,

Method get_static_attributes_table of interface if_wd_context_node will return a table of context elements. You can then either read the first row of that table or loop through it to validate the table's data and issue messages as needed. For example...


data lo_nd_ctx_node type ref to if_wd_context_node.

data lt_attributes_table type wd_this->elements_ctx_node.

lo_nd_ctx_node = wd_context->get_child_node( name = wd_this->wdctx_ctx_node ).

lo_nd_ctx_node->get_static_attributes_table( importing table = lt_attributes_table ).

If the row to be validated happens to be the table's lead selection, you can fetch attributes of the lead selection row directly, and again validate and issue messages as needed...


data lo_nd_ctx_node type ref to if_wd_context_node.

data lo_el_ctx_element type ref to if_wd_context_element.

data ls_attributes type wd_this->element_ctx_node.


lo_nd_ctx_node = wd_context->get_child_node( name = wd_this->wdctx_ctx_node ).
lo_el_ctx_element = lo_nd_ctx_node->get_element( ).
lo_el_ctx_element->get_static_attributes( importing static_attributes = ls_attributes ).

Both of these code patterns to read context data are available through the Web Dynpro Code Wizard.

Cheers,

Amy