cancel
Showing results for 
Search instead for 
Did you mean: 

CheckBoxes in ALV Table..

Former Member
0 Kudos

Hi Experts,

Can we place checkboxes in ALV tables in WebDynpro, ?

I need to display the checkboxes in the ALV table, When i placed the checkboxes of type CL_SALV_WD_UIE_CHECKBOX.

But when i see the diplay, all the Checkboxes are Checked, if i unchecking one checkbox again all the checkboxes has being checked .And everytime if uncheck there is round trip is happening.How to avoid, so that the user can select freely the Multiple Checkboxes .

I am maintaining 0..n Selection

and Cardinality as 0..n

Is there any wrong with the pattern .....

Accepted Solutions (1)

Accepted Solutions (1)

former_member515618
Active Participant
0 Kudos

Hi Vikranth,

Do the following to set ALV column of Check box type.


* 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.

Regarding the checking problem.

Please check the logic for building the context node that has the data displayed as ALV. The check box is unchecked only if it has value ' ' (Space) else it is set to 'X'.

Regards,

Sravan Varagani

Former Member
0 Kudos

HI Sravan,

The problem with not the code to display the check boxes, No i got the check boxes with the Unchecked state. Now the Problem when ever the user click there is server round trip .How to avoid that.See i need to display thousands of records. If the user wants to check the 50 records. 50 server round trips are happening.

former_member515618
Active Participant
0 Kudos

Hi Vikrant,

What i understand from the above post is that when you check a checkbox all the records are displayed as checked and viceversa. Please correct if i am wrong.

Could you confirm if you are binding the ALV data in WDDOMODIFY? If yes please check if you are modifying the value displayed in the context node.

Could you also let us know what you mean by server round trip.

Regards,

Sravan Varagani

Former Member
0 Kudos

HI Sravan,

I am writing the code in the WDOINIT to create the ALV Component and the Checkboxes, But when i click the Checkboxes , server round trip.is happening and all the checkboxes are being checked again.

Server Trip is nothing but a request being sent to server and server gives the response to the client according to the request.

This can be seen the green progress bar of IE.

For every click the round trip is happening.

For Eg. If u click a button, linktoaction ,or linktourl u can see the server rountrips.

if u go for the WDR_TEST_UI_ELEMENTS application and select checkbox and test u can see the screen flickering and observe the green progress indicatior in the IE

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Declare the checkbox in the table.

for the check box

checked shld be mapped to the context.

In on action submit write this code.

loop at lt_auth into ls_auth.

MOVE-CORRESPONDING ls_auth to ls_tmp.

if ls_auth-add eq abap_true.

ls_tmp-zadd = '1'.

else.

ls_tmp-zadd = '0'.

endif.

endloop.