How to keep lead selections in alv table...

Hi experts.
I made a alv.
A logic  in wdmodifyview is following..
METHOD wddomodifyview .
  IF first_time EQ abap_true.
    wd_comp_controller->set_alv_config( ).
  ENDIF.
  wd_this->set_maktx( ).  "<- for displaying maktx
ENDMETHOD.
When I want to select a line, do not selected.
I know because of "wd_this->set_maktx( )." sentence.
But I want to select multi lines in above condition...
How to keep selected lines in alv?
Help me please.
Thanks.
Regards.

What logic is taking place in wd_this->set_maktx( )?  It is pretty difficult to say what is causing the issue without knowing what code you are executing?  If you are resetting the context bound to the ALV, that would explain why you are losing your selections.

Similar Messages

  • How to process Line Selection on ALV Table in ABAP WebDynpro

    Hi there,
    I have a view with an ALV table whose context node retrieves its data from a Service Call for a method.
    The method provides certain data of a database table which the ALV displays.
    Now I would like to be able to select one row of that ALV table and after pressing a button or doubleclicking on the row or whatever a different view (as for me it is also ok on the same view) should appear to display the details of that selection.
    I only need to know how to retrieve the selected data.
    Or its index within the internal table.
    I am already looking for hours for a useful thread and actually there is one which obviously is about a similar issue apart from the multiple selection part: 
    How to process multiple row selection in ALV table in Wendynpro ABAP? Help!
    but i am afraid that i don't understand it. Or at least I misunderstand it since it does not work with me.
    The system example mentioned in the thread does not help me either because it somehow does not correspond to my needs, does it?
    It would be GREAT if somebody could help me with that. Please keep it simple for I am not an expert in webdynpro yet (obviously ^^) and also please explain in detail what I have to do with the context nodes since I am not sure whether the selection is stored in my already existing node or whether I need a special one for that.
    Thanks!!
    christina

    Hi Christina,
    If you just want to get one column data of the line that user clicked, use the Web Dynpro Code Wizard to Read Context of attibute you needed, then you will get code as follow:
    * Define data for read attribute
        node_alv TYPE REF TO if_wd_context_node,
        elem_alv TYPE REF TO if_wd_context_element,
        stru_alv TYPE if_view_display=>element_alv ,
        item_column_name  LIKE stru_alv-column_name.
    * navigate from <CONTEXT> to <ALV> via lead selection
      node_alv = wd_context->get_child_node( name = if_view_display=>wdctx_alv ).
    * get element via lead selection
      elem_alv = node_alv->get_element(  ).
    * get single attribute
      elem_alv->get_attribute(
        EXPORTING
          name =  `COLUMN_NAME'
        IMPORTING
          value = item_column_name ).
    The value of column_name is stored in item_column_name.
    If you need the index that the user clicked, try this:
    * Definition of field symbol for index
      FIELD-SYMBOLS : <fs_index> TYPE data.
    * Get the selected index
      ASSIGN r_param->index->* TO <fs_index>.
    The index of clicked line is stored in field symbol <fs_index>.
    Hope it will help.
    Best Regards,
    Stephanie

  • LEAD SELECT on ALV table...

    Hi All,
         I am using ALV table in my application. I am able to display data into ALV table.
         But how to give LEADSELECT event to that ALV table..?
       Can anyone please help me.
       Thanks in Advance.

    Hi,
    In the METHODS tab, give any name and select EVENT HANDLER and for that ALV select the ONLEADSELECT event in the F4 help for events.
    Name                       Method Type              Desc               EVENT                                                                         ALV Name
    ON_LEAD_SELECT Event Handler     On lead     ON_LEAD_SELECT     INTERFACECONTROLLER  ALV_DETAIL_REV
    Regards,
    Lekha.

  • How to include tool bar in alv table?

    Dear All,
        I want to know how to use tool bar in alv table? Is there any seperate interfaces available for it?
    Thanks,
    Gopi.

    Hi,
    1.To deactivate the Standard buttons:
    Data: lr_config_table TYPE REF TO cl_salv_wd_config_table,
    lo_value = lo_interfacecontroller->get_model( ).
    lr_config_table ?= lo_value .
    Wd_this->lr_config_table  ?= lo_value .
      lr_config_table->if_salv_wd_std_functions~set_edit_append_row_allowed( abap_false ).
      lr_config_table->if_salv_wd_std_functions~set_edit_insert_row_allowed( abap_false ).
      lr_config_table->if_salv_wd_std_functions~set_edit_delete_row_allowed( abap_false ).
    2.To create the customized buttons:
    Create the a method initilaze_buttons.
    Data:lv_function_add_record_sap          TYPE REF TO cl_salv_wd_function,
          lv_button_add_record_sap             TYPE REF TO cl_salv_wd_fe_button,
           R_ALV_TABLE_COMP  type ref to CL_SALV_WD_CONFIG_TABLE.
    r_alv_table_comp = wd_this->lr_config_table.
    Generate Function Objects
    lv_function_add_record_sap = wd_this->lr_config_table->if_salv_wd_function_settings~create_function( 'ADD_RECORD_SAP' ).
    Generate Buttons
      CREATE OBJECT lv_button_add_record_sap.
      lv_button_add_record_sap->set_image_source( 'ICON_INSERT_ROW' ).
    lv_button_add_record_sap->set_text( 'Add Record' ).
    Assign Buttons to Functions
    lv_function_add_record_sap->set_editor( lv_button_add_record_sap ).
    Set positions of the buttons
      lv_function_add_record_sap->set_position( value = 1 ).
    Set Alignment of the buttons
    lv_function_add_record_sap->set_alignment( value = if_salv_wd_c_function_settings=>align_left ).
    Call this method initilaze_buttons in WDDOINIT .
    3.To find out which button is clicked an dhandling that function
    A)Go to methods tab.
    B)give the name of the method as on_button select the method type as Eventhandler.
    In the event coulmn select the event ON_FUNCTION of the ALV comp.
    METHOD on_button .
      DATA index  TYPE i.
      index = wd_this->sort_index .
      CASE r_param->id."r_param->id is importing paramter which comes automatically once u use the event handler
        WHEN 'DELETE_ROW'.  "Delete row
          wd_this->delete_row( )."methods you need to create and call them here.(your own customized button functionality
        WHEN 'ADD_RECORD_SAP'.
          wd_this->add_record_sap( ).
    ENDCASE.
    r_param->id holds the value which button is clicked.
    Priya

  • How to do a SELECT from different tables into an internal table?

    How to do a SELECT from different tables into an internal table?
    I want to select data from MARA, MARC and ZPERSON and populate my ITAB_FINAL
    REPORT  zinternal_table.
    TABLES:
      mara,
      marc,
      zperson.
    TYPES:
    BEGIN OF str_table1,
      v_name LIKE zperson-zname,
      v_matnr LIKE marc-matnr,
      v_emarc LIKE marc-emarc,
      v_werks_d LIKE marc-werks_d,
      v_dstat LIKE marc-dstat,
      END OF str_table,
      i_table1 TYPE STANDARD TABLE OF str_table1.
    DATA:
    BEGIN OF str_table2,
    v_mandt LIKE mara-mandt,
    v_ernam LIKE mara-ernam,
      v_laeda LIKE mara-laeda,
    END OF str_table2,
    itab_final LIKE STANDARD TABLE OF str_table2.

    first find the link between mara , marc and zperson , if u have link to 3 tables then u can jus write a join and populate the table u want ( thats final table with all the fields).
    u defenitely have alink between mara and marc so join them and retrieve all data into one internal table.
    then for all the entries in that internal table retrieve data from zperson into another internal table.
    then loop at one internal table
    read another internal table where key equals in both the tables.
    finally assign fileds if sy-subrc = 0.
    gs_finaltable-matnr = gs_table-matnr
    etc...
    and finally append gs_finaltable to gt_finaltable.
    there u go ur final table has all the data u want.
    regards
    Edited by: BrightSide on Apr 2, 2009 3:49 PM

  • Capture multiple rows on lead select in ALV Web dynpro

    Hi all,
    I am trying to capture the selected rows on lead select in ALV.
    I have tried with supply function and ON_LEAD_SELECT event of ALV.
    When I am trying this I am able to capture only one row but not multiple.
    I don't want use any extra actions or buttons to get the selected rows, it must be possible only through any ALV events or using supply function.
    BR,
    Eshwar

    Hi,
    You use this to set to on_select?
    DATA:
         lo_config_table        TYPE REF TO cl_salv_wd_config_table.
       lo_config_table->if_salv_wd_table_settings~set_on_select_enabled( ).
    And in the component controller create a new method for event_handler
    This method will executed
    Hope this works
    Maarten

  • How to display lead selection ONLY in the ALV

    HI All,
       User would like display the selected records in ALV . 
       i suggested that add two button - "Display ALL" & "Display Selected" .
       How can i only display the lead selection only in the ALV? or Hide un-selected records.
       Please help.
    Thank you so much
    Gordon

    Hi,
    Pelase have a look.. same requirement.
    get_selected_elements method for ALV
    Re: select rows in alv and show them in another alv in another view
    Web dynpro ALV table copy selected row
    cheers,
    Kris.

  • How to remove lead selection in table dynamically

    I have a table in webdynpro which allows multiple selections of row. I have a button which is supposed to be clicked after selecting single or multiple rows. After clicking on the button I want to remove the lead selection of the  selected rows (which is shown in golden color for each selected row) .
    I tried REMOVE_SELECTED ELEMENTS and it works fine but only if i select the row by pressing CTRL. If i had selected a single row by just a mouse click (without ctrl) then it wont work.
    THANKS

    Hallo Amber,
    If_wd_context_node has static attribute no_selection. use that to clear the lead_selection_index.
    node->set-lead_selection_index(  if_wd_context_node=>no_selection ).

  • How to write lead selection method for a  tree by nesting table column

    Hi,
    I have implemented a table with TreeByNestingTableColumn(To show the tree structure in the table).I am not able to get the selected row element in lead selection method.(I am able to get parent element.) .
    could anyone please tell me about this code?
    BR,
    Ashish

    Hi,
    Follow the below steps to the solution for your problem
    1. Create Action "LeadSelection" in View with parameter (name : 'seletedItem'
    and type : I<your node>Element
    2. Bind this action to Table property "onLeadSelec"
    3. In wdModify()
         IWDTable table = (IWDTable) view.getElement("Your table id");
         table.mappingOfOnLeadSelect().addSourceMapping("nodeElement", "selectedEle");
    4. In onActionLeadSelection()
         wdComponentAPI.getMessageManager().reportSuccess("Selected Item : "+selectedEle.get<Your Node Attribute>());
    Let me know if you need more clarification
    Thanks

  • TreeByNestingTableColumn - how to set lead selection?

    Hallo Guys!
    I am using TreeByNestingTableColumn in my project. I am searching for a way to select a certain context element inside of the tree shown in such a table. I actually know that setLeadSelection doesn’t work properly in such a case.
    I’ve already read this very helpful blog /people/valery.silaev/blog/2005/06/20/master-of-columns-part-ii searching for a solution, but its seemed not to be there.
    Valery had shown how to read the selected context element recursively, but there is nothing about to how to set the needed lead selection for a certain one.
    In my scenario, I am loading the whole table (10-15 elements) with only two levels of hierarchy. After the user clicks on a button I have to reload this table but keep the selection of the previously selected element.
    The try using getTreeSelection didn’t succeed either.
    Any ideas?
    Many Thanks
    Dimitri
    Edited by: Dmytro Lubenskyy on Apr 1, 2008 3:44 PM

    Hi,
    You can use the following methods to set the selection.
    IWDNodeElement nodeElement = wdContext.nodeOrders().getElementAt(2);
           wdContext.nodeOrders().setTreeSelection(nodeElement);
    Regards
    Ayyapparaj

  • How to get one column of ALV table as dropdown by key.

    Hi experts,
                  How can I get one column of ALV table as dropdown and editable. If  user wants to change that column value he can just select from that dropdown and click on update button. Can I provide tool tip to that column as " Select from drop down to change the status "?
      Please Help.
    Thanks,
      Pratibha

    You just need to change the cell editor of that column in ALV.
    So first get access to the alv model object (adjusting the code below for your ALV Component Usage name - mine was ALV_ADV):
    DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
      l_ref_cmp_usage =   wd_this->wd_cpuse_alv_adv( ).
      IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
        l_ref_cmp_usage->create_component( ).
      ENDIF.
      DATA l_salv_wd_table TYPE REF TO iwci_salv_wd_table.
      l_salv_wd_table = wd_this->wd_cpifc_alv_adv( ).
      DATA l_table TYPE REF TO cl_salv_wd_config_table.
      l_table = l_salv_wd_table->get_model( ).
    Then access the column object you want to change:
    DATA l_column TYPE REF TO cl_salv_wd_column.
      l_column = l_table->if_salv_wd_column_settings~get_column( 'REGION' ).
    Then create the cell editor for DDLB and set it as the new cell editor for this column:
    DATA ddlb TYPE REF TO cl_salv_wd_uie_dropdown_by_key.
      create object ddlb
        exporting
          selected_key_fieldname = 'REGION'.
      ddlb->set_tooltip( `Select from drop down to change the status` ).
      l_column->set_cell_editor( ddlb ).

  • Lead selection in ALV grid

    Hi.
    I am usinmg Set_table_for_first_display to display the ALV grid.
    In my ALV grid, I have a field as Flag which will show as a lead selection in the grid. Such that I have designed the field catelog and layout.
    When I select a row and click on DISPLAY button, it has to display the details.
    This I am able to do through GR_GRID->GET_SELECTED_ROWS() .
    But after displaying the data the cursor is not in the same row. Lead selection is cleared.
    I manually tied to set the FLag as X and updated the table. Even then Lead selection is not coming in the row.
    Suggestion  is very much helpul for this.
    Thanks,
    Sumithra

    DOne by using Set_selected_rows method

  • Opening a new window on lead select in a table

    Hi,
      I want to open a window on Lead Select ...i have written the below code in the ActionLeadSelect
    ************************Begin Code******************************************************
    message.reportSuccess("came inside LeadSelect");
    IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow("www.yahoo.com","",false);
    message.reportSuccess("came 1");
    window.open();
    message.reportSuccess("came 2");
    ***************************end code********************************************************
    but On selecting a particular row in a table , window is not being opened..but the message I gave are displayed .Can u gimme  a solution
    Thanks,
    Shiny

    Hi, 
         It helped abijeet.Pop Up window is  opened.
    Now, I also tried opening another pop up window. I created a view called 'PopUp'. now.On selecting a row in the table I want to open this window(PopUp) .I tried the below code:
    IWDWindowInfo wInfo =wdComponentAPI.getComponentInfo().findInWindows("PopUp");
        IWDWindow window   =  wdComponentAPI.getWindowManager().createModalWindow(wInfo);
    message.reportSuccess("came 1");
    window.show();
    message.reportSuccess("came 2");
    window.setWindowPosition(WDWindowPos.CENTER);
    window.setWindowSize(100, 100);
    message.reportSuccess("came 3");
    I get the below  exception on executing:
    com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Parameter windowInfo must not be null.
    what else should i set. Can u gimme a solution??
    Thanks,
    Shiny

  • How to remove a column from alv table

    Hi All
    How to remove a specific column from alv table.?
    Thanks & Regards
    SUN

    For delete u can follow the above post..
    Fo making invisible :
    data m_col type ref to cl_salv_wd_column.
    m_col = alv_mode->IF_SALV_WD_COLUMN_SETTINGS->GET_COLUMN (' col1' ).
    m_col->SET_VISIBILITY( '01'  ).

  • How to unhide the column in Alv table

    Hi Experts,
        Initially i have created webdynpro Alv table with 8 columns ,later i have added one more attribute/column to the node to display extra column
    but in the output ,alv table not displaying the 9th column,Instead the column is getting hidden which i came to know clicking on settings in alv table output.If i make changes in Alv table settings it getting displaying,can anyone tell me how to unhide this field.
    Regards
    Sandesh

    Hi Sandesh,
         It is possible that the user you are loggin in with, might have a layout saved.
    You can try logging in with different user and see if its still hidden.
    The explicit code to hide and unhide a column :
    lo_alv_column->set_visible( if_wdl_core=>visibility_none ).
    may be  you can use the above code and make column visibility true(cahnge parameter).
    Regards,
    Tashi

Maybe you are looking for