Editable ALV, capturing multiple record changes

Hello
I am writing the editable ALV prog. (because of some reaosn am using FM - REUSE*) and i need to capture the user changes on the list, but, when i searched, i found the below code, where in i  can get only one change/record (because am getting importing formal parameter is a structure), but, i need to get all records user changes, multiple.
FORM user_command USING r_ucomm LIKE sy-ucomm
                  rs_selfield TYPE slis_selfield.
Pls. let me know how to capture all records/changes? I saw BCALV, but, all they are on OOPS.
Thank you

Hi Raju,
no chance without oo event data_changed.
You can get the grid object from the function module, I think FM LVC_GET_GLOBALS or something like that. Then implement method
METHODS: handle_data_chg FOR EVENT data_changed OF   cl_gui_alv_grid   IMPORTING er_data_changed.
In SET_STaTUS event of the function module, you can extract the grid object and registr your own handler.
But, honestly, I'm not convinced this will be easier for you than changing to OO grid.
Regards,
Clemens

Similar Messages

  • How can we find out data in an editable ALV grid has been changed or not?

    Hi Experts,
    How can we find out whether a data in an editable ALV grid has been changed or not.
    I am using the
    FM -> REUSE_ALV_GRID_DISPLAY_LVC
    for ALV display.
    I have to chekc whther data has been changed or not befor saving. if changed then only i want to
    SAVE
    . I cannot use the internal table comparison method for this purpose also i am not using OOP ALV.
    So kindly sugest me an alternative.
    Thanks and Regards,
    Shahana

    Hi,
    Thanks for your answer. I already saw this post.
    See this method.
    CALL METHOD reuse_alv_grid->check_changed_data
    IMPORTING
    e_valid = lv_check.
    This will update the internal table with the edited values. Then we can go for internal table comparison.
    But my scenario will not allow me for itab comparisons.I just want to know the ALV data has been changed or not.
    Regards,
    Shahana

  • Edit and update multiple records in JSP buisness components

    Hi everybody,
    I'm building BC4J components using entities and views and JSP buisness components.
    how can I edit and update multiple records
    at a time in the jsp file
    Note using the databean
    "oracle.jbo.html.databeans.EditCurrentRecord"
    one can view one record at a time
    thank you

    do you have a sample code? thanks
    Hi
    There are several options. One of them could be
    1) use <input name=rc[j] value="..."> instead of
    display a raw text
    2) parse parameters in doPost method of your servlet
    to update appropriate values.
    3) Make a empty row enable inserts
    Regards
    Jan

  • Is "Enter" the only way to let an ABAP OO editable ALV know data's changed?

    In the past two years, I've coded numerous ABAP OO editable ALV's, and once Uwe set me straight about how ti use the canned "handle data changed" methods,. it's been very straightforward.
    But here's my question.
    I have a modal dialog box in a MIGO dialog exit (yes, there is one although it's in a very odd function group - XQSM.)
    In the modal dialog box, I have an editable ALV and an OK pushbutton underneath it.
    If the user enters data into the ALV and then presses OK immediately afterwards (without pressing ENTER first), the ALV doesn't recognize that data has been entered.  So the underlying itab winds up empty.
    What is the right way to handle this?
    Is there a way of forcing the ALV to do its thing from within the PAI that handles the OK pushbutton?
    At my last client, the customers were willing to live with this as a training issue - tell the users to hit ENTER at least once before pressing OK.
    But surely, SAP must have something else in mind here that I'm not yet aware of.
    Thanks for any advice anyone can provide.
    djh

    Hi Vijay -
    Thanks for both answers!
    Regarding your first answer, here's my current code:
    class lcl_event_receiver          definition deferred.
    data:
      o_event_receiver                  type ref to lcl_event_receiver.
    class lcl_event_receiver definition.
    public section.
        methods:
          handle_data_changed
             for event data_changed of cl_gui_alv_grid
                 importing er_data_changed.
    private section.
    endclass.
    And this:
      call method o_grid->register_edit_event
                   exporting
                      i_event_id = cl_gui_alv_grid=>mc_evt_enter.
      create object o_event_receiver.
      set handler o_event_receiver->handle_data_changed for o_grid
    Are you saying that instead of mc_evt_enter, I should use "mc_evt_modified" ????
    Please clarify if you have the time.
    Thanks
    djh

  • How to validate data in editable ALV report after making changes

    Hi Folks,
    My requirement is to display data in ALV format with quantity field is editable. Once we get the data in display mode only quantity field is enabled right. I am going to make changes to that quantity field and updating that modifed value to the database table. Before updating databse table i want to validate the data for perticluar field which I edidted(Quantity).
    Can you guide me on this.
    Currently I am using FM: GET_GLOBALS_FROM_SLVC_FULLSCR and calling the method CHECK_CHANGED_DATA.
    I want to validate the quantity data.
    If I entered negative value like -100 instead of 100. It should validate and show some popup screen or message.
    Pls guide me on this or give some code to do that.
    Thanks&Regards,
    Surendra

    Hey Surendra,
    Check if this helps: Link:[Click here|Edit Field in Oops Alv;
    There are many posts available for this requirement. Please look SDN/web for same.
    Regards,
    Santosh

  • Edit ALV - Capture modified data

    Hi,
    I am using cl_gui_alv_grid to show an ALV. I am able to edit the ALV. I have used the following code to register the edit event too.
    call method g_p_grid->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>MC_EVT_MODIFIED.
      create object g_event_receiver.
      set handler g_event_receiver->handle_data_changed for g_p_grid.
    The only issue that I face is, the user needs to hit the enter key inorder to store the modified values back in the internal table. Is there any way by which, the modified values can go back into the Internal table with as soon as the user changes the values.
    Any suggestions will be appreciated.
    Please note, I am able to edit an ALV and update the modified values into the tables. I have gone thru the exisitng examples.
    Murali.

    I was actually editing a cell using lvc_s_styl properties (cl_gui_alv_grid=>mc_style_disabled/enabled). I added the edit='X' in the fieldcatalog and it started to react to my tabout event the moment I change the cell value.
    Cheers.

  • Edit multiple records with BC4J and Struts-JSP

    Hi everybody,
    I'm building BC4J components using entities and views and JSP business components. How can I edit and update multiple records at a time with Struts-Jsp ? Have someone already an example (with JSP and ActionForm code) ?
    thank you

    Hi,
    Nobody have an example ? Is it so difficult ?
    Thanks

  • Editable ALV, how to capture changed data

    Hi All,
    I have created an editable ALV. User can make some changes in the displayed record and press "Submit" button (custom button on application toolbar), the program should validate the data and write the file on application server if validations are successful otherwise controls stay on the same screen.
    I am handling this validation and writing file part in PAI of the screen.
    Problem: The program is capturing the data when user changes it for the first, but program is failing to capture the subsequent changes (user makes after the validation fails). Program processes always the first time changed data only. Please help me in getting this problem resolved.
    Step1 : Program shows output.
    Step2: User changes Company Code.
    Step3: User clicks on Submit Button.
    Step3.1: Program reads the new data and performs validation.
    Step3.2: New Company code is not valid, error displayed.
    Step4: User changes the company code again, presses submit button.
    Goto step 3.1 -> Here program does not read the new data, rather first time changes company code is again read and validated, and program shows the same error again, which is not a desired result

    Hi Ashish,
    you need a method HANDLE_DATA_CHANGED as handler for grid event DATA_CHANGED.
    Use
    LOOP AT er_data_changed->mt_mod_cells ASSIGNING <mod>.
    to check all changed data. In this event, add the error messages to ER_DATA_CHANGED object.
    set all required handlers, i.e.
    SET HANDLER:
          handle_data_changed          FOR ro_grid,
          handle_data_changed_finished FOR ro_grid,
          handle_toolbar_set           FOR ro_grid,
          handle_user_command          FOR ro_grid,
          handle_hotspot_click         FOR ro_grid,
          handle_f4                    FOR ro_grid,
          handle_f1                    FOR ro_grid.
       ro_grid->set_toolbar_interactive( ).
    Register ENTER and MODIFIED events.
        ro_grid->register_edit_event( cl_gui_alv_grid=>mc_evt_enter ).
        ro_grid->register_edit_event( cl_gui_alv_grid=>mc_evt_modified ).
    Regards,
    Clemens

  • Editable ALV -- OO -- Changed data capture

    Hi,
    I'm using an editable ALV to display the output. Output has a field for the user to enter comments. When the user enters the comments and presses "ENTER" key or clicks somewhere else on the ALV itself, the event DATA_CHANGED or DATA_CHANGED_FINISHED gets triggered and I'm able to capture the changed data and update the DB table.(I have a "SAVE" button on the menu bar which when pressed will update the ALV values into DB table.)
    However, I need to capture this changed data even if the user does not press the "ENTER" key or clicks somewhere else on the ALV, but just presses the "SAVE" button.  Please let me know if there is any way to do this.
    Thanks,
    Raj.

    Hi,
    in your program check the user-command if 'SAVE' then write the following code in it
    "Call the method check_changed_data to update the  internal table with changed data.
    DATA: lv_valid TYPE xfeld,
                lv_refresh TYPE xfeld.
          CALL METHOD gv_alv_grid->check_changed_data
            IMPORTING
              e_valid   = lv_valid
            CHANGING
              c_refresh = lv_refresh.
    " to refresh alv
    CALL METHOD gv_alv_grid->refresh_table_display
            EXCEPTIONS
              finished = 1
              OTHERS   = 2.
    by this way it the internal table will get the changed data and then you can update it in the DB and also after updating show the ALV since it is refreshed it will now show the changed data.
    Hope it helps you,
    Regards,
    Abhijit G. Borkar

  • Capture contents from an editable alv

    I'm trying to capture fields from an editable alv. I have an update button in the application toolbar. So when i press this button, whatever changes I have done on the screen, the internal table should get updated. I'm using the function module    REUSE_ALV_GRID_DISPLAY.
    Can anybody help me out??

    Yes you can,
    If you have access to the element in the context that is bound to the row in the ALV then you can connect the message. Marking a * is not possible by default with the WD message manager and you willl need to do it manually. Use the element method of the message manager API for this purpose.

  • My changes edited on editable ALV report are not transferring back to itab?

    Hello
    I was developed a heirarchila editable ALV by using FM 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'. The user will do some changes in the ITEMs (Z_VBAP_TABLE) on this heirarchila ALV report and presses the SAVE button.
    In my program am handling this SAVE command and even my break point is also triggering at SAVE, but my ITAB is not having the CHANGED/new data!! still it has the old data in it! How to capture the user changes done on the report? those changes are not tranferring back to my itab/prog! because, ineed to update Z_VBAP_TABLE with those changes
    Thank you

    Hi Raju,
    it is possible . But i know about your code.
       WHEN 'SAVE'(003).
        Lock the table
          CALL FUNCTION 'ENQUEUE_E_TABLE'
            EXPORTING
              mode_rstable   = 'E'
              tabname        = viewname
            EXCEPTIONS
              foreign_lock   = 1
              system_failure = 2
              OTHERS         = 3.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
          IF NOT grid1 IS INITIAL .
            CALL METHOD grid1->check_changed_data .
          ENDIF .
          SORT i_mod BY row.
          DELETE ADJACENT DUPLICATES  FROM i_mod COMPARING row.
          lh_norec = LINES( i_mod ).
          lh_total = lh_norec.
          SHIFT lh_total LEFT DELETING LEADING space.
    Standard Table Update
          IF i_mod[] IS NOT INITIAL.
            LOOP AT i_mod INTO lwa_mod.
              READ TABLE <i_itab> INTO <wa_tab> INDEX lwa_mod-row.
              IF sy-subrc = 0 .
                IF lh_flag NE 'X'.
                  MODIFY (viewname) FROM <wa_tab>.
                ELSE.
                  INSERT (viewname) FROM <wa_tab>.
                  IF sy-subrc NE 0.
                    MESSAGE 'DATA NOT SAVED' type 'I'.
                  ENDIF.
                ENDIF.
              ENDIF.
            ENDLOOP.
            CONCATENATE lh_total '  ' text-s01 INTO lh_succ SEPARATED BY space.
            MESSAGE 'Data Saved' TYPE 'I'.
    This i did a long back. Check your code . I created an alv that will display data from my table . In this the user can click in any line item and he can change any value and press save  that will save the value .
    Regards,
    Madhu.

  • Alv report for multiple record insertion

    hi,
    i'm new to abap. i'm using alv report for record display and insertion. how can i insert multiple records from alv to my table??

    well that can be achieved only by running BDC inside alv report to enter the entries.and in that too you can append or edit single entries only
    reward if useful
    regards
    vivek

  • Tabstrip with editable ALV:  change tab - modification lost

    Hi,
    I will first try to describe the situation that I am having:
    I have a screen with on it various tabstrips using CL_BUS_TABSTRIP etc. 
    Each tabstrip has it's specific editable ALV grid.  (CL_GUI_ALV_GRID)
    Now, the data changed event gets triggered whenever I edit a field and leave it... which is perfect.
    (          CALL METHOD <fs_object>->register_edit_event
                EXPORTING
                   i_event_id = cl_gui_alv_grid=>mc_evt_modified.                           )
    But when I edit a field and instead of leaving it just click on another tab.. then the change goes lost.  (data changed event not triggered)
    How can I make sure that the change on the alv DOES get transferred to the internal table behind it?
    Best Regards
    Edited by: Rob Burbank on Apr 21, 2010 10:10 AM

    I am afraid you can't catch the changes made in ALV without pressing the enter key for MC_EVT_ENTER or without leaving the cell for MC_EVT_MODIFIED . Anyhow you may try using...
    CALL METHOD oref_main->check_changed_data.
    ...in PAI to capture the changes, but I think it's unlikely to happen so.
    Regards
    Marcin

  • Editable ALV issue: When Delete/Modify a row, ztable doesnt reflect changes

    Greeting Fellow Abapers,.
    I have been running into an issue that I need some advice on.  I am allowing users to edit a Ztable via ALV.  When the quantity field is updated everything is fine. However, when the field "lic_plate" is edited the code appends another row into the Ztable instead of modifying it.  Also, when the delete row functionality of the grid is used the row is not deleted from the Ztable.
    Here is the ztable structure. The fields I allow to be edited are in BOLD...
    ZPALLET-VBELN
    ZPALLET-MATNR
    ZPALLET-LINE_NUM
    ZPALLET-LIC_PLATE
    ZPALLET-LOT_NUMBER
    ZPALLET-PAL_TYPE
    ZPALLET-MAN_DATE
    ZPALLET-QUANTITY
    ZPALLET-PROC_DATE
    Here is the source code that the APPEND is taking place...
    FORM save_database .
    Getting the selected rows index*
      CALL METHOD o_grid->get_selected_rows
        IMPORTING
          et_index_rows = i_selected_rows.
    Through the index capturing the values of selected rows*
      LOOP AT i_selected_rows INTO w_selected_rows.
        READ TABLE itab INTO wa INDEX w_selected_rows-index.
        IF sy-subrc EQ 0.
          MOVE-CORRESPONDING wa TO w_modified.
          APPEND w_modified TO i_modified.
        ENDIF.
      ENDLOOP.
    IF sy-subrc = 0.
        MODIFY zpallet FROM TABLE i_modified.
    ENDIF.
    ENDFORM.
    Please help. I am in your debt.
    ...as always, points will be awarded.
    Best,
    Dan

    Hello Dan
    When you are using an editable ALV for table maintenance you have to take care that the users
    - cannot edit the key fields of existing DB records   and
    - every new record (row) does not match any existing record (i.e. has identical key field values)
    Instead of relying on selected rows for the DB update I would recommend to store a "PBO image" of your data and compare this with the "PAI image" of the data as soon as the user pushes the SAVE button.
    Example:
    DATA:
      gt_outtab_pbo    TYPE   < your table type>,  " PBO image
      gt_outtab           TYPE   < your table type>.  " PAI image
    " 1. Select data from DB table and store in both itabs:
      SELECT * ... INTO TABLE gt_outtab.
      gt_outtab_pbo = gt_outtab.
    " 2. Display editable ALV list -> user modifies gt_outtab
    " 3. SAVE function requested
    " ... compare gt_outtab vs. gt_outtab_pbo
    " .... INSERT, UPDATE, or DELETE DB records
    " Finally set:
      gt_outtab_pbo = gt_outtab.
    " 2. User continues with editing
    In order to compare PBO vs. PAI data you may have a look at my sample coding:
    [Comparing Two Internal Tables - A Generic Approach|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/comparing%2btwo%2binternal%2btables%2b-%2ba%2bgeneric%2bapproach]
    Regards,
      Uwe

  • How to select multiple records in the ALV POP UP by using oops

    Hi All,
    We have a requirement of ALV POP UP by using the OOPS. How to select the multiple records in the POP UP and After selecting that i want do Inteactive ALV means again one more POP UP in ALV.
    Thanks for help....
    Regards,
    Bharani

    Hello Bharani
    Displaying an ALV list in a popup is by no means different from a list displayed on a main screen. The only thing you need to consider is that you set the right screen level when creating the parent container for the ALV.
    For more details refer to thread in CL_GUI_SPLITTER_CONTAINER  ALV list  is not show in called screen
    " step 1:
      CREATE OBJECT gr_spliter
        EXPORTING
          parent = cl_gui_container=>screen0 " For first popup use: =>screen1
          rows = 1
          columns = 2.
    Regards
      Uwe

Maybe you are looking for