Select Multiple Rows in a Table without CTRL

Expecting the user to press "Ctrl" when selecting multple rows is very unfriendly and unintuitive. We'd like the row selection to work as in ALV where you just select multiple rows by clicking on them.
We've set the tables rowSelectable to true and selectionMode to 'multi' but we still cannot select multiple rows without the CTRL hotkey.
This issue apparently [arose before|About selection in the table] but wasn't resolved.
System Details
SAP_ABA     701     0006     SAPKA70106
SAP_BASIS     701     0006     SAPKB70106
SAP_AP     700     0019     SAPKNA7019

Hello Marc,
you need to call IF_WD_CONTEXT_NODE->set_selected(index = lv_index) sorry for the typo in my previous comment.
by calling IF_WD_CONTEXT_NODE->set_selected method wont remove the lead selection.
to unselect the records, you can call the same method by passing the FLAG value as abap_false.
so for your usecase the logic will be like this in the ON_SELECT event handler
1. get the index of the new_lead_selection
2. check whether this is already seleted in the context node by calling IF_WD_CONTEXT_NODE->IS_selected
3. if already selected then call IF_WD_CONTEXT_NODE->set_selected( flag = abap_false index = lv_index)
   if not selected then call IF_WD_CONTEXT_NODE->set_selected( index = lv_index )
Hope this solved your problem.
BR, Saravanan
Edited by: Saraa_n on Jul 6, 2011 11:52 AM

