Save changed data in editable ALV

Hi experts,
I have a problem with an editable ALV. I get data out of a table and show it with my web dynpro application in an alv. Now I made the alv editablke, so that I can change the content of each cell in the alv in the web browser. But how will this changed data be saved? I want that it will be changed after ENTER or clicking a save button. I have a button, but all I tried yet brought no success.
Which code has to be in which method? Have I to do something eith the context. How can I reach that the changed content is also changed in the table, so that after reload the web dynpro application, the changed content is shown?
It would be nice if you had an answer with code examples and the exact place where to put it in, because I am very new to ABAP and WD4A.
Thanks a lot!
Best Regards
Ingmar

If you look on the following lokn, there is the tutorial "Editing ALV in Web Dynpr for ABAP".
There is described how to save the data. But in the implementation of On_data_check on page 8 and 9 the code detail for saving the data to database is missing, because the flight model shall not be changed.
Would the missing code be the solution? What is the code?
Thanks!!!
Best Regards Ingmar
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1

Similar Messages

  • ALV SAVE changed data

    Hi,
    I need to save only changed data in my ALV.  I created a button SAVE and have an event handler for this data. SAVE action should only be triggered when user presses this button.
    ON_DATA_CHECK method is what I need since I can pull out changed content from R_PARAM but this action gets executed only when I press on Filter link, etc. Is there  a way to bind it to my custom button?
    I can execute the following code
    DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .
    * Check for changes
      l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
      l_ref_interfacecontroller->data_check( ).
    however, data_check method won't be executed if any data changed but I want to executed regardless of changes.
    Any ideas?
    Bottom line is that I would like to execute action ON_DATA_CHECK in my SAVE method.
    Thanks.

    If you look on the following lokn, there is the tutorial "Editing ALV in Web Dynpr for ABAP".
    There is described how to save the data. But in the implementation of On_data_check on page 8 and 9 the code detail for saving the data to database is missing, because the flight model shall not be changed.
    Would the missing code be the solution? What is the code?
    Thanks!!!
    Best Regards Ingmar
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1

  • How to Transfer Data from editable ALV grid control to internal table?

    Hi,
    Can anyone give me a simple example by which I can transfer data from editable alv grid control back to the internal table. The ALV has been created by OO approach.
    I would appreciate if the solution is provided without handling any events.
    Regards,
    Auro

    Hello Auro
    You simply need to call method <b>go_grid->check_changed_data</b> at PAI of the dynpro displaying the ALV grid. If data have been changed on the editable ALV grid then this method will raise event DATA_CHANGED. If you do not want or need to handle this event (e.g. for validating the edited values) then you do not define any event handler method.
    Regards
      Uwe

  • Save data in editable ALV

    Hi all,
    I am using an editable ALV in webdynpro using which I would like to save some data to a table. In the list of standard functions, I see only options like 'Insert row', 'Delete row' etc. There is no option to Save the edited data.
    Even if I declare a user defined function, how do I specify the action it would trigger? Any help would be greatly appreciated. Thanks in advance.
    Regards,
    Nithya

    Hi Nithya,
    Once you edit an ALV, the data is automatically updated to the context node, you map in the DATA field of controller usage (of the component usage).
    If you want to trigger event for change in ALV, see the below tutorial.
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/bd28494a-0801-0010-45a3-fc359d82d3e8">Using Events with ALV Tables
    in Web Dynpro for ABAP</a>
    If you want to trigger a event for user defined function,
    Create a event handler method in the view. Specify event,  
       ON_FUNCTION of the interface controller of ALV for the event handler method.
    The importing parameter r_param of the method contains unique ID of the
       function for which the UI element is assigned.
    For reference see the below tutorial. It will be useful.
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/101df93f-4b5c-2910-14aa-9eb0338c2110">Generating Self-Defined Functions for ALV in Web Dynpro for ABAP</a>
    Hope it Helps
    Rakesh

  • Add(Copy)/Change/Delete in editable ALV list

    I want to add a column to my ALV list where the user can enter an 'A' to Copy, 'C' to Change or 'D' to Delete. If the user enters an 'A', the code needs to insert a new line into the ALV list.  After the user makes the changes on the screen and selects Save, I need the program to perform different functions depending on whether the user entered an 'A', 'C' or 'D' in the column.  I have never used an editable ALV list and would like to have some sample code to get started.  Does anyone have any code similar to what I am trying to do?
    Thanks.
    Sandy

    Hi,
    check this code... if you trying with ALV FM, and editable grid then check this code.
    REPORT  ZTESTDFALV1                             .
    *Data Declaration
    DATA: BEGIN OF T_EKKO,
      EBELN TYPE EKPO-EBELN,
      EBELP TYPE EKPO-EBELP,
    *  FLAG TYPE C,
    *  HANDLE_STYLE TYPE LVC_T_STYL,
    END OF T_EKKO.
      DATA: GD_REPID LIKE SY-REPID, "Exists
      REF_GRID TYPE REF TO CL_GUI_ALV_GRID. "new
    DATA: BEGIN OF IT_EKKO OCCURS 0.
            INCLUDE STRUCTURE T_EKKO.
    DATA: END OF IT_EKKO.
    DATA: BEGIN OF IT_BACKUP OCCURS 0.
            INCLUDE STRUCTURE T_EKKO.
    DATA: END OF IT_BACKUP.
    *ALV data declarations
    TYPE-POOLS: SLIS.                                 "ALV Declarations
    DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
          GD_LAYOUT    TYPE SLIS_LAYOUT_ALV.
    *Start-of-selection.
    START-OF-SELECTION.
      PERFORM DATA_RETRIEVAL.
      PERFORM BUILD_FIELDCATALOG.
      PERFORM BUILD_LAYOUT.
      IT_BACKUP[] = IT_EKKO[].
      PERFORM DISPLAY_ALV_REPORT.
    *&      Form  build_fieldcatalog
    *       text
    FORM BUILD_FIELDCATALOG.
      REFRESH FIELDCATALOG.
      CLEAR FIELDCATALOG.
      FIELDCATALOG-FIELDNAME   = 'EBELN'.
      FIELDCATALOG-SELTEXT_M   = 'Purchase Order'.
      FIELDCATALOG-INPUT     = 'X'.
      FIELDCATALOG-EDIT     = 'X'.
      FIELDCATALOG-COL_POS     = 2.
      APPEND FIELDCATALOG.
      CLEAR  FIELDCATALOG.
      FIELDCATALOG-FIELDNAME   = 'EBELP'.
      FIELDCATALOG-SELTEXT_M   = 'PO Item'.
      FIELDCATALOG-COL_POS     = 3.
      APPEND FIELDCATALOG.
      CLEAR  FIELDCATALOG.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    FORM BUILD_LAYOUT.
      "Permet d'ajuster les colonnes au text
    *  gd_layout-colwidth_optimize = 'X'.
    *  GD_LAYOUT-TOTALS_TEXT       = 'Totals'(201).
    *  gd_layout-box_fieldname = 'SELECT'.
    *  gd_layout-box_tabname   = 'IT_EKKO'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    FORM DISPLAY_ALV_REPORT .
      GD_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM        = GD_REPID
    *            i_callback_top_of_page   = 'TOP-OF-PAGE'
                I_CALLBACK_PF_STATUS_SET  = 'SET_PF_STATUS'
                I_CALLBACK_USER_COMMAND   = 'USER_COMMAND'
    *            i_grid_title             = 'My Title'
                IS_LAYOUT                 = GD_LAYOUT
                IT_FIELDCAT               = FIELDCATALOG[]
           TABLES
                T_OUTTAB                  = IT_EKKO
           EXCEPTIONS
                PROGRAM_ERROR             = 1
                OTHERS                    = 2.
      IF SY-SUBRC <> 0.
        WRITE:/ SY-SUBRC.
      ENDIF.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    FORM DATA_RETRIEVAL.
      SELECT EBELN EBELP
       UP TO 10 ROWS
        FROM EKPO
        INTO CORRESPONDING FIELDS OF TABLE  IT_EKKO.
    ENDFORM.                    " DATA_RETRIEVAL
    *                      FORM SET_PF_STATUS                              *
    FORM SET_PF_STATUS USING RT_EXTAB   TYPE  SLIS_T_EXTAB.
      SET PF-STATUS 'STANDARD_FULLSCREEN1' EXCLUDING RT_EXTAB.
    ENDFORM.                    "set_pf_status
    *&      Form  user_command
    *       text
    *      -->R_UCOMM    text
    *      -->RS_SELFIELDtext
    FORM USER_COMMAND  USING R_UCOMM LIKE SY-UCOMM
                             RS_SELFIELD TYPE SLIS_SELFIELD.
    <b>
    *then insert the following code in your USER_COMMAND routine...
      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.</b>*modify
      CASE R_UCOMM.
        WHEN '&IC1'.
          CHECK RS_SELFIELD-TABINDEX > 0.
          IF RS_SELFIELD-VALUE EQ '6000000001'.
            CALL TRANSACTION 'ZDF2'.
          ENDIF.
        WHEN 'REFRESH'.
          READ TABLE IT_EKKO INDEX  RS_SELFIELD-TABINDEX.
          IF SY-SUBRC = 0.
            READ TABLE IT_BACKUP INDEX RS_SELFIELD-TABINDEX.
            IF SY-SUBRC = 0.
              IF IT_EKKO <> IT_BACKUP.
    *  then do your check
              ENDIF.
            ENDIF.
          ENDIF.
          PERFORM DATA_RETRIEVAL.
          RS_SELFIELD-REFRESH = 'X'.
      ENDCASE.
    ENDFORM.                    "user_command
    regards
    vijay

  • Get data in editable ALV back to internal table without data_changed ev?

    Hi,
       I have an editable ALV using classes to whch I have users the option to edit directly on the screen or upload data from an excel. The event data_changed gets triggered when users edit the table on the screen.
    However when EXCEL is uploaded, I refresh the table display. So, I need a way to get the data from the ALV into a internal table to check which rows were update using the excel and save them into the db table.
    Prakash

    Hi!
    For more information, inspect programs suiting the mask "BCALVEDIT*" and the thread with header "How to make a row of ALV editable " (I know this is some more steps further from your demand but it may be useful) at URL " How to make a row of ALV editable " .
    If you want to study more BC412 "EnjoySAP Controls" may help you.
    *--Serdar

  • Update out_tab data in editable ALV

    Hi,
    I am working on editable ALV using oops. I want to insert the data into database tables after user insert the data in ALV based on the application tool bar button action.
    How to refresh the data in out_tab, If user click the application tool bar button then I need to save the ALV grid data in database table.
    Please give me the valuable suggestions.
    - Rayudu

    solved my self

  • Save changes to field in ALV, 'GET_GLOBALS_FROM_SLVC_FULLSCR' not working

    Hi,
    I'm supposed to save the changes to an editable field in an ALV of an existing program.
    In the program they are displaying the ALV using
    CALL METHOD pcl_alvgrid_principal->set_table_for_first_display
    I searched the forum for a way to capture the changes to the field, and found a lot of people mentioning the function
    'GET_GLOBALS_FROM_SLVC_FULLSCR'.
    Now, I don't know if this function is supposed to work only with a list display or something, but when I try to implement this function in this program, the returning value of ref_grid is always initial...
    Does anyone know another solution?
    ThX!

    I haven't noticed that behaviour while using the FM GET_GLOBALS_FROM_SLVC_FULLSCR with the FM REUSE_ALV_GRID_DISPLAY.
    Instead of getting the ALV object and using it's method, you may try using the FM:
    REUSE_ALV_GRID_LAYOUT_INFO_GET - To get the required info from ALV
    REUSE_ALV_GRID_LAYOUT_INFO_SET - To set the necessary info to ALV.
    Regards,
    Naimesh Patel

  • How to change date format in alv report

    hi ,
    i wanna change date format which is in yyyy.mm.dd to mm/dd/yyyy in alv report.
    plz advise.
    thanks
    sudheer

    Hi sudheer,
    There is no direst Fm fro that.
    But u can follw the below way. it worked for me. kindly chk it.
    [code]DATA: V_DATE_IN(10) TYPE C,
    V_DATE_SAP TYPE SY-DATUM.
    V_DATE_IN = '01.01.2005.'.
    CONCATENATE V_DATE_IN+6(4) "<--for Year
    V_DATE_IN+3(2) "<--for month
    V_DATE_IN+0(2) "<--for Day
    INTO V_DATE_SAP.
    now V_DATE_SAP will have value like 20060101.
    now use.
    CONVERSION_EXIT_PDATE_OUTPUT Conversion Exit for Domain GBDAT: YYYYMMDD -> DD/MM/YYYY[/code]
    regards
    anver
    <b><i>if hlped pls mark points</i></b>

  • Changing Date Format in ALV List for VKM1 transaction

    Hi All,
    I have to change date format to MM/DD/YY in the ALV list display of VKM1 transaction. There are user exits available.
    I am trying to use EDIT_MASK option of the field catalog.. Without changing the code, I give value as __:__:__ or MM/DD/YY in the EDIT_MASK field of the fieldcatalog during DEBUG. Just before the RESUSE_ALV_LIST_DISPLAY is called.. but it is NOT showing any change in the display.
    Please advice any alternate way to do the same.
    Thanks a lot.

    Hi,
    If u`ve access to User parameters, try tcode SU01 and give ur user name in the first parameter. Navigate to the defaults tab and you can find options for Date display and decimals display. Now identify the date format to your liking and change the same. From the next logon in ur user name, changes are reflected on your reports.
    Reward points if my answer is worthfull.
    Regards

  • 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

  • Retrieve changed record from editable alv grid

    hello,
          i am new to alv grid... i am facing some problems working on it... plz help me solve my problems...
          i have created an alv grid displaying the timesheet of some employee's...
          the worktime cells are editable and rest of the information is read only...
          the worktime is changed and then a SAVE button is pushed...
          how do i retrieve the changed time into my internal table?
          once i update the internal table, i can modify the database table...
    thank you.

    Hi,
    Refer this program:-
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = v_rep_id       " report id
         i_callback_pf_status_set          = 'PF'           " for PF-STATUS
         i_callback_user_command           = 'USER_COMMAND' " for User-Command
         is_layout                         = wa_layout      " for layout
         it_fieldcat                       = it_field       " field catalog
         it_sort                           = it_sort        " sort info
        TABLES
          t_outtab                          = it_final      " internal table
       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.
    *&      Form  pf
    *       SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
    *       ON WHICH THE ALV GRID IS DISPLAYED
    *       -->RT_EXTAB
    FORM pf USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZTG_STAT'.
    ENDFORM.                    "pf
    *&      Form  USER_COMMAND
    *       SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
    *       AND EXECUTE THE APPROPIATE CODE
    *      -->LV_OKCODE   used to capture the function code
    *                     of the user-defined push-buttons
    *      -->L_SELFIELD   text
    FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
    * assign the function code to variable v_okcode
      lv_okcode = sy-ucomm.
    * handle the code execution based on the function code encountered
      CASE lv_okcode.
    * when the function code is SAVE then save records into internal table
        WHEN 'SAVE'.
    * to reflect the data changed into internal table
          DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
          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.
    "now at this time you have modified internal table
    * refresh the ALV Grid output from internal table
          l_selfield-refresh = c_check.
    "alv output is refreshed as per changes in internal table
    "now you can include code to modify your ztable from internal table
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    Regards,
    Tarun

  • Regarding validating data in editable ALV in OOPS

    I'm using the data_changed event in my ALV grid to validate the user's
    entry in the ALV grid. My code finds the errors when the user originaly
    enters the wrong data, highlights the errors in the grid, and popups u the
    list of error messages.
    My problem occurs when the user only fixes some of the errors and leavs
    some data errors still in the grid. The data_changed will check the lnes
    the user has fixed. However if they neglect to fix one of the errors,the
    code doesn't reread the entry since the data didn't change from the
    original entry. The error still exist and I don't want to allow the uer
    to continue until they have fixed all of the errors. Is there another
    event or coding that I can use to ensure the user fixes all of the errrs.
    I know I could loop through the ALV grid table outside of my methods, ut
    that would require rewriting all the checking again which seems very
    inefficient.
    Thanks,
    Phani.

    Check this link if it is useful:
    F4 Help in ALV Grid (using CL_GUI_ALV_GRID)
    Regards
    Neha

  • Validation of data in editable ALV report output for particular field

    Hi Experts,
    I have one input enabled field in ALV output. How to validate the data once user enters  in that field and press enter? Is it possible to capture the value, hit the enter after user enters the data?
    Thanks,
    Surya Prakash

    Halo Prakash,
    1 First you should registeer the ENTER Event.
    call method g_grid->register_edit_event
                   exporting
                      i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    2 Declare event handler method for Event data_changed of cl_gui_alv_grid.
    handle_data_changed
             for event data_changed of cl_gui_alv_grid
                 importing er_data_changed.
    3 Inside the Event handler method , you get the event parameter er_data_changed type ref to CL_ALV_CHANGED_DATA_PROTOCOL.
    loop at er_data_changed->mt_good_cells into ls_good.
          case ls_good-fieldname.
            when 'FIELD1'.
              call method check_FIELD1.
            when 'FIELD2 '.
              call method check_FIELD2
          endcase.
        endloop.
    4 Inside the Method check_FIELD1 and check_FIELD2 you can do the validation check .
    call method er_data_changed->get_cell_value( Passing the row no and field name).
    if the check  fails you can use add_protocol_entry to write the error.
    5 Finally call
    er_data_changed->display_protocol.
    Regards
    Arshad

  • How to save changed data from a input field to the source structure

    Hi,
    I have a small problem with the onChange event with HTML input fields.
    When changing a value of a input field or by creating a new value for a field the OnChange event is called by moving away the mouse pointer....
    get_form_field( 'field_name' ).
    But is it possible to write back the new value in the source field ls_screenstructure_field1 without using the OnInputProcessing?
    I ask because my application´s structures have a lot of fields that should be filled and changed by input fields.
    It´s not comfortable to request every new value with .. = request->get_form_field(... .
    Thanks for helping.
    Cheers,
    André

    you wanted a onchange for a htmlb:inputfield which would also trigger server event. try the following code.
    <htmlb:inputField id            = "test"
                                alignment     = "LEFT"
                                size          = "6"
                                required      = "TRUE"
                                doValidate    = "TRUE"
                                type          = "INTEGER"
                                 />
    <bsp:htmlbEvent id="myid" onClick="myonclick" name="ValueChanged" />
      <script for="test" event=onchange type="text/javascript">
    alert(this.value);
    ValueChanged();
    </SCRIPT>
    if the value in the inputfield is changed it would trigger a alert at the client side and also trigger a server event. now you can caputre the value in oninputprocessing.
    Hope this helps.
    do let us know if you need help in how to capture this value in oninputprocessing.
    Regards
    Raja

Maybe you are looking for

  • Windows 2008 R2 on Cisco UCS B200M networking problems

    This is driving me completely nuts.  Let me start by saying I am new to blade servers and Cisco UCS.  I did take an introduction class, and it seemed straight-forward enough.  I have a chassis with two B200M blades, on which I am trying to configure

  • The Mother of all Easy Questions...I hope!

    I just got Logic Studio recently giving me very little time to learn how to use it before needing to create accompaniments for a concert that's coming up. Having only ever used Garage Band (starting simple) in the past I am trying to figure out how t

  • Any one knows how to use Axis Framework in the SOAP Adapter Modules

    How to use Axis Framework in the SOAP Adapter? How to add custom handler modules? http://help.sap.com/saphelp_nw04/helpdata/en/45/a4f8bbdfdc0d36e10000000a114a6b/frameset.htm I went through the above link on help.sap.com. But still could not create a

  • Can i make a pdf with spreads out of several indesigndocuments?

    Hello, I have got this question: Imaging this case: I have 3 indesigndocuments, that should be in one pdf-document. So i make a booklet of the 3 indesigndocuments and then i can make a pdf of them. But I want the pages in the pdf shown spreadwise. (s

  • Satellite P70-A-120 - Win 8.1 booting problem

    Hello. I have a problem with the boot of my Satellite P70. The first time that I push the power button, it appears the screen with the Toshiba logo but Windows 8.1 doesnt start. If I power off the pc with the power button and push the power button an