on 08-20-2009 12:58 PM
hello all,
I am workin on editable alv, the user need to enter the values in the editable fields and in the last column(non-editable) i need to populate the total row wise,as soon as user enters a value and goes to next editable cell or on entering a vale and press enter.how to accomplish this task...
with regards,
sandeep akella.
Edited by: sandeep akella on Aug 20, 2009 1:58 PM
can you explin me in detail..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to Implement the OnCellAction event.follow these steps;
1. Goto WDDOMODIFYVIEW and place the following code
IF first_time IS INITIAL.
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_usg_alv( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_usg_alv( ).
DATA lo_value TYPE REF TO cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model(
).
CALL METHOD lo_value->if_salv_wd_table_settings~set_cell_action_event_enabled
EXPORTING
value = abap_true.
ENDIF.
2. Implement the onCellAction event as follows;
Goto Methods tab, create a new method. Method Type- Event Handler , Event - ON_CELL_ACTION
3. Now in this method retrive the contents of the row and calculate the value as follows.
DATA: l_element TYPE REF TO if_wd_context_element.
DATA:ls_stru TYPE wd_this->element_cn_alv.
DATA: l_node TYPE REF TO if_wd_context_node.
l_node = wd_context->get_child_node( 'CN_ALV' ).
l_element = l_node->get_element( r_param->index ).
l_element->get_static_attributes( IMPORTING static_attributes = ls_stru ).
ls_stru-last_col = ls_stru-col1+ls_stru-col2....+ ls_stru-col5. " add all the cells data
l_element->set_static_attributes( exporting static_attributes = ls_stru ).
Hi,
In the OnCellAction for that ALV, there is a paramter R_PARAM that has Id and also the content.
Using the Id, get the element at that ID.
*Use code wizard to get thr proper code. this is an example
lo_nd_node->get_element "Get elemnet at that index
exporting
index = r_param-id
importing
elmenet = lr_element.
if lr_element is not intiial.
lr_element->get_statitc_attributes
importing
new_items = ls_table.
endif.
lr_node->get_static_attributes_table
importing
new_items = lt_table.
lv_total = ls_table-cell1 + ls_table-cell2 + ls_table-cell3.
loop at lt_table into ls_table1.
if sy-tabix = r_param->id.
ls_table1-total = lv_total.
endif.
modify table lt_table from ls_table1 index r_param->id.
endloop.
Regards,
Lekha.
hello all,
yes i have implemented the aggregate total method. the column total was working fine before adding the cell action event.After adding it i am not able to get the change in the value of total when i changea value in the editable field.
I have commented all the code for enabling cell action and checked , then the column totals are changing normally as before with change in the value.
with regards,
sandeep akella.
Edited by: sandeep akella on Aug 21, 2009 5:28 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
CALL METHOD lo_value->if_salv_wd_table_settings~set_data_check
EXPORTING
value = if_salv_wd_c_table_settings=>DATA_CHECK.
When you have achived your task using oncellactio what exaclty you want. getting of Tab ID is also done using tab selection event.
What exactly you want to perform.
Regards,
Lekha.
Hello all,
i am able to capture data and add them on change of cell.I have also implemented the colunm wise total (before adding the event for editable cells) for editable cells and the non-editable total cell.Now with this change of getting the cell event I am unable to get the column totals automatically..what to do about this...
Edited by: sandeep akella on Aug 20, 2009 3:30 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Implement the onCellAction event for the Inputfield of the cell. In that method get the contents of the row and populate the total in the last cell.
Regards,
Radhika.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.