cancel
Showing results for 
Search instead for 
Did you mean: 

HOW TO SELECT MULTIPLE ROWS IN ALV TABLE

Former Member
0 Kudos

Hi ,

I have a customer requirement in which for an alv table he should be able to select any set of rows like 3, 6,7,12 --- and should be able to delete those rows. I'm able to select all or a continuous row selection like either 3,4,5,6,7 but not able to select a discontinuous set like 4,5,7,12., so please suggest a solution to this

i've searched the forum and found the solution for a normal table but not alv table

Thanks in advance.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

In ABAP module pool we are having a provision in table control where we can enable multiple row selection. Is there any option in webdynpro which does the same functionality .please consider

Former Member
0 Kudos

We have an option to enable Mutliple selection, but user has to use CTly Key for more than one row selection.

Former Member
0 Kudos

Hi lekha,

Please tell me the procedure how to enable the multiple selection either with or without ctrl key. I'm new to webdynpro so please consider

Former Member
0 Kudos

You will instantiate the ALV right, we get this model object - cl_salv_wd_config_table.

This is the main class to work with ALV.

It has the interface IF_SALV_WD_TABLE_SETTINGS~SET_SELECTION_MODE where you have pass '04'.

Automatically you can the selectALl button at the left side top corner of ALV table when displayed.

AUTO TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '00', " TableSelectionMode.auto

SINGLE TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '02', " TableSelectionMode.single

MULTI TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '04', " TableSelectionMode.multi

NONE TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '06', " TableSelectionMode.none

SINGLE_NO_LEAD TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '07', " TableSelectionMode.singleNoLead

MULTI_NO_LEAD TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '08', " TableSelectionMode.multiNoLead

Then using CTRL key you can select the multiple rows.

Please check this.

sahai
Contributor
0 Kudos

Hi,

Go through the sample code below

Data: context_node type ref to if_wd_context_node.

  Data: it_scarr type STANDARD TABLE OF if_view1=>element_CARRIERS,
        wa_scarr like line of it_scarr.
  data: ld_element   type ref to if_wd_context_element,
        it_selrows  type WDR_CONTEXT_ELEMENT_SET,
        wa_selrows like line of it_rows.

  context_node = wd_context->get_child_node( name = 'CARRIERS').
  it_selrows  = context_node->GET_SELECTED_ELEMENTS( ).

 LOOP AT it_selrows INTO wa_selrows.
    CALL METHOD wa_rows->get_static_attributes
        IMPORTING
          static_attributes = wa_scarr.
    APPEND wa_scarr TO it_scarr.
    CLEAR  wa_scarr.
  ENDLOOP.

* All selected rows will now be contained in it_scarr

Regards,

Sahai.S

Former Member
0 Kudos

Hi lekha ji,

I Wrote the following code in WDDOINIT

method WDDOINIT .

DATA :alv_prop TYPE REF TO CL_SALV_WD_CONFIG_TABLE,

MULTI TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '04'.

alv_prop->IF_SALV_WD_TABLE_SETTINGS~SET_SELECTION_MODE( MULTI ) .

endmethod.

*I GOT THE FOLLOWING ERROR.* Please help

The following error text was processed in the system EIS : Access via 'NULL' object reference not possible.

The error occurred on the application server erpsolman_EIS_02 and in the work process 0 .

The termination type was: RABAX_STATE

The ABAP call stack was:

Method: WDDOINIT of program /1BCWDY/BGANP67GS5M05L0V5PY0==CP

Method: IF_WDR_VIEW_DELEGATE~WD_DO_INIT of program /1BCWDY/BGANP67GS5M05L0V5PY0==CP

Method: DO_INIT of program CL_WDR_DELEGATING_VIEW========CP

Method: INIT_CONTROLLER of program CL_WDR_CONTROLLER=============CP

Method: INIT_CONTROLLER of program CL_WDR_VIEW===================CP

Method: INIT of program CL_WDR_CONTROLLER=============CP

Method: GET_VIEW of program CL_WDR_VIEW_MANAGER===========CP

Method: BIND_ROOT of program CL_WDR_VIEW_MANAGER===========CP

Method: INIT of program CL_WDR_VIEW_MANAGER===========CP

Method: INIT_CONTROLLER of program CL_WDR_INTERFACE_VIEW=========CP

Former Member
0 Kudos

Hi,

For that you have to do 2 things .

1) Make the selection property to 0..N while declaring the node.

2) User have to select multiple value by clicking on Control button.

Thanks

Ankesh

Former Member
0 Kudos

Go to st22 Tcode and check for source code for the exat error. It says NULL referecne....

method WDDOINIT .

