on 04-03-2008 7:38 AM
hi All,
i have to display ALVreport with one of the columns has checkbox.whenever user presses any checkbox,in repected row values have to be validated and updated in DataBase.
My First Doubt is,How can i get the column of checkBoxes in ALV Report.?
2.How can i add action for that checkBox?
Regards,
Ravi.
Hi Sravan,
What u think is exactly right.my scenario is after displaying my ALV Report ,user can select any of the chekbox in their rows. after that he press on button(CONFIRM).Then a POP-UP will rise ask him to confirm or not.then if he press YES ,a flag must generated in other table.
Regards,
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
I am not clear wiht your requirement.
When user clicks on the confirmation button, do you want to validate the selected records or raise a popup for confirmation. If raising confirmation popup, what is the question we ask. And why do we have to set the flag.
Could you please let me know the requirement.
Regards,
Sravan Varagani
Hi Ravi,
Your requirement can be achieved by creating a custom function in your ALV.
We create a button in the ALV toolbar with text 'Confirm'. When user clicks on this, a popup screen is called for confirmation. Based on the input we set the flag.
To accomplish this, When defining the configuration model of the ALV, do the following
Assume that we get the model of the ALV into lo_list
lo_list = lo_ref_interfacecontroller->get_model( ).
DATA:
* Generate an object for self defined functions
lo_self_functions TYPE REF TO if_salv_wd_function_settings,
* Generate an object for button 'Confirm'
lo_button_conf TYPE REF TO cl_salv_wd_fe_button,
*-----------------------------------------------
* Set Self-defined functions
*-----------------------------------------------
* 'Confirm' Button
lo_self_functions ?= lo_list.
lo_self_function = lo_self_functions->create_function( 'CONFIRM' ).
CREATE OBJECT lo_button_conf.
CLEAR l_text.
l_text = 'Confirm'
lo_button_sel_all->set_text( l_text ).
lo_button_sel_all->set_image_source( '< Any icon name >' ).
lo_button_sel_all->set_image_first( 'X' ).
lo_self_function->set_editor( lo_button_conf ).
In the methods tab, Create a event handler for ON_FUNCTION event of the ALV.
ONFUNTION Event Handler ON_FUNCTION ON_FUNCTION INTERFACECONTROLLER alv_name
In the ONFUNCTION method, Do the following.
DATA:
l_window TYPE REF TO if_wd_window,
l_componentcontroller_api TYPE REF TO if_wd_component,
l_window_manager TYPE REF TO if_wd_window_manager,
l_api TYPE REF TO if_wd_view_controller,
lt_text TYPE string_table,
l_text_line TYPE string.
*-------------------------------------------------------
* Based on the function selected, set the selection
*-------------------------------------------------------
CASE r_param->id.
WHEN 'CONFIRM'.
* Call the confirmation for popup
l_api = wd_this->wd_get_api( ).
l_componentcontroller_api = wd_comp_controller->wd_get_api( ).
l_window_manager = l_componentcontroller_api->get_window_manager( ).
CALL METHOD l_window_manager->create_popup_to_confirm
EXPORTING
text = lt_text
button_kind = if_wd_window=>co_buttons_yesno
message_type = if_wd_window=>co_msg_type_question
window_position = if_wd_window=>co_center
RECEIVING
result = l_window.
CALL METHOD l_window->subscribe_to_button_event
EXPORTING
button = if_wd_window=>co_button_yes
action_name = 'YES'
action_view = l_api
is_default_button = abap_false.
CALL METHOD l_window->subscribe_to_button_event
EXPORTING
button = if_wd_window=>co_button_no
action_name = 'NO'
action_view = l_api
is_default_button = abap_false.
l_window->open( ).
ENDCASE.
Create 2 actions with names YES and NO ( As mentioned in the subscription.
In these actions, bases on the inputs, set the flag to a context attribute and update the same in the table you wanted.
Hope this is what you want.
Regards,
Sravan Varagani.
Hi Sravan,
DATA:lr_salv_wd_table_usage TYPE REF TO if_wd_component_usage,
lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_input_field TYPE REF TO cl_salv_wd_uie_input_field,
lr_chk_box TYPE REF TO cl_salv_wd_uie_checkbox,
lr_table_settings TYPE REF TO if_salv_wd_table_settings,
lr_salv_wd_table TYPE REF TO iwci_salv_wd_table,
lr_column TYPE REF TO cl_salv_wd_column.
lr_salv_wd_table_usage = wd_this->wd_cpuse_alv( ).
IF lr_salv_wd_table_usage->has_active_component( ) IS INITIAL.
lr_salv_wd_table_usage->create_component( ).
ENDIF.
lr_salv_wd_table = wd_this->wd_cpifc_alv( ).
wd_this->alv_config_table = lr_salv_wd_table->get_model( ).
lr_table_settings ?= wd_this->alv_config_table.
in the above scenario i am getting the error .
*Field "ALVCONFIG_TABLE" is unknown.it is neither in the one of the specified_*
tables nor defined by the data statement.
How can i rectify it
Regards,
Ravi
i m getting error
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
Regarding the second point, We cannot add an action to Checkboxes displayed in ALV.
But what i understand from your requirement is that when user selects that check box you want to do a Validation of the selected record. Pls correct me if i am wrong. This can be accomplished as follows.
In editable ALVs, there is a button called 'Check' in the tool bar. When User clicks on this button an ALV event ON_DATA_CHECK is triggered. In this you can read all the records for which the check box is set and do validation of all the records collectively.
If you want to validation to only the lead selected record, then There is a event handler ON_LEAD_SELECT for the same. In the ALV table the first row is a button for selecting, when this is selected the above event is triggered and in the event handler of the same, read the lead selected record and do the validations.
Hope this helps.
Regards,
Sravan Varagani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sravan,
my requirement is after displaying ALV Report ,
user has going to be select checkboxes.he can select any no of checkboxes.what i want is whenever he select a checkbox,that row must be selected.(ie.if he check 5 checkboxes five rows must be selected.).and i want those selected rows into a internal table.bcoz i want to update those selected records only.
How Can u set that entire row to be selected,whenever user cliks on checkbox?
2.how can we get those selected rows into a internaltable.?
Regards,
Ravi
Hi Ravi,
Upon checkbox click, there is no event which is raised. So we cant set the lead selection of the records when user checks the box.
For point2.
Get all the table entries by using get_static_attributes_table in if_wd_context_node.
Loop at this table where the checkbox fiels = 'X'. and get the selected records.
Regards,
Sravan Varagani
Hi Sravan,
in my application ,i use a event handler of ALV,
ON_CELL_ACTION.when it triggers,i use method of IF_WD_CONTEXT_ELEMENT->SET_SELECTED.
MY CODE IS
lr_node_ep_sch_info = wd_context->get_child_node( wd_this->wdctx_ep_sch_info ).
lr_ep_sch_info = lr_node_ep_sch_info->get_element( ).
lr_el_ep_sch_info->SET_SELECTED( ABAP_TRUE ).
lr_node_ep_sch_info->get_selected_elements( ).
lr_node_ep_sch_ifo->get_static_attributes_table( importing TABLE = 'lt_ep_sch_info' ).
is it work?
Regards,
Ravi.
Hi Ravi,
For the first point. i.e. setting a column as check box.
Do the following when defining the configuration model of your ALV.
In this case iam defining column CURR_ISO as check box (Editable).
* create an instance of ALV component
DATA:
lr_salv_wd_table_usage TYPE REF TO if_wd_component_usage,
lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_input_field TYPE REF TO cl_salv_wd_uie_input_field,
lr_chk_box TYPE REF TO cl_salv_wd_uie_checkbox,
lr_table_settings TYPE REF TO if_salv_wd_table_settings,
lr_salv_wd_table TYPE REF TO iwci_salv_wd_table,
lr_column TYPE REF TO cl_salv_wd_column.
lr_salv_wd_table_usage = wd_this->wd_cpuse_alv( ).
IF lr_salv_wd_table_usage->has_active_component( ) IS INITIAL.
lr_salv_wd_table_usage->create_component( ).
ENDIF.
lr_salv_wd_table = wd_this->wd_cpifc_alv( ).
wd_this->alv_config_table = lr_salv_wd_table->get_model( ).
lr_table_settings ?= wd_this->alv_config_table.
* Set ALV as editable
lr_table_settings->set_read_only( abap_false ).
* Get Column reference
CALL METHOD wd_this->alv_config_table->if_salv_wd_column_settings~get_column
EXPORTING
id = 'CURR_ISO'
RECEIVING
value = lr_column.
* Create a checkboc
CREATE OBJECT lr_chk_box
EXPORTING
checked_fieldname = 'CURR_ISO'.
* Set the cell editor type to the check box.
CALL METHOD lr_column->set_cell_editor
EXPORTING
value = lr_chk_box.
Hope this helps,
Sravan Varagani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
Check this: [Editing ALV in Web Dynpro for ABAP|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1]
Regards,
Reema.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
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.