Similar Messages

  • Selecting multiple rows in a table

    Hi All,
    I have one problem with selecting multiple rows in a table.I tried with setting table property-selectionMode as Multi, but i dinn't get the solution.
    please provide me solution for this.
    Thanks & Regards,
    Sreelakshmi.

    HI
    Int leadSelection = wdcontext.nodemodelnode.getLeadSelection();
      for(int i=0;i<wdcontext.nodeModelNode.size;i++)
        if(wdcontext.nodeModelNode.isMultiselected(i) || leadSelection ==i)
               String name = wdcontext.nodemodelnode.getnameelementatindex(i).getName();
               String  address = wdcontext.nodemodelnode.getaddresselementatindex(i).getAddress();
               String age = wdcontext.nodemodelnode.getAgeelementatindex(i).getAge();
            Create a method for the Table Property onLeadSelect() where you can open a popup window
             Create a value node and with attributes same as Table attributes and then set the values of the table
             to the value node attributes.
    Thanks

  • Select multiple rows from dual table

    Is it possible to select multiple rows from dual table using a single select statement.
    i.e., i want the out put to be
    column_name
    1
    2
    3
    4
    Edited by: vidya.ramachandra on Dec 14, 2009 8:24 AM

    Aside from the fact you're responding to an old thread...
    1002424 wrote:
    While using CONNECT BY, I see it always leave behind one row.
    Suppose I have a condition based on which I have to generate constant rows like
    SELECT 1 FROM DUAL WHERE ROWNUM < N;
    Here if N = 0, still it gives out single row.... you are obviously doing something wrong in your code elsewhere, because that SQL statement does not always return a single row...
    SQL> SELECT 1 FROM DUAL WHERE ROWNUM < 0;
    no rows selected
    SQL>

  • Selecting multiple rows of a table

    Hi Forum,
    How to select multiple rows of a table at a time? Please help me..
    Thanks
    Swapna

    Hi Swapna,
    To select more then one row in table, just set the selectionmode property of table to 'multi' or 'auto' and also change the selection property of the node (to which table is binded) to  0:n.
    I hope it helps.
    Regards
    Arjun
    Edited by: Arjun on Feb 4, 2009 11:52 AM

  • Select multiple row in a table that are not connected

    I want to be able to select multiple rows, but want to be able to select rows that are not next to each other. They maybe have one or two rows between. Is there anyway to do this in a table?
    Thanks

    So do a lot of other people, but you can’t.
    Tell Adobe here: https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
    Bob

  • IlleagalAurgumentException while selecting  multiple rows in  a table

    hi
    i am facing the problem with the adfTable selection.when i select more number of rows or selecting the rows fastly some time key set becomes null and also giving IlleagalAurgument Exception. i am giving the code i am using below
    List tableData=(List)table1.getValue();
    Iterator it=table1.getSelectedRowKeys().iterator();
    while(it.hasNext()) {
    Integer keyStr =(Integer) it.next();
    System.out.println(" selected key ===="+keyStr);
    if(keyStr!=null)
    selectedList.add((FinalCurriculumStrands)tableData.get(keyStr));
    keystr should not become null when there are selected rows.but it is coming as null.because keystr is null i am unable recover selected rows.please give me the solution.

    duplicate: af:adfTable Selection issue

  • Reg Selection of  Multiple Rows in a Table

    Hi all,
    I have to select multiple rows from a table and have to display those selected records in another table in the next screen.
    The problem is, when I am selecting the records in a table, selection should not be allowed on some records based on a condition. Is it possible with the default selection mode of webdynpro. If so, Please tell me how can we disable the selection of certain records in a table(using the default selection mode provided by webdynpro)
    Else, if we have to use check boxes for selection(in case of my problem), please do help me out in how to disable the selection of certain records in a table(using check boxes for selection).
    Please help me out. Its urgent...
    Reward points guranteed.
    Regards,
    Murthy.

    HI Narayana,
    Multiple selection  property is specific to a table, not for a tableElment(ie. for a row), so u cant set some of the rows as multi selected and some as node
    U can use Checkbox for this purpose. Based on the condition u can make the check box as enabled and disabled
    To achieve this, Create 2 boolean variables inside table node, one for checkbox value(Let it be <b>CBValue</b> .Bind this to checked property of Checkbox) and other for enabling and disabling Checkbox(Let it be <b>CBReadOnly</b>. Bind this to readonly property of CheckBox).
    At the time of creation of table elements, as per the condition, u can control the selection as
    IPrivate<View>.I<Table>Node tNode=wdContext.node<Table>();
    for(int i=0;i<5;i++)
    IPrivate<View>.I<Table>Element tEl=tNode.create<Table>Element();
    tNode.addElement(tEl);
    tEl.setCBValue(false);//Unchecking Checkboxes initially
    if(condition=non selectable)
      tEl.setCBReadOnly(true);
    else
      tEl.setCBReadOnly(false)
    Regards
    Fahad Hamsa

  • How to select multiple row of table using check box?

    hi,
             i am having table on view having first field as checkbox. what i want, when i click on checkboxes in multiple rows, and i click on any button i need to use those content to next view...
              my problem is if i select only one row , i can use onlead select property of table..but when i select multiple rows  through check box how should i read contents of table....?
    Plz solve it.
    Thanks,
    Saurin Shah

    Hello Saurin,
    You are right using LeadSelection you can select only 1 row at a time. You will have to make use of Selection for achieving this. First you will have to change the selection mode of the table to multiple & also change the selection property for the related context to 0..n . Please find a code extract which might help you. (However this facility is only available from SP 14.) The main part is using the set_selected method of if_wd_context_node.
    data: node_zcourse_details type ref to if_wd_context_node,
             node_course_assign type ref to if_wd_context_node,
             elem_course_assign type ref to if_wd_context_element,
             stru_course_assign type if_v_details=>element_course_assign ,
             item_popin_selected like stru_course_assign-popin_selected.
    "     navigate from <CONTEXT> to <ZCOURSE_DETAILS> via lead selection
    node_zcourse_details = wd_context->get_child_node( name = if_v_details=>wdctx_zcourse_details ).
    "     navigate from <ZCOURSE_DETAILS> to <COURSE_ASSIGN> via lead selection
    node_course_assign = node_zcourse_details->get_child_node( name = if_v_details=>wdctx_course_assign ).
    "     @TODO handle not set lead selection
    if ( node_course_assign is initial ).
    exit.
    endif.
    data elem_set type wdr_context_element_set.
    field-symbols <wa_elem> like line of elem_set.
    elem_set = node_course_assign->get_elements( ).
    loop at elem_set assigning <wa_elem>.
       <wa_elem>->set_selected( TRUE OR FALSE ). " Supply either TRUE/FALSE in here
    endloop.

  • Selecting Multiple rows in an ALV

    Hi Experts,
    Using 'REUSE_ALV_GRID_DISPLAY' is it possible to select multiple rows, WITHOUT using CTRL OR SHIFT keys ?
    thanks in advance.

    I have done an application for multiple selection in ALV using check box concept. Please find that code below.
    *& Report  ZATL_DELIVERY
    REPORT  zatl_delivery.
    INCLUDE zatl_delivery_declarations.
    SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
    SELECT-OPTIONS:  s_vbeln FOR vbak-vbeln OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK a.
    INITIALIZATION.
    AT SELECTION-SCREEN.
    START-OF-SELECTION .
    SET PF-STATUS 'ABC'.
    SET PF-STATUS 'BCD'.
    get the sales order numbers thru given
    selection-screen parameters
      SELECT vbeln FROM vbak INTO TABLE it_data
              WHERE vbeln IN s_vbeln.
              AND  ERDAT = P_DATE.
      IF NOT it_data[] IS INITIAL.
        SELECT vbeln vstel FROM vbap INTO TABLE it_vstel
                 FOR ALL ENTRIES IN it_data
                   WHERE vbeln = it_data-vbeln.
      ENDIF.
      LOOP AT it_data INTO wa_data.
        CALL FUNCTION 'ZBAPI_GET_MATERIAL_PLANT_DTL'
          EXPORTING
            v_vbeln = wa_data-vbeln
          TABLES
            it_bapi = it_result.
        LOOP AT it_result INTO wa_result.
          READ TABLE it_vstel INTO wa_vstel WITH KEY
                           vbeln = wa_result-vbeln.
          wa_final-vbeln = wa_result-vbeln. " SALES ORDER NO
          wa_final-matnr = wa_result-matnr.
          wa_final-vstel = wa_vstel-vstel.
          wa_final-werks = wa_result-werks.
          wa_final-labst = wa_result-kwmeng.
          APPEND wa_final TO it_final.
          CLEAR wa_result.
        ENDLOOP.
        REFRESH it_result.
        CLEAR wa_data.
      ENDLOOP.
      PERFORM build_fldcat.
      PERFORM disp_output.
    *SET PF-STATUS 'ABC'.
    *&      Form  ABC
          text
         -->EXTAB      text
    FORM abc USING extab TYPE slis_t_extab.
      SET PF-STATUS 'ABC'. " excluding extab.
    ENDFORM.                    "ABC
    read
    *&      Form  build_fldcat
          text
    -->  p1        text
    <--  p2        text
    FORM build_fldcat .
      wa_fldcat-col_pos = '1'.
      wa_fldcat-fieldname = 'MARK'.
      wa_fldcat-checkbox = 'X'.
      wa_fldcat-edit = 'X'.
      wa_fldcat-seltext_m     = 'MARK'.
      APPEND wa_fldcat TO i_fldcat.
      CLEAR wa_fldcat.
      wa_fldcat-col_pos = '2'.
      wa_fldcat-fieldname = 'VBELN'.
      wa_fldcat-tabname = 'IT_FINAL'.
      wa_fldcat-seltext_m     = 'SALES ORD NO'.
      APPEND wa_fldcat TO i_fldcat.
      wa_fldcat-col_pos = '3'.
      wa_fldcat-fieldname = 'MATNR'.
      wa_fldcat-tabname = 'IT_FINAL'.
      wa_fldcat-seltext_m     = 'MAT NO'.
      APPEND wa_fldcat TO i_fldcat.
      wa_fldcat-col_pos = '4'.
      wa_fldcat-fieldname = 'WERKS'.
      wa_fldcat-tabname = 'IT_FINAL'.
      wa_fldcat-seltext_m     = 'PLANT'.
      APPEND wa_fldcat TO i_fldcat.
      wa_fldcat-col_pos = '5'.
      wa_fldcat-fieldname = 'LABST'.
      wa_fldcat-tabname = 'IT_FINAL'.
      wa_fldcat-seltext_m     = 'QNTY'.
      APPEND wa_fldcat TO i_fldcat.
    ENDFORM.                    " build_fldcat
    *&      Form  disp_output
          text
    -->  p1        text
    <--  p2        text
    FORM disp_output .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_callback_pf_status_set = 'ABC'
          it_fieldcat              = i_fldcat
          i_callback_user_command  = 'CHECKED'
        TABLES
          t_outtab                 = it_final
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " disp_output
    *&      Form  CHECKED
          text
         -->R_UCOMM      text
         -->RS_SELFIELD  text
    FORM checked USING r_ucomm LIKE sy-ucomm
                  rs_selfield TYPE slis_selfield.
      DATA: gd_repid LIKE sy-repid, "Exists
      ref_grid TYPE REF TO cl_gui_alv_grid.
      IF ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = ref_grid.
      ENDIF.
      IF NOT ref_grid IS INITIAL.
        CALL METHOD ref_grid->check_changed_data .
      ENDIF.
      CASE r_ucomm.
        WHEN 'DELIVERY'.
          IF rs_selfield-fieldname = 'MARK'.
            DATA : date_external(10) TYPE c.
            DATA: temp_date TYPE sy-datum.
            temp_date = sy-datum.
            temp_date = temp_date + 1.
            CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
              EXPORTING
                date_internal            = sy-datum
              IMPORTING
                date_external            = date_external
              EXCEPTIONS
                date_internal_is_invalid = 1
                OTHERS                   = 2.
            LOOP AT it_final INTO wa_final WHERE mark EQ 'X'.
              PERFORM bdc_dynpro      USING 'SAPMV50A' '0100'.
              PERFORM bdc_field       USING 'BDC_CURSOR'
                                            'LV50C-VBELN'.
              PERFORM bdc_field       USING 'BDC_OKCODE'
                                            '/00'.
              PERFORM bdc_field       USING 'LIKP-VSTEL'
                                            wa_final-vstel. " 'HLL'.
              PERFORM bdc_field       USING 'LV50C-DATBI'
                                            date_external. "
              PERFORM bdc_field       USING 'LV50C-VBELN'
                                            wa_final-vbeln.     " '34'.
              PERFORM bdc_dynpro      USING 'SAPMV50A' '0200'.
              PERFORM bdc_field       USING 'BDC_CURSOR'
                                            'LIPS-MATNR(02)'.
              PERFORM bdc_field       USING 'BDC_OKCODE'
                                            '=SICH'.
              PERFORM bdc_field       USING 'LIKP-BLDAT'
                                            date_external. " '19.09.2008'.
                CLEAR date_external.
              CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
                EXPORTING
                  date_internal            = temp_date
                IMPORTING
                  date_external            = date_external
                EXCEPTIONS
                  date_internal_is_invalid = 1
                  OTHERS                   = 2.
              PERFORM bdc_field       USING 'LIKP-WADAT'
                                            date_external ." '19.09.2008'.
                CLEAR date_external.
              PERFORM bdc_field       USING 'LIKP-BTGEW'
                                            wa_final-labst.     " -'12'.
              PERFORM bdc_field       USING 'LIKP-GEWEI'
                                            'wa_likp-GEWEI'.
              PERFORM bdc_transaction USING 'VL01'.
              PERFORM msg_get  TABLES it_msg.
              CLEAR wa_final.
              REFRESH it_msg.
            ENDLOOP.
            PERFORM disp_msg.
          ENDIF.
      ENDCASE.
    ENDFORM.                    "CHECKED
    *&      Form  BDC_DYNPRO
          text
         -->P_0443   text
         -->P_0444   text
    FORM bdc_dynpro  USING    value(p_0443)
                              value(p_0444).
      wa_bdc-program = p_0443.
      wa_bdc-dynpro =  p_0444.
      wa_bdc-dynbegin = 'X'.
      APPEND wa_bdc TO it_bdc.
      CLEAR wa_bdc.
    ENDFORM.                    " BDC_DYNPRO
    *&      Form  BDC_FIELD
          text
         -->P_0448   text
         -->P_0449   text
    FORM bdc_field  USING    value(p_0448)
                             value(p_0449).
      wa_bdc-fnam = p_0448.
      wa_bdc-fval =  p_0449.
      APPEND wa_bdc TO it_bdc.
      CLEAR wa_bdc.
    ENDFORM.                    " BDC_FIELD
    *&      Form  BDC_TRANSACTION
          text
         -->P_0508   text
    FORM bdc_transaction  USING    value(p_0508).
      CALL TRANSACTION p_0508 USING it_bdc
                           MODE 'N'
                           UPDATE 'S'
                           MESSAGES INTO it_msg.
    ENDFORM.                    " BDC_TRANSACTION
    *&      Form  msg_get
          text
         -->P_IT_MSG  text
    FORM msg_get  TABLES   p_it_msg STRUCTURE bdcmsgcoll.
      LOOP AT p_it_msg INTO wa_msg.
        v_msgid = wa_msg-msgid.
        v_msgnr = wa_msg-msgnr.
        v_msgv1 = wa_msg-msgv1.
        v_msgv2 = wa_msg-msgv2.
        v_msgv3 = wa_msg-msgv3.
        v_msgv4 = wa_msg-msgv4.
        IF wa_msg-msgtyp = 'E' OR
           wa_msg-msgtyp = 'A' OR
           wa_msg-msgtyp = 'X'.
          PERFORM build_msg USING v_msgid
                            v_msgnr
                            v_msgv1
                            v_msgv2
                            v_msgv3
                            v_msgv4
                      CHANGING msg_text_e.
      Build the text for successful records getting created
        ELSEIF wa_msg-msgtyp = 'S' OR
               wa_msg-msgtyp = 'W' OR
               wa_msg-msgtyp = 'I'.
          PERFORM build_msg USING v_msgid
                                  v_msgnr
                                  v_msgv1
                                  v_msgv2
                                  v_msgv3
                                  v_msgv4
                             CHANGING msg_text_s.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " msg_get
    *&      Form  build_msg
          text
         -->P_V_MSGID  text
         -->P_V_MSGNR  text
         -->P_V_MSGV1  text
         -->P_V_MSGV2  text
         -->P_V_MSGV3  text
         -->P_V_MSGV4  text
         <--P_MSG_TEXT_E  text
    FORM build_msg  USING    p_v_msgid
                             p_v_msgnr
                             p_v_msgv1
                             p_v_msgv2
                             p_v_msgv3
                             p_v_msgv4
                    CHANGING p_msg_text_s.
      CALL FUNCTION 'TB_MESSAGE_BUILD_TEXT'
        EXPORTING
          langu = sy-langu
          msgid = p_v_msgid
          msgno = p_v_msgnr " wa_msgcoll-msgnr
          msgv1 = p_v_msgv1
          msgv2 = p_v_msgv2
          msgv3 = p_v_msgv3
          msgv4 = p_v_msgv4
        IMPORTING
          text  = p_msg_text_s.
      wa_mess-v_msg = p_msg_text_s .
      APPEND wa_mess TO i_mess.
      CLEAR wa_mess.
    ENDFORM.                    " build_msg
    *&      Form  disp_msg
          text
    -->  p1        text
    <--  p2        text
    FORM disp_msg .
      PERFORM build_fieldcat_secandary.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_callback_pf_status_set = 'BCD'
          it_fieldcat              = i_fldcat1
          i_callback_user_command  = 'SECANDARY'
        TABLES
          t_outtab                 = i_mess
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " disp_msg
    *&      Form  build_fieldcat_secandary
          text
    -->  p1        text
    <--  p2        text
    FORM build_fieldcat_secandary .
      wa_fldcat1-col_pos = '1'.
      wa_fldcat1-fieldname = 'V_MSG'.
      wa_fldcat1-tabname = 'I_MESS'.
      wa_fldcat1-seltext_m     = 'MESSAGE'.
      APPEND wa_fldcat1 TO i_fldcat1.
    ENDFORM.                    " build_fieldcat_secandary
    *&      Form  SECANDARY
          text
         -->R_UCOMM    text
    FORM secandary USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN 'BCK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDFORM.                    "SECANDARY
    *&      Form  ABC
          text
         -->EXTAB      text
    FORM bcd USING extab TYPE slis_t_extab.
      SET PF-STATUS 'BCD'. " excluding extab.
    ENDFORM.                    "ABC
    Hope this will help you,
    Murthy.

  • Inserting Multiple Rows in a table

    Hello,
    I need to insert multiple rows in a table with the selected items from a list (Multiple select).
    How do i go about it. I'm using ADF-struts-UIX application on Jdeveloper 9.0.5.2
    Thanks.

    Jonas, I've downloaded the sample application from your ADF UIX Editable table tip but have some problems.
    I can't even open the emp.table.uix file - errors are:
    Parsing error. Unable to parse binding.
    javax.servlet.jst.el.ELException:Function ctrl:createSortableHeaderModel was not found.
    and
    javax.servlet.jst.el.ELException:Function ctrl:getSortOrder was not found.
    Also - is there a place in the sample where you define the sample tables? They do not seem to match the standard sample emp table, for instance.
    I've just started using JDeveloper and would like to use the solution.
    Thanks - Linda

  • Selecting multiple rows in JTable

    Hi
    I wonder if it is possible to select multiple rows in a JTable. I have written the following:
            table.setRowSelectionAllowed(true);
            table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);However, when I select a second row, my first selected row unselects. I have to shift-click manually to select both rows. Is there a way around this (ie. without the shift-click part)?

    Well I have done that without finding anything... can you provide a link?

  • Dragging multiple rows in JTable - MUST use CTRL, or not?

    Hello all!
    I'm writing an app that needs to be able to drag multiple rows from a JTable. I have seen that I can do this by selecting multiple rows with the LEFT mouse button, while holding down the CTRL key, and then dragging (again, with the left mouse button).
    The problem is, since I'm holding down the CTRL key, this comes across as a DnDConstants.ACTION_COPY.
    I find that if I do multiple selection, then drag with the RIGHT mouse button (no CTRL key held down), then I get a DnDConstants.ACTION_MOVE, as I want.
    My question: Is there any simple way to enable dragging multiple JTable rows, using the LEFT mouse button, but WITHOUT holding down the CTRL key?
    I have been tasked with "making it act like Windows", which doesn't undo a multiple-selection when one clicks on an existing selected row until one lets go of the left mouse button; whereas JTables appear to change the selection to the clicked-upon row immediately, even if it is part of the existing selection.
    Any ways around this anyone knows, short of modifying the JTable or BasicTableUI itself?
    - Tim

    By the way, I just tested this assumption of mine, and found I was wrong if you're using default JTable drag and drop.
    However, I'm using my own implementation. I notice in a simple program without any drag and drop, I get the behavior I mentioned above, so I'm guessing this IS default JTable behavior, which is then modified by the built-in drag and drop support.
    So the trick will be, how to do what built-in drag and drop is doing, without using built-in drag and drop. :-)
    - Tim

  • How to select multiple rows from List Of Values

    Hello,
    I use ADF 11g to create my list of values (LOV). I want to select multiple rows from it. but i can't.
    so how i can select many rows to set them in my adf table.
    Thank in advance

    Hi,
    LOV is map to an attribute in the viewObject so it will return only one value or more values from selected row. You can't select multiple rows from LOV.
    But you can do this by using popup which you can select multiple rows and insert the selected rows to another table.
    This blog post explain how to achieve this :
    http://husaindalal.blogspot.com/2009/11/search-from-popup-and-add-to-new-table.html#comments
    Sameh Nassar

  • Update row in a table based on join on multiple rows in another table

    I am using SQL Server 2005. I have the following update query which is not working as desired.
    UPDATE DocPlant
    SET DocHistory = DocHistory + CONVERT(VARCHAR(20), PA.ActionDate, 100) + ' - ' + PA.ActionLog + '. '
    FROM PlantDoc PD INNER JOIN PlantAction PA on PD.DocID = PA.DocID AND PD.PlantID = PA.PlantID 
    For each DocID and PlantID in PlantDoc table there are multiple rows in PlantAction table. I would like to concatenate ActionDate and ActionLog information into DocHistory column of DocPlant table. But the above update query is considering only one row from
    PlantAction table even though there are multiple rows that match with DocID and PlantID.
    DocHistory column is of type NVARCHAR(MAX).
    How do I fix my query to achieve what I want ? Thanks for the help.

    UPDATE DocPlant
    SET DocHistory = DocHistory + CONVERT(VARCHAR(20), PA.ActionDate, 100) + ' - ' + PA.ActionLog + '. '
    FROM PlantDoc PD INNER JOIN PlantAction PA on PD.DocID = PA.DocID AND PD.PlantID = PA.PlantID 
    We do not use the old Sybase UPDATE..FROM.. syntax. Google it and learn how it does not work. We do not use the old Sybase CONVERT() string function. You are still writing 1950's COBOL with string dates instead of temeproal data types. 
    You also did not post DDL, so we have to guess about everything. Does your boss make you work without DDL? How do you do it? 
    >> For each DocID and PlantID in PlantDoc table there are multiple rows in PlantAction [singular name?] table. I would like to concatenate ActionDate and ActionLog information into DocHistory column of DocPlant table. <<
    Why? What does this new data element mean? This is like dividing Thursday by Red and expecting a reasonable answer. Now, non-SQL programmers who are still writing COBOL will violate the tiered architecture rule about doing display formatting in the database.
    If you will follow forum rules, we can help you. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Get Multiple Rows into internal Table using Webdynpro Alv Display ..

    Hi guys ,
    I need to find out the logic for getting all the selected rows into the internal table.
    When i display the ALV Output on webdypro screen .
    USer Selects multiple rows for further processing ..
    Ineed to get all the rows selected by user into an internal table .
    Please let me know how to achive this ...
    Thanks in advance for quick reply
    Regards
    Saurabh Goel

    Hi,
    You need to use the method GET_SELECTED of IF_WD_CONTEXT_NODE to get the rows selected. Also ccheck for the paramters of that method, this retruns the element set.
    This meets your requirement.
    Regards,
    Lekha.

Maybe you are looking for

  • Is Windows 8.1 (Full Version) the appropriate item to buy?

    Is Windows 8.1 (Full Version) the right version to buy in order to install it via bootcamp?

  • Lost all my notes - how can I get them back

    So after getting frustrated with my notes duplicating on my mac (and only on mac) I searched on here to get it to stop and came across this solution: entering 'rm -rf ~/Library/Containers/com.apple.Notes.' into terminal - I tried this and it didn't w

  • Is it possible to call a java method from servlet

    Hi All, I am trying to import a java class to my servlet and call a method of that class, is this possible. I am getting an error while importing the class. I am using tomcat, have put my class files in th path \WEB-INF\classes\com\kiran My java goes

  • Network streams vs shared variables

    I send data from a PXI RT System to users on different Windows computers via Shared Variable and Network Stream.  The user that receives the data via Network Stream writes the data to a disk file (aka DAQ computer).  The users that receive the data v

  • How to avoid Huge scan with case condition in the select statement.

    Hi , I have the below sql and add condition such that c.ROLE = 18 then tibex_fixrestorestateview needs to be queried else it should not query the tibex_fixrestorestateview. tibex_fixrestorestateview contains 10 to 20 millions records so to avoid scan