DATA :alv_prop TYPE REF TO CL_SALV_WD_CONFIG_TABLE,

MULTI TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '04'.

alv_prop->IF_SALV_WD_TABLE_SETTINGS~SET_SELECTION_MODE( MULTI ) .

endmethod.

May be this variable 'alv_prop' refers to nothing.....

You need not declare anything here, just pass the value.

alv_prop->IF_SALV_WD_TABLE_SETTINGS~SET_SELECTION_MODE( '04' ) .

I guess you missed out instantiation of ALV.

In DOINIT, go to wizard, Select the radio button INSTANTIATE component usage(somehting like this) give the select the ALV you have created...and it will generate code for you

Then again go to same wizard, select component usage give the class name as iwci_salv_wd_table and get_model that returns cl_salv_wd_config_table.

Please refer to WD Wikis on the same for the steps.

the code looks somthing like this from code wizard

DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
  DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
  DATA lo_model type ref to cl_salv_wd_config_table.

  lo_cmp_usage =   wd_this->wd_cpuse_alv_emp( ).
  IF lo_cmp_usage->has_active_component( ) IS INITIAL.
    lo_cmp_usage->create_component( ).
  ENDIF.
  
  lo_interfacecontroller =   wd_this->wd_cpifc_alv_emp( ).
  lo_model =  lo_interfacecontroller->get_model( ).
if lo_model is not initial.
lo_model->IF_SALV_WD_TABLE_SETTINGS~SET_SELECTION_MODE( '04' ) .
endif.

Hope this helps.

Former Member
0 Kudos

Hi Raghavendra,

alv_prop is initial. you have to fill the alv_prop with alv model instance.

Thanks,

Srilatha

Former Member
0 Kudos

Hi lekha ji,

Thanks for Your Efforts

Now i'm not getting the error after following your procedure.

But still the records are not being selected even after using ctrl key

ChandraMahajan
Active Contributor
0 Kudos

Check if your Node property Selection is set to 0..n

Thanks,

Chandra

Former Member
0 Kudos

Yes it is already 0..n

Edited by: Raghavendra Reddy.GLN on Oct 19, 2011 11:42 AM

ChandraMahajan
Active Contributor
0 Kudos

Hi,

Refer below code,

DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage,

l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table ,

l_value TYPE REF TO cl_salv_wd_config_table,

lr_table_settings TYPE REF TO if_salv_wd_table_settings.

l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).

IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.

l_ref_cmp_usage->create_component( ).

ENDIF.

l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).

l_value = l_ref_interfacecontroller->get_model( ).

lr_table_settings ?= l_value.

" Setting the ALV selection to multiple selection with no lead selection

lr_table_settings->set_selection_mode( value =

cl_wd_table=>e_selection_mode-multi_no_lead ). "This can be as below. Here it is MULTI_NO_LEAD.

Possible values,

AUTO TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '00', " TableSelectionMode.auto

SINGLE TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '02', " TableSelectionMode.single

MULTI TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '04', " TableSelectionMode.multi

NONE TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '06', " TableSelectionMode.none

SINGLE_NO_LEAD TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '07', " TableSelectionMode.singleNoLead

MULTI_NO_LEAD TYPE WDY_UIE_LIBRARY_ENUM_TYPE VALUE '08', " TableSelectionMode.multiNoLead

Thanks,

Chandra

Former Member
0 Kudos

The customer requirement is to select the rows with out using ctrl key .he should be able to select the rows by clicking on selection buttons.

sahai
Contributor
0 Kudos

hi,

You can achieve it by keeping a row of check-boxes in the alv isplayed...then later youy can easily filter the rows based on the rows selected.

Regards,

Sahai.S

Former Member
0 Kudos

Hi,

Even though the buttons are there for selection but how a user can select only a particular row/s without ctrl Key...

Either when a user clicks on some button you should provide some input for user for selection, as per the user enters either the row nos/serial numbers, then you can set them as selected. But check with client wether user will provide the serial/row numbers that needs to be selected...one more things is you can give a check Box against each lineitem so that user will check only the records for selection, based on which you can do further processing.

With out ctrl key you cannot do mutilple selection unless you provide some other option inaddition to specified above.

Regards,

Lekha.

ChandraMahajan
Active Contributor
0 Kudos

Hi,

if you are convinced that user has to use control key to select mutiple rows then implement it as mentiond in below link,

I hope this will solve your problem.

Thanks,

Chandra

kutjohn
Active Participant
0 Kudos

Hi

See this to select multiple without ctrl

http://scn.sap.com/docs/DOC-41911

ChandraMahajan
Active Contributor
0 Kudos

Hi,

you need to use Control key and then select any rows in any order.

Thanks,

Chandra