on 12-20-2010 2:18 PM
Hello,
I have requirement to provide validations at the row/columns fields in the ALV.
The scenario is that if the user enters data into a specific field which is not expected by that particular field then that field should be highlighted (only that row/field).
I could not find similar question in the forum hence posting.
Thanks & regards,
Ravish
Hi,
If you have deinfed in context attributes with the similar data dictionary fields, basic validation will be taken care.
If you want to find out the modified cells in the editable ALV, here is the way.
r_param->t_modified_cells in datacheck will find out the modified contents.
You will be having a button to save the contents. In that button, write the below code.
method ONACTIONONCLICK .
* Call the method WD_CPIFC_ALV in current controller
DATA lo_interface TYPE REF TO iwci_salv_wd_table.
lo_interface = wd_this->wd_cpifc_alv( ).
* Check for changes
lo_interface->data_check( ).
endmethod.
Here ONDATACHECK needs to be declared as Event Handler with Event ON_DATA_CHECK.
method ONDATACHECK .
DATA lo_nd_emp TYPE REF TO if_wd_context_node.
* navigate from <CONTEXT> to <EMP> via lead selection
lo_nd_emp = wd_context->get_child_node( name = wd_this->wdctx_emp ).
data : t_mod type standard table of ztable,
wa_mod type ztable,
t_table TYPE if_main=>elements_emp,
wa_table TYPE if_main=>element_emp,
wa_param type SALV_WD_S_TABLE_MOD_CELL.
* Check whether there is any modified data
check r_param->t_modified_cells is not initial.
lo_nd_emp->get_static_attributes_table( IMPORTING table = t_table ).
loop at r_param->t_modified_cells into wa_param.
* Retrieve the data from the t_table using the index
read table t_table into wa_table index wa_param-index.
if sy-subrc eq 0.
move-corresponding wa_table to wa_mod.
append wa_mod to t_mod.
endif.
endloop.
* here you can do the validations and pass the message accordingly.
* Populating message
data : lo_api_controller TYPE REF TO if_wd_controller,
lo_message_manager TYPE REF TO if_wd_message_manager.
lo_api_controller ?= wd_this->wd_get_api( ).
* Get message manager
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.
CALL METHOD lo_message_manager->report_success
EXPORTING
message_text = 'Message'.
endmethod.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
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.