To capture the selected rows along with edited field contents in alv report

Dear All,
         I do have requirement where, in alv report output one field is editable and need to save the content of the edited field along with the selected rows.
         For example If there are 10 records displayed in the alv output with 20 fields.
Out of this 20 fields one field (say XYZ) is editable. Also i have already created a new pushbutton (say ABC) on alv output. Now in the alv output if we maintain some value in the field (XYZ ) for the 2nd and 4th record and select this two records, and when clicked on the pushbutton (ABC) it has to update the DB table.
      I am using the Func Module  'REUSE_ALV_GRID_DISPLAY'. 
      Your early reply with sample code would be appreciated.
Thanks in Advance.

HI Naveen ,
There is an import parameter "i_callback_program" in the function module,
plz pass the program name to it.
Capture the command by passing a field of type sy-ucomm to "I_CALLBACK_USER_COMMAND ".  Check the returned command and
and program a functionality as desired.
u can try the event double_click or at line selection. there u can use READLINE command to c if the line has been selected.
In case it is , process the code segment.
Regards
Pankaj

Similar Messages

  • How to delete the selected rows with a condition in alv

    dear all,
    i am using the code in object oriented alv.
    WHEN 'DEL'.
    PERFORM delete_rows.
    FORM delete_rows.
    DATA : lv_rows LIKE lvc_s_row.
    data : wa_ROWs like LVC_S_ROW.
    FREE : gt_rows.
    CALL METHOD alv_grid->get_selected_rows
    IMPORTING
    et_index_rows = gt_rows.
    IF gt_rows[] IS INITIAL.
    MESSAGE s000 WITH text-046.
    EXIT.
    ENDIF.
    loop at gt_rows into wa_ROWs .
    if sy-tabix ne 1.
    wa_ROWs-INDEX = wa_ROWs-INDEX - ( sy-tabix - 1 ).
    endif.
    delete gt_sim INDEX wa_ROWs-INDEX .
    endloop.
    the rows to be deleted from int.tab gt_sim not in the alv display.
    all the rows should not be deleted if one of the field in gt_sim eq 'R'.
    how to check this condition

    dear jayanthi,
            ok if i am coding like that as u mentioned ,
              it will exit the loop when first time the field value is 'R'.
      if any of  the selected rows contains  field value 'R'. it shold not delete all the selected rows.
    as u suggested it will not delete after first time the field value is r.
    i am deleting it by tab index so,
    suppose if i am selecting the row without field value R say its tabix is 1.
      the next row with tabix 2 with field value R.
      it deletes the first row and exits , it should not delete the first row also.

  • How to obtain the selected rows in the model with af:Table using selectMany

    Hi ,
    I am using multi select af:Table and it is based on a programmatically populated view. When the table is single select I can use the getCurrentRow at the view implementation. I wonder whether there is a way to get list of selected rows within the view implementation for the multi-select scenario.
    I saw some ways of doing it in the page's backing bean but it will be more appropriate if I could do it at the model project.
    Thanks
    My environment is JDeveloper 10.1.3.3 and jdk 1.4

    Thanks for your reply.
    What you say makes sense. I thought there might be way of setting the selected rows in the model also as we do woth the current row.
    But looks like these two different things.
    Anyway I am doing it by passing the values through the backing bean.
    Thanks

  • Getting the parenet id along with the child ids in hierarchy query results

    create table test_test2 (do_id_tp varchar2(32),do_id number ,do_up_tp varchar2(32),do_up_id number)
    insert into test_test2 values('A_S',100170,'A_S',100001);
    insert into test_test2 values('A_S',1001054,'A_S',100001);
    insert into test_test2 values('A_S',1001055,'A_S',100001);
    insert into test_test2 values('A_S',1001053,'A_S',100001);
    insert into test_test2 values('A_S',1001056,'A_S',100001);
    insert into test_test2 values('A_S',1001051,'A_S',100001);
    insert into test_test2 values('A_S',1001052,'A_S',100001);
    insert into test_test2 values('A_S',100358,'A_S',100170);
    insert into test_test2 values('A_S',100359,'A_S',100170);
    insert into test_test2 values('A_S',100441,'A_S',100170);
    insert into test_test2 values('A_S',1001047,'A_S',100441);
    9/code]
    Upon executing the following query , i'm getting the childs of 100001 and the childs of childs of 100001 etc..
    That if fine .But in the output i'm not getting the parent id i.e; 100001 (which is in the where condition)
    How to get the parenet id along with the childs id.( without writing the UNION select 100001 from dual)SELECT do_id
    FROM (
    SELECT d.do_id, d.do_up_id
    FROM test_test2 d
    WHERE d.do_up_tp = 'A_S' ) m
    CONNECT BY NOCYCLE PRIOR m.do_id = m.do_up_id
    START WITH m.do_up_id =100001
    Edited by: smile on Jan 12, 2012 6:50 PM

    If you wish the root parent as a column in your select, you can use CONNECT_BY_ROOT:
    SELECT
    connect_by_root(do_up_id) root,
    do_up_id parent,
    do_id
    FROM (
       SELECT  d.do_id, d.do_up_id
       FROM test_test2 d
       WHERE    d.do_up_tp = 'A_S'
    ) m
    CONNECT BY NOCYCLE PRIOR m.do_id = m.do_up_id
    START WITH m.do_up_id =100001;But if you really wish an extra row in your output with 100001, then your problem is that you do not have a record in your data with do_id = 100001.
    Then you either need such a record in your data, or you need to create such a row with for example union all - something like this:
    SELECT
    do_id
    FROM (
       SELECT  d.do_id, d.do_up_id
       FROM test_test2 d
       WHERE    d.do_up_tp = 'A_S'
       UNION ALL
       SELECT 100001 do_id, NULL do_up_id
       FROM DUAL
    ) m
    CONNECT BY NOCYCLE PRIOR m.do_id = m.do_up_id
    START WITH m.do_up_id IS NULL;

  • How to capture the selected values from module pool dialog list box !

    Hi experts,
    Can anyone help me out in capturing the values from the list box.
    i am able to set the values in the list box.But i am not able to capture the selected value from the list box. Always the list box name is getting as "space"
    I also tried in using the FM "VRM_GET_VALUES" but it is retireving all the values. Is there is any flag for filttering out the selected value.
    Your inputs are appreciated.
    Thanks,
    Vijay.

    Along with the PBO and PAI event, add a POV event in the flow logic of the screen
    DEMO_DROPDOWN_LIST_BOX -is a good demo example.
    PROCESS ON VALUE-REQUEST.
    FIELD structure_name-field_name MODULE create_dropdown_box.
    In the report :
    MODULE create_dropdown_box INPUT.
      SELECT carrid carrname
                    FROM scarr
                    INTO CORRESPONDING FIELDS OF TABLE itab_carrid.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                retfield        = 'CARRID'
                value_org       = 'S'
           TABLES
                value_tab       = itab_carrid
           EXCEPTIONS
                parameter_error = 1
                no_values_found = 2
                OTHERS          = 3.
      IF sy-subrc <> 0.
      ENDIF.
    ENDMODULE.
    In the layout, assign a Function Code , for eg : 'SELECTED' to the listbox and lets say name of the field is SDYN_CONN-CARRID. So in the PAI module,
    MODULE user_command_0100 INPUT.
      CASE ok_code.
        WHEN 'SELECTED'.
          MESSAGE i888(sabapdocu) WITH sdyn_conn-carrid.
      ENDCASE.
    ENDMODULE.
    sdyb_conn-carrid will contain your selected field

  • How do you copy and paste track changes material in Pages from one point in a document to another and keep both the old text along with the track changed thus far in the new pasted location?

    Depending on whether track changes is on/paused, Pages thinks the pasted material is either all new and thus highlights it as a big track change or just copies the old material along with the edits as plain text so that I cannot see my track changes. I need to be able to copy and paste in the same document and still be able to see the older text along with the changes to certain sections thus far. Is this possible? I need a step-by-step "talk to me like I'm five" instructional if what I would like can be done.
    Thanks for any help!
    Message was edited by: C.M.W.

    What version of Pages?
    What OS, iOS or OSX?
    Are you sure you have the Table selected and not a cell or just contents?
    Peter

  • How can I get the index of the selected row, ALV

    In alv I need to get the selected row id and then calling a screen to show the detailed infomation on this row and providing the ability to update the row.
    I know how to do but do not know how to get the selected index of the alv grid.
    If it was desired based on just double click, it was ok but I have to provide a button and when it is clicked the detailed screen will come with the selected row details.
    Thanks everyone.
    Deniz.

    Hi Deniz,
    While defining the internal table which u pass in ALV_GRID function module, define a field (suppose CHECK type c) in the structure of that internal table.
    and while defining field layout, pass the value 'CHECK' to the field BOX_NAME of the layout.
    Now, when you execute the report, a selection box will be displayed infront of every record. If you select that record and press the button on application tool bar, the field 'CHECK' in the internal table will be having the value 'X'... By looping throught this internal table where check = 'X', you can achieve your functionality.
    Example:
         Structure for output details
    TYPES: BEGIN OF GS_OUTPUT.
            INCLUDE STRUCTURE ZAS_WATER_QLTY_REP.
    TYPES: CHECK(1) TYPE C,
           END OF GS_OUTPUT.
        Internal    table for output details
    DATA: GT_OUTPUT   TYPE STANDARD TABLE OF GS_OUTPUT.
    Before calling the function module to display ALV
    grid, define a layout usine
    Local workarea
      DATA: LW_LAYOUT  TYPE SLIS_LAYOUT_ALV.
    Local constants
      CONSTANTS: LC_UFORM  TYPE SLIS_FORMNAME
                        VALUE 'ALV_USER_COMMAND'.
    LW_LAYOUT-BOX_FIELDNAME = 'CHECK'.    "Field for checkbox
    This function module outputs an internal table with whatever
    structure in the form of a formatted single- order multi-line list
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM       = LV_REPID
                I_CALLBACK_PF_STATUS_SET = G_FORM_SET_PF_STAT
                I_CALLBACK_USER_COMMAND  = LC_UFORM
                I_STRUCTURE_NAME         = LV_ZAS_WATER_QLTY_REP
                IS_LAYOUT                = LW_LAYOUT
                IT_FIELDCAT              = G_FIELDCAT_TAB[]
                I_DEFAULT                = GC_X
                I_SAVE                   = LC_A
                IS_VARIANT               = G_VARIANT
                IT_EVENTS                = G_EVENTS_TAB[]
                IT_EVENT_EXIT            = G_EVENT_EXIT_TAB[]
                IS_PRINT                 = G_PRINT
                I_SCREEN_START_COLUMN    = G_SCREEN_START_COLUMN
                I_SCREEN_START_LINE      = G_SCREEN_START_LINE
                I_SCREEN_END_COLUMN      = G_SCREEN_END_COLUMN
                I_SCREEN_END_LINE        = G_SCREEN_END_LINE
           TABLES
                T_OUTTAB                 = GT_OUTPUT
           EXCEPTIONS
                PROGRAM_ERROR            = 1
                OTHERS                   = 2.
    and in the form alv_user_command
    FORM ALV_USER_COMMAND USING UCOMM SELLINE TYPE SLIS_SELFIELD.
    case ucomm.
    Lets hope that the user command of the push button in * PUSH
    when 'PUSH'.
    loop at gt_output where check = 'X'.
    You can write your code here...
    endloop.
    endcase.
    ENDFORM.
    Hope this helps...
    Best Regards,
    Phani.
    Message was edited by:
            Sivapuram Phani Kumar

  • Select Table row(eg.3rd),rows displayed from the selected row,hiding above

    If we move the horizontal scroll bar of the table and filter a column when there is a selection on the row, the rows are displayed from the selected row. The rows above the selected rows are disappearing(F5 it come back) and the rows are available when there are more rows with vertical scroll bar(above the selected row, if we scroll up).

    Frank,
    Mailed to you the sample application with the table script too. Please review the comments in the mail.
    Thanks and Regards,
    Stanley William
    Edited by: STANLEYWILLIAM on Apr 22, 2013 3:52 PM
    Edited by: STANLEYWILLIAM on Apr 22, 2013 3:52 PM

  • JTable - Get the Point of the selected row

    I programmatically selected a row in my JTable using
    table.getSelectionModel().setSelectionInterval(row, row);Now I would like to reposition the viewport in order to view the selected row.
    I was thinking about using following method:
    table.getViewport().setLocation(Point p);For this I would need to know the location (Point) of the selected row.
    Can anyone help me with this ?

    Check out the JTable methods getCellRect and scrollRectToVisible (inherited from JComponent).
    luck, db
    Umm, not just too late but 3 late :-) lost my net connection for a short while.
    Gotta check what david's quoted me on.
    Edited by: Darryl.Burke

  • After upgrading to CF10, the selected row of my cfgrid is no longer passed on form post.

    I have a cfform which contains a cfgrid and prior to the 9 to 10 update, upon submission of the cfform, the selected row of the grid was passed/posted to my form action page as:
    __CFGRID__gridForm__renewalGrid
    This contained all the data from the selected row, I.e.:
    __CFGRID__COLUMN__=PROJECTID; __CFGRID__DATA__=T01081002AP; __CFGRID__COLUMN__=APPLICATIONS; __CFGRID__DATA__=PQFD; __CFGRID__COLUMN__=OWNERUID; __CFGRID__DATA__=HT2008; __CFGRID__COLUMN__=TEAM; __CFGRID__DATA__=Roberts; __CFGRID__COLUMN__=ROLE; __CFGRID__DATA__=AASBOAPMX; __CFGRID__COLUMN__=REGION; __CFGRID__DATA__=Southwest; __CFGRID__COLUMN__=EXISTING; __CFGRID__DATA__=K8045F; __CFGRID__COLUMN__=SOD; __CFGRID__DATA__=0; __CFGRID__COLUMN__=INITIALEMAILDATE; __CFGRID__DATA__=01/28/2013; __CFGRID__COLUMN__=MESSAGEDATE; __CFGRID__DATA__=; __CFGRID__COLUMN__=SECONDEMAILDATE; __CFGRID__DATA__=; __CFGRID__COLUMN__=ESCALATIONDATE; __CFGRID__DATA__=; __CFGRID__COLUMN__=COMPLETEDBY; __CFGRID__DATA__=TH2878; __CFGRID__COLUMN__=COMPLETIONDATE; __CFGRID__DATA__=02/06/2013; __CFGRID__COLUMN__=MONTHPULLED; __CFGRID__DATA__=Jan2013; __CFGRID__COLUMN__=TOTALITEMS; __CFGRID__DATA__=2; __CFGRID__COLUMN__=RELIEVINGPSA; __CFGRID__DATA__=; __CFGRID__COLUMN__=MODIFIEDBYTS; __CFGRID__DATA__=02/06/2013; __CFGRID__COLUMN__=MODIFIEDBY; __CFGRID__DATA__=T228Y8; __CFGRID__COLUMN__=CREATEDBY; __CFGRID__DATA__=KV3M36; __CFGRID__COLUMN__=CREATEDTS; __CFGRID__DATA__=01/28/2013; __CFGRID__COLUMN__=NEWSA; __CFGRID__DATA__=; __CFGRID__COLUMN__=DELEGATESTATUSNOTE; __CFGRID__DATA__=Access; __CFGRID__COLUMN__=STATUS; __CFGRID__DATA__=Completed; __CFGRID__COLUMN__=DATATYPE; __CFGRID__DATA__=Appl New
    After upgrading to CF10, and with no changes to the code, performing this same process, __CFGRID__gridForm__renewalGrid is still passed in the form scope to my action page, but now it is empty.
    I have not yet uninstalled CF9, so I brought it up on a different port, and I can run the same code as CF9 or CF10 and watch... in 9 the selected row is passed, in 10 it is empty.
    Is this a bug? Is there a work around? Please help.

    appears that apple has changed SMB code, and now its not possible login from windows on mac.
    i installed snow leopard and now works fine.
    apple is capable to make it run paying new license of smb code, but isnted of this, apple has created new protocol smbx and now, all others need to adapt your code to apple..
    bad movement.. i am thinking sell imac and no back to apple anymore..

  • How can I get the selected rows from two ALV grids at the same time?

    I have a program that uses two ALV grids in one dialog screen. I'm using the OO ALV model (SALV* classes).
    The user can select any number of rows from each grid. Then, when a toolbar pushbutton is pressed, I'd have to retrieve the selected rows from both grids and start some processing with these rows.
    It is no problem to assign event handlers to both grids, and use the CL_SALV_TABLE->GET_SELECTIONS and CL_SALV_SELECTIONS->GET_SELECTED_ROWS methods to find out which rows were marked by the user. Trouble is, this only works when I raise an event in each grid separately, for instance via an own function that I added to the grid's toolbar. So, I can only see the selected rows of the same grid where such an event was raised.
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.
    As it is right now, I can have an own button in both grid's toolbar, select the rows, click on the extra button in each grid (this will tell me what entries were selected per grid). Then, I'd have to click on a third button (the one in the dialog screen's toolbar), and process the selected rows from both grids.
    How can I select the rows, then click on just one button, and process the marked entries from both grids?
    Is it somehow possible to raise an event belonging to each grid programmatically, so that then the corresponding CL_SALV_SELECTIONS->GET_SELECTED_ROWS will work?
    Thanks.

    Hello Tamas ,
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.--->
    is it possible to  have a check box in each grid  & get the selected lines in PAI of the screen ?
    regards
    prabhu

  • [UIX-ADF] How to get the selected row in my ViewObjImpl.java

    Hi,
    I have a uix table with a select column. I dragged my method from my ViewObjImpl
    and dropped it on the select column (radiobutton) as a submitbutton.
    If I run my application and select a row and press my button it always reads the first
    row. Why?
    I also tried including a param in my method, for the record id, but I dont know what to
    pass to my action binding as a param, where can I find the selected row?
    This is what I want, my method in ViewObjImpl.java
    public void doDelete() {
      ViewObjRowImpl pRow = (ViewObjRowImpl)this.getCurrentRow();
      try {
        pRow.setIsDeleted("Y");
        //this.executeQuery();
        this.getDBTransaction().commitAndSaveChangeSet();
        //this.validate();
      } catch(Exception e) { System.out.println("ERROR doDelete" + e);  }
    }It should set the IsDeleted field to 'Y' for the selected row. Perhaps im not doing the
    right thing for this?
    Can anyone give me some pointers?
    Thanks in advance
    Ido

    Thanks. So even if you select a row and then press the button, your method still only finds the first row?!
    Are you sure that the selection mechanism of your table is working? Your tableSelection fires a select event and your page contains a select handler?
    When you wire your page using drag and drop the binding should always use the default iterator of the ViewObject. And getCurrentRow() should always give you the current row of that iterator. So my feeling is that the selection doesn't take place.
    Or could it be that something resets the currency in the ViewObject from another place?
    Sascha

  • Check box als column in a standard table, how to get the selected row

    Dear experts,
    I habe standard tablt with check box as column. Now I want to get the current selected row structure and do some changes. How could I solve this problem? till now I just know to get the structure via lead selection.
    lo_node->get_element().
    lo_element = lo_node->get_static_attributes ( static_attributes = ls_row).
    How could I get the element through check-box in stead of lead selection. Many thanks!

    check this code
    To get the selected row number
    data: lr_element type ref to if_wd_context_element,
              lv_index type i.
      lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT'  ).
      lv_index = lr_element->get_index( ).
    Thanks
    Bala Duvvuri

  • How to delete or remove the selected row in a table

    Dear Experts,
    I'm facing a typical requirement in VC, similiar to variable selection screen in BI Queries :
    I will have two tabes and if the user selects data from one table it will be moved to target table.I'm able to populate the target table with the value but I'm not able to delete the selected row from the source table.
    Any help in this regard would be highlt appreciated.
    Thankx in advance.
    Regds,
    Srinivasan.

    Hi
    Follow the following steps -
    1. Create two buttons.One for 'delete row' and another one for 'insert row'.
    2. Assign the proper system action as per the name.
    2. Change the name of both buttons as common name.
    3. To trigger the actions simultaneously add a star before the action.( For Example : *select)
    4. Change the visibility of any one of the button as 'false'. (so it will not get displayed)
    5. Now, if u click the visible button both actions will be triggered simultaneously.
    Regards
    Sandeep

  • How to capture a selected row in a table control in screen

    Hello,
        I have a table in a screen and hv data in it also from a table.Now i want if a user selects a row n clicks a display button , i should display the same fields in empty text fields created outside the table on the same screen.
    Rite now i m lookin for single selection but any help on multiple selection is also welcomed.
    I have given a line-selection element name as 'LSELECT1'  to the table in screen painter n have declared a variable also with the same name of type C(1) in my abap prog.But dont know wat to write in PAI now to caputure the selected row.
    THANKS

    Hi,
    Use ALV to display your table records from FM 'REUSE_ALV_GRID_DISPLAY'.
    In your internal table add a field with char1. This will show you the selected records by 'X' or ' '. Use this field in your layout like g_layout-box_fieldname = 'CHK'.
    Here i used CHK TYPE CHAR1 added to internal table to display. Now ur ALV will be showing u a column to select records. U can select multiple records also. Evry selected record will reflect into internal table by modifying value of CHK as 'X'. Add button to ALV by creating PF-STATUS and  add code its behavior when executed.
    DATA: BEGIN OF ls_ekko,
          ebeln TYPE ekko-ebeln, " this is my internal table showed in alv
          bukrs TYPE ekko-bukrs,
          bstyp TYPE ekko-bstyp,
          bsart TYPE ekko-bsart,
          lifnr TYPE ekko-lifnr,
          ekorg TYPE ekko-ekorg,
          ekgrp TYPE ekko-ekgrp,
          waers TYPE ekko-waers,
          chk(1)   TYPE c, " check field
          END OF ls_ekko.
    DATA it_ekko LIKE TABLE OF ls_ekko.
    DATA : gt_fcat    TYPE slis_t_fieldcat_alv WITH HEADER LINE,
           g_layout   TYPE slis_layout_alv,
           gt_fcat1    TYPE slis_t_fieldcat_alv WITH HEADER LINE,
           g_layout1   TYPE slis_layout_alv.
      g_layout-colwidth_optimize = 'X'.
      g_layout-box_fieldname = 'CHK'. " adding check field to alv
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
       i_callback_program                = sy-repid
       i_callback_pf_status_set          = 'PF_STATUS_ALV'
       i_callback_user_command           = 'USER_COMMAND_ALV'
      IT_EXCLUDING                      =
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
          is_layout          = g_layout
          it_fieldcat        = gt_fcat[]
          i_default          = 'X'
          i_save             = 'A'
        TABLES
          t_outtab           = it_ekko
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
    *&      Form  PF_STATUS_ALV
        Subroutine for PF status
         -->RT_EXTAB   text
    FORM pf_status_alv USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'SELOBJ' EXCLUDING rt_extab.
    ENDFORM.                    "PF_STATUS_ALV
    Hope this help

Maybe you are looking for