ALV - Changed Data - CL_GUI_ALV_GRID

Hi,
  I´m doing an upload Button on my ALV Grid because the user must have
the option to upload data throw Excel File, when I upload those Records
to my Grid and them I uses the REFRESH_TABLE_DISPLAY Method the program
didn´t recognize those records as new Records them my Class Handle_changed_data
(cl_alv_changed_data_protocol) don´t check those records. There´s a way
to Upload those records and make the system recognise as new Records or
after the upload it´s possible to make the system see those new data
and uses the check_changed_data to check those data?
   Thanks, Xan

Hi Emir,
   Thanks for the answer. The problem is that I can´t use the REFRESH_TABLE_DISPLAY Method because when I use it the system don´t send the informations that I´ve updated to the DATA_CHANGED Event. There´s a way to make the system Recognize the Records uploaded throw the Excel File?
   For Example: When I use the Insert Button in the ALV this info goes to the MT_INSERTED_ROWS( CL_ALV_CHANGED_DATA_PROTOCOL ) or when I modify the data the info goes to the MT_MOD_CELLS, MT_GOOD_CELLS in the ( CL_ALV_CHANGED_DATA_PROTOCOL ), but when I insert the info in my Internal Table and execute the REFRESH_TABLE_DISPLAY it don´t send the info to these tables and don´t pass throw my Check Method.
   Thanks, Xan.

Similar Messages

  • How to retreive data from alv when using CL_GUI_ALV_GRID

    Hi All,
      I am using two subscreens to display 2 ALV grids in a screen using the OOPs concept and the class CL_GUI_ALV_GRID. I would like to download data from these two alv grids into an excel after any changes, i.e sort, filter or summation. I was able to capture data for sort and filter. The logic to capture summation and subtotals is becoming very complex. I need to simplify for better. I need help to see if there is any method which captures the changed data on the screen so that i can just call the method and retrieve the data to push into an internal table before downlaoding to excel.
    Your help is greatly appreciated.
    Thanks in advance.
    Roopa

    Step 1, define the method in class grid_hdr:
    METHODS:handle_data_changed CHANGING e_valid TYPE c.
    Step 2, process the method:
      METHOD  handle_data_changed.
        CALL METHOD zgrid->check_changed_data
          IMPORTING
            e_valid = e_valid.
      ENDMETHOD.                    "handle_data_changed
    Step 3, use the method in PAI:
      DATA l_valid TYPE c.
      CALL METHOD grid_hdr->handle_data_changed
        CHANGING
          e_valid = l_valid.
      IF l_valid = 'X'.
      ENDIF.
    Also you can search  BCALV_EDIT_* in your system.
    Edited by: SAM XIAO on Nov 17, 2009 8:03 AM

  • 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

  • ALV- Changing the output data and saving in database

    hi friends,
    I have to change the material description in the output and have to save the changes in database..
    For changing the description I have to raise a pop-up, then I have to give the required change and then save..
    How to do it?
    My code is as follows:
    TABLES : vbrk,vbrp,vbpa,adrc.
    TYPE-POOLS : slis.
    DATA: w_report_id  LIKE sy-repid.
    DATA: w_title    TYPE lvc_title VALUE      'DIPLAY CUSTOMER BILLING DOCUMENT'.
    DATA: w_layout   TYPE slis_layout_alv.
    DATA: w_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: w_events   TYPE slis_t_event.
    DATA: w_header   TYPE slis_t_listheader.
    DATA: sum LIKE vbrk-netwr.
    SELECT-OPTIONS:
         erdat FOR vbrk-erdat,
         vkorg FOR vbrp-vkorg_auft,
         kunag FOR vbrk-kunag.
    DATA : BEGIN OF itab OCCURS 0,
           fkdat TYPE vbrk-fkdat,
           kunrg TYPE vbrk-kunrg,
           name1 TYPE adrc-name1,
           vbeln TYPE vbrk-vbeln,
           augru_auft TYPE vbrp-augru_auft,
           netwr TYPE vbrk-netwr,
           waerk TYPE vbrk-waerk,
           vbtyp TYPE vbrk-vbtyp,
           fkart TYPE vbrk-fkart,
           END OF itab.
    DATA itab1 LIKE STANDARD TABLE OF itab.
    SELECT vbrkfkdat vbrkkunrg adrcname1 vbrkvbeln vbrp~augru_auft
           vbrknetwr vbrkwaerk
           INTO TABLE itab1
           FROM ( ( ( vbrk INNER JOIN vbrp ON vbrkvbeln = vbrpvbeln )
           INNER JOIN vbpa ON vbpavbeln = vbrkvbeln )
           INNER JOIN adrc ON adrcaddrnumber = vbpaadrnr )
           WHERE vbtyp = 'O'
           AND vbrk~erdat IN erdat
           AND vbrp~vkorg_auft IN vkorg
           AND vbrk~kunag IN kunag.
    w_report_id = sy-repid.
    PERFORM i_layout CHANGING w_layout.
    PERFORM i_fieldcat CHANGING w_fieldcat.
    SORT itab1 BY waerk fkart .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program = 'ZTRAINING2'
        i_grid_title       = w_title
        is_layout          = w_layout
        it_fieldcat        = w_fieldcat
        i_save             = 'A'
      TABLES
        t_outtab           = itab1
      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  i_fieldcat
          text
         -->P_W_FEILDCAT  text
    FORM i_fieldcat  CHANGING p_w_feildcat.
      DATA: l_line_fieldcat TYPE slis_fieldcat_alv.
      CLEAR l_line_fieldcat.
      l_line_fieldcat-fieldname = 'FKDAT'.
      l_line_fieldcat-ref_tabname = 'ITAB1'.
      l_line_fieldcat-edit_mask  = '__-__-____'.
      l_line_fieldcat-seltext_m = 'Billing Document date '.
      APPEND l_line_fieldcat TO w_fieldcat.
      CLEAR l_line_fieldcat.
      l_line_fieldcat-fieldname = 'KUNRG'.
      l_line_fieldcat-ref_tabname = 'ITAB1'.
      l_line_fieldcat-seltext_m = 'Cust no'.
      APPEND l_line_fieldcat TO w_fieldcat.
      CLEAR l_line_fieldcat.
      l_line_fieldcat-fieldname = 'NAME1'.
      l_line_fieldcat-ref_tabname = 'ITAB1'.
      l_line_fieldcat-seltext_m = 'Name of the reseller'.
      APPEND l_line_fieldcat TO w_fieldcat.
      CLEAR l_line_fieldcat.
      l_line_fieldcat-fieldname = 'VBELN'.
      l_line_fieldcat-ref_tabname = 'ITAB1'.
      l_line_fieldcat-seltext_m = 'Billing document number'.
      APPEND l_line_fieldcat TO w_fieldcat.
      CLEAR l_line_fieldcat.
      l_line_fieldcat-fieldname = 'AUGRU_AUFT'.
      l_line_fieldcat-ref_tabname = 'ITAB1'.
      l_line_fieldcat-seltext_m = 'Order reason'.
      APPEND l_line_fieldcat TO w_fieldcat.
      CLEAR l_line_fieldcat.
      l_line_fieldcat-fieldname = 'NETWR'.
      l_line_fieldcat-ref_tabname = 'ITAB1'.
      l_line_fieldcat-seltext_m = 'Amount'.
      APPEND l_line_fieldcat TO w_fieldcat.
      CLEAR l_line_fieldcat.
      l_line_fieldcat-fieldname = 'WAERK'.
      l_line_fieldcat-ref_tabname = 'ITAB1'.
      l_line_fieldcat-seltext_m = 'Currency'.
      APPEND l_line_fieldcat TO w_fieldcat.
    ENDFORM.                    "i_fieldcat
    *&      Form  i_layout
          text
         -->P_W_LAYOUT text
    FORM i_layout  CHANGING p_w_layout.
      CLEAR w_layout.
      w_layout-colwidth_optimize = 'X'.
      w_layout-edit = 'X'.
    ENDFORM.                    " i_layout
    Thanks,
    Revathi Raju.

    Check out the following link for top_of_page event in OOPs ALV.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
    You can also check out the following program.
    DATA: save_ok LIKE sy-ucomm,
    g_container TYPE scrfname VALUE 'CC1',
    g_grid TYPE REF TO cl_gui_alv_grid,
    g_custom_container TYPE REF TO cl_gui_custom_container,
    gt_fieldcat TYPE lvc_t_fcat,
    g_max TYPE i VALUE 100.
    * declarations for top of page event
    Data: gv_c_split type ref to cl_gui_splitter_container,
    gv_c_ptv type ref to cl_gui_container,
    gv_alv_ptv type ref to cl_gui_alv_grid,
    o_dd_doc TYPE REF TO cl_dd_document,
    text TYPE sdydo_text_element,
    o_split type ref to cl_gui_easy_splitter_container,
    o_top type ref to cl_gui_container,
    o_bot type ref to cl_gui_container,
    gv_c_vp type ref to cl_gui_container.
    * end of declaration for top of page.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    *class lcl_application_dc definition deferred.
    DATA: o_event_receiver TYPE REF TO lcl_event_receiver.
    * g_dc type ref to lcl_application_dc.
    DATA: gt_outtab TYPE TABLE OF sbook.
    * CLASS lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver DEFINITION.
    PUBLIC SECTION.
    METHODS: handle_f4 FOR EVENT onf4 OF cl_gui_alv_grid
    IMPORTING e_fieldname
    es_row_no
    er_event_data
    et_bad_cells
    e_display,
    handle_top_of_page FOR EVENT top_of_page OF cl_gui_alv_grid
    IMPORTING e_dyndoc_id.
    METHODS: reset.
    METHODS: show_f4.
    PRIVATE SECTION.
    * attributes for creating an own F4-Help
    * (using a second ALV Grid Control
    DATA: f4_grid TYPE REF TO cl_gui_alv_grid,
    f4_custom_container TYPE REF TO cl_gui_custom_container.
    TYPES: BEGIN OF ty_f4.
    TYPES: value TYPE s_class.
    TYPES: descr(20) TYPE c.
    TYPES: END OF ty_f4.
    DATA: f4_itab TYPE TABLE OF ty_f4.
    DATA: f4_fieldcatalog TYPE lvc_t_fcat.
    * attributes to store event parameters
    * (after the CALL SCREEN command, the event parameters
    * are not accessible)
    TYPES: BEGIN OF onf4_event_parameters_type.
    TYPES: c_fieldname TYPE lvc_fname.
    TYPES: cs_row_no TYPE lvc_s_roid.
    TYPES: cr_event_data TYPE REF TO cl_alv_event_data.
    TYPES: ct_bad_cells TYPE lvc_t_modi.
    TYPES: c_display TYPE char01.
    TYPES: END OF onf4_event_parameters_type.
    DATA: f4_params TYPE onf4_event_parameters_type.
    * Methods to create own F4-Help
    * (This is done using a second ALV Grid Control)
    METHODS: init_f4.
    METHODS: build_fieldcatalog.
    METHODS: fill_f4_itab .
    METHODS: on_double_click FOR EVENT double_click OF cl_gui_alv_grid
    IMPORTING es_row_no.
    ENDCLASS. "lcl_application_f4 DEFINITION
    * CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
    *§2. Implement an event handler method for event ONF4.
    METHOD handle_f4.
    * Save event parameter as global attributes of this class
    * (maybe solved differently if you use a function module!)
    f4_params-c_fieldname = e_fieldname.
    f4_params-cs_row_no = es_row_no.
    f4_params-cr_event_data = er_event_data.
    f4_params-ct_bad_cells = et_bad_cells.
    f4_params-c_display = e_display.
    *§3. Call your own f4 help. To customize your popup check
    * first if the cell is ready for input (event parameter E_DISPLAY).
    * (parameter E_DISPLAY is checked later in method on_double_click)
    * (Probably, you would call a function module at this point,
    * pass the needed event parameter and call the popup screen
    * within that function module. This is not done in this example
    * to avoid scattering its code).
    CALL SCREEN 101 STARTING AT 10 10.
    *§7. Inform the ALV Grid Control that an own f4 help has been processed
    * to suppress the standard f4 help.
    er_event_data->m_event_handled = 'X'.
    ENDMETHOD. "on_f4
    METHOD show_f4.
    * DATA: ls_outtab TYPE sbook.
    * initialize own f4 help if needed
    IF f4_custom_container IS INITIAL.
    CALL METHOD init_f4.
    ENDIF.
    CALL METHOD fill_f4_itab.
    * refresh list of values in f4 help and show it
    CALL METHOD f4_grid->refresh_table_display.
    * CAUTION: Do not use method REFRESH_TABLE_DISPLAY for
    * your editable ALV Grid instances while handling events
    * DATA_CHANGED or ONf4. You would overwrite intermediate
    * values of your output table on frontend.
    * 'f4_grid' is a non-editable ALV Grid Control for the
    * application specific F4-Help. Therefore, calling
    * REFRESH_TABLE_DISPLAY for this instance has no
    * negative effect.
    CALL METHOD cl_gui_cfw=>flush.
    ENDMETHOD. "show_f4
    METHOD init_f4.
    DATA: ls_f4_layout TYPE lvc_s_layo.
    * build fieldcatalog entries for f4
    CALL METHOD build_fieldcatalog.
    * create controls
    CREATE OBJECT f4_custom_container
    EXPORTING container_name = 'CC_ONF4'.
    CREATE OBJECT f4_grid
    EXPORTING i_parent = f4_custom_container.
    * hide toolbar
    ls_f4_layout-no_toolbar = 'X'.
    CALL METHOD f4_grid->set_table_for_first_display
    EXPORTING
    is_layout = ls_f4_layout
    CHANGING
    it_fieldcatalog = f4_fieldcatalog
    it_outtab = f4_itab.
    * register event double click on backend
    SET HANDLER me->on_double_click FOR f4_grid.
    * flush since 'ls_layout' is local!
    CALL METHOD cl_gui_cfw=>flush.
    ENDMETHOD. "init_f4
    METHOD fill_f4_itab.
    DATA ls_f4_itab TYPE ty_f4.
    * Delete all entries in f4_itab to determine
    * offered values dynamically
    CLEAR f4_itab[].
    ls_f4_itab-value = 'C'.
    ls_f4_itab-descr = text-t03. "Business Class
    APPEND ls_f4_itab TO f4_itab.
    ls_f4_itab-value = 'Y'.
    ls_f4_itab-descr = text-t04. "Economie Class
    APPEND ls_f4_itab TO f4_itab.
    ls_f4_itab-value = 'F'.
    ls_f4_itab-descr = text-t05. "First Class
    APPEND ls_f4_itab TO f4_itab.
    ENDMETHOD. "fill_f4_itab
    METHOD build_fieldcatalog.
    DATA: ls_fcat TYPE lvc_s_fcat.
    CLEAR ls_fcat.
    ls_fcat-fieldname = 'VALUE'.
    ls_fcat-coltext = text-t02.
    * ls_fcat-inttype = 'S_CLASS'.
    ls_fcat-outputlen = 5.
    APPEND ls_fcat TO f4_fieldcatalog.
    CLEAR ls_fcat.
    ls_fcat-fieldname = 'DESCR'.
    ls_fcat-coltext = text-t01.
    ls_fcat-inttype = 'C'.
    ls_fcat-outputlen = 20.
    APPEND ls_fcat TO f4_fieldcatalog.
    ENDMETHOD. "build_fieldcatalog
    METHOD on_double_click.
    *§5. If not already caught by your own f4 help, check whether
    * the triggered cell was ready for input by using E_DISPLAY
    * and if not, exit.
    IF f4_params-c_display EQ 'X'.
    LEAVE SCREEN.
    ENDIF.
    *§6. After the user selected a value, pass it to the ALV Grid Control:
    *§ 6a. Define a field symbol of type: LVC_T_MODI and a structure of
    * type LVC_S_MODI to pass the value later on.
    FIELD-SYMBOLS <itab> TYPE lvc_t_modi.
    DATA: ls_modi TYPE lvc_s_modi,
    ls_f4_itab TYPE ty_f4.
    *§ 6b. Dereference attribute M_DATA into your field symbol and add
    * the selected value to the table to which this symbol points to.
    ASSIGN f4_params-cr_event_data->m_data->* TO <itab>.
    ls_modi-row_id = f4_params-cs_row_no-row_id.
    ls_modi-fieldname = f4_params-c_fieldname.
    READ TABLE f4_itab INTO ls_f4_itab INDEX es_row_no-row_id.
    ls_modi-value = ls_f4_itab-value.
    APPEND ls_modi TO <itab>.
    LEAVE TO SCREEN 0.
    ENDMETHOD. "on_double_click
    METHOD reset.
    FIELD-SYMBOLS <itab> TYPE lvc_t_modi.
    ASSIGN f4_params-cr_event_data->m_data->* TO <itab>.
    CLEAR <itab>[].
    ENDMETHOD. "reset
    METHOD handle_top_of_page.
    text = 'Top of page for program ZAMIT_SPLIT_CONTAINER'.
    CALL METHOD e_dyndoc_id->add_text
    EXPORTING text = text
    sap_fontsize = 'LARGE'
    sap_style = 'HEADING'.
    CALL METHOD e_dyndoc_id->display_document
    EXPORTING parent = o_top.
    ENDMETHOD. "handle_top_of_page
    ENDCLASS. "lcl_application_f4 IMPLEMENTATION
    END-OF-SELECTION.
    CALL SCREEN 100.
    * MODULE PBO OUTPUT *
    MODULE pbo OUTPUT.
    SET PF-STATUS 'MAIN100'.
    SET TITLEBAR 'MAIN100'.
    IF g_custom_container IS INITIAL.
    PERFORM create_and_init_alv CHANGING gt_outtab[]
    gt_fieldcat.
    ENDIF.
    ENDMODULE. "pbo OUTPUT
    * MODULE PAI INPUT *
    MODULE pai INPUT.
    save_ok = sy-ucomm.
    CLEAR sy-ucomm.
    CASE save_ok.
    WHEN 'EXIT' OR 'BACK' OR 'CANCEL'.
    PERFORM exit_program.
    WHEN 'SWITCH'.
    PERFORM switch_edit_mode.
    WHEN OTHERS.
    * do nothing
    ENDCASE.
    ENDMODULE. "pai INPUT
    * FORM EXIT_PROGRAM *
    FORM exit_program.
    LEAVE PROGRAM.
    ENDFORM. "exit_program
    *& Form build_fieldcat
    * text
    * -->PT_FIELDCAT text
    FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
    DATA ls_fcat TYPE lvc_s_fcat.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
    i_structure_name = 'SBOOK'
    CHANGING
    ct_fieldcat = pt_fieldcat.
    LOOP AT pt_fieldcat INTO ls_fcat.
    * Exchange smoker field with invoice field - just to
    * make the dependance between SMOKER and CLASS more transparent
    * (Smoking is only allowed in the first class).
    IF ls_fcat-fieldname EQ 'SMOKER'.
    ls_fcat-col_pos = 11.
    ls_fcat-outputlen = 10.
    ls_fcat-edit = 'X'.
    * Field 'checktable' is set to avoid shortdumps that are caused
    * by inconsistend data in check tables. You may comment this out
    * when the test data of the flight model is consistent in your system.
    ls_fcat-checktable = '!'. "do not check foreign keys
    MODIFY pt_fieldcat FROM ls_fcat.
    ELSEIF ls_fcat-fieldname EQ 'INVOICE'.
    ls_fcat-col_pos = 7.
    MODIFY pt_fieldcat FROM ls_fcat.
    ELSEIF ls_fcat-fieldname EQ 'CLASS'.
    ls_fcat-edit = 'X'.
    ls_fcat-outputlen = 5.
    ls_fcat-checktable = '!'. "do not check foreign keys
    MODIFY pt_fieldcat FROM ls_fcat.
    ENDIF.
    ENDLOOP.
    ENDFORM. "build_fieldcat
    *& Form create_and_init_alv
    * text
    * -->PT_OUTTAB text
    * -->PT_FIELDCAT text
    FORM create_and_init_alv CHANGING pt_outtab TYPE STANDARD TABLE
    pt_fieldcat TYPE lvc_t_fcat.
    DATA: lt_exclude TYPE ui_functions,
    ls_layout TYPE lvc_s_layo.
    CREATE OBJECT g_custom_container
    EXPORTING container_name = g_container.
    * CREATE OBJECT g_grid
    * EXPORTING i_parent = g_custom_container.
    CREATE OBJECT gv_c_split
    EXPORTING
    * link_dynnr = lv_dynnr
    * link_repid = lv_repid
    parent = g_custom_container
    rows = 2
    columns = 1
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    others = 3 .
    CALL METHOD gv_c_split->set_border
    EXPORTING
    border = space.
    CALL METHOD gv_c_split->get_container
    EXPORTING
    row = 1
    column = 1
    RECEIVING
    container = gv_c_ptv.
    CALL METHOD gv_c_split->set_row_height
    EXPORTING
    id = 1
    height = 20
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    OTHERS = 6 .
    CALL METHOD gv_c_split->get_container
    EXPORTING
    row = 2
    column = 1
    RECEIVING
    container = gv_c_vp .
    CALL METHOD gv_c_split->set_row_height
    EXPORTING
    id = 2
    height = 10
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    OTHERS = 3 .
    CREATE OBJECT o_split
    EXPORTING
    parent = gv_c_ptv
    with_border = 1
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 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.
    o_top = o_split->top_left_container.
    o_bot = o_split->bottom_right_container.
    CREATE OBJECT gv_alv_ptv
    EXPORTING
    i_parent = o_bot
    EXCEPTIONS
    error_cntl_create = 1
    error_cntl_init = 2
    error_cntl_link = 3
    error_dp_create = 4
    others = 5 .
    CREATE OBJECT g_grid
    EXPORTING
    i_parent = gv_c_vp
    EXCEPTIONS
    error_cntl_create = 1
    error_cntl_init = 2
    error_cntl_link = 3
    error_dp_create = 4
    others = 5 .
    PERFORM build_fieldcat CHANGING pt_fieldcat.
    * Optionally restrict generic functions to 'change only'.
    * (The user shall not be able to add new lines).
    PERFORM exclude_tb_functions CHANGING lt_exclude.
    PERFORM build_data CHANGING pt_outtab.
    ls_layout-grid_title = 'F4 help implemented for field CLASS'.
    CREATE OBJECT o_event_receiver.
    SET HANDLER o_event_receiver->handle_top_of_page FOR gv_alv_ptv.
    SET HANDLER o_event_receiver->handle_top_of_page FOR g_grid.
    CREATE OBJECT o_dd_doc EXPORTING style = 'ALV_GRID'
    no_margins = 'X'.
    CALL METHOD gv_alv_ptv->set_table_for_first_display
    EXPORTING
    is_layout = ls_layout
    CHANGING
    it_outtab = pt_outtab[]
    it_fieldcatalog = pt_fieldcat
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    OTHERS = 4.
    CALL METHOD g_grid->set_table_for_first_display
    EXPORTING
    it_toolbar_excluding = lt_exclude
    is_layout = ls_layout
    CHANGING
    it_fieldcatalog = pt_fieldcat
    it_outtab = pt_outtab[].
    CALL METHOD gv_alv_ptv->list_processing_events
    EXPORTING
    i_event_name = 'TOP_OF_PAGE'
    i_dyndoc_id = o_dd_doc.
    * register f4 for field CLASS
    PERFORM register_events.
    * Set editable cells to ready for input initially
    CALL METHOD g_grid->set_ready_for_input
    EXPORTING
    i_ready_for_input = 1.
    ENDFORM. "CREATE_AND_INIT_ALV
    *& Form exclude_tb_functions
    * text
    * -->PT_EXCLUDE text
    FORM exclude_tb_functions CHANGING pt_exclude TYPE ui_functions.
    * Only allow to change data not to create new entries (exclude
    * generic functions).
    DATA ls_exclude TYPE ui_func.
    ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
    APPEND ls_exclude TO pt_exclude.
    ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
    APPEND ls_exclude TO pt_exclude.
    ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
    APPEND ls_exclude TO pt_exclude.
    ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
    APPEND ls_exclude TO pt_exclude.
    ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
    APPEND ls_exclude TO pt_exclude.
    ENDFORM. " EXCLUDE_TB_FUNCTIONS
    *& Form build_data
    * text
    * --> p1 text
    * <-- p2 text
    FORM build_data CHANGING pt_outtab TYPE STANDARD TABLE.
    DATA: ls_sbook TYPE sbook,
    l_index TYPE i.
    SELECT * FROM sbook INTO TABLE gt_outtab UP TO g_max ROWS.
    IF sy-subrc NE 0.
    PERFORM generate_entries CHANGING pt_outtab.
    ENDIF.
    LOOP AT pt_outtab INTO ls_sbook.
    l_index = sy-tabix.
    CLEAR ls_sbook-class.
    * Alternate between smoker and non smoker to make
    * it more obvious what this example is about
    l_index = l_index MOD 2.
    IF l_index EQ 1.
    ls_sbook-smoker = 'X'.
    ELSE.
    ls_sbook-smoker = ' '.
    ENDIF.
    MODIFY pt_outtab FROM ls_sbook.
    ENDLOOP.
    ENDFORM. " build_data
    *& Form generate_entries
    * text
    * -->PT_SBOOK text
    FORM generate_entries CHANGING pt_sbook TYPE STANDARD TABLE.
    DATA: ls_sbook TYPE sbook,
    l_month(2) TYPE c,
    l_day(2) TYPE c,
    l_date(8) TYPE c,
    l_prebookid TYPE i.
    ls_sbook-carrid = 'LH'.
    ls_sbook-connid = '0400'.
    ls_sbook-forcurkey = 'DEM'.
    ls_sbook-loccurkey = 'USD'.
    ls_sbook-custtype = 'B'.
    DO 110 TIMES.
    l_prebookid = sy-index.
    ls_sbook-forcuram = sy-index * 10.
    ls_sbook-loccuram = ls_sbook-loccuram * 2.
    ls_sbook-customid = sy-index.
    ls_sbook-counter = 18.
    ls_sbook-agencynum = 11.
    l_month = sy-index / 10 + 1.
    DO 2 TIMES.
    l_day = 3 + l_month + sy-index * 2.
    l_date+0(4) = '2000'.
    l_date+4(2) = l_month.
    l_date+6(2) = l_day.
    ls_sbook-fldate = l_date.
    SUBTRACT 3 FROM l_day.
    ls_sbook-order_date+0(6) = l_date+0(6).
    ls_sbook-order_date+6(2) = l_day.
    ls_sbook-bookid = l_prebookid * 2 + sy-index.
    IF sy-index EQ 1.
    ls_sbook-smoker = 'X'.
    ELSE.
    ls_sbook-smoker = space.
    ENDIF.
    ls_sbook-luggweight = l_prebookid * 10.
    IF ls_sbook-luggweight GE 1000.
    ls_sbook-wunit = 'G'.
    ls_sbook-class = 'C'.
    ELSE.
    ls_sbook-wunit = 'KG'.
    ls_sbook-class = 'Y'.
    ENDIF.
    IF ls_sbook-bookid > 40 AND ls_sbook-wunit EQ 'KG'.
    ls_sbook-invoice = 'X'.
    ENDIF.
    IF ls_sbook-bookid EQ 2.
    ls_sbook-cancelled = 'X'.
    ls_sbook-class = 'F'.
    ENDIF.
    APPEND ls_sbook TO pt_sbook.
    ENDDO.
    ENDDO.
    ENDFORM. " generate_entries
    *& Form register_events
    * text
    FORM register_events.
    *§1. Register event ONF4 at frontend using method
    * register_f4_for_fields. For this purpose, you pass a table
    * with all fields, for which you want to implement your own
    * f4 help.
    * remark: If you want to use an own f4 help for fields where
    * no standard f4 help exists set field F4AVAILABL for
    * this field in the fieldcatalog.
    DATA: lt_f4 TYPE lvc_t_f4 WITH HEADER LINE.
    CLEAR lt_f4.
    lt_f4-fieldname = 'CLASS'.
    * If you would like to deregister the field again,
    * pass value SPACE with field 'register'.
    lt_f4-register = 'X'.
    *§ 1b. If the value range in your f4 help depends on other
    * values of cells that are input enabled, set the
    * GETBEFORE parameter.
    * The consequence is that the ALV Grid Control raises
    * event DATA_CHANGED before the f4 help is called to
    * check values that the f4 help depends on.
    lt_f4-getbefore = 'X'.
    * The next parameter is used to change values after onf4 has
    * been processed. The ALV Grid Control will raise
    * event DATA_CHANGED afterwards, if you set it.
    lt_f4-chngeafter = space.
    INSERT TABLE lt_f4.
    CALL METHOD g_grid->register_f4_for_fields
    EXPORTING
    it_f4 = lt_f4[].
    * register events for abap objects (backend)
    SET HANDLER o_event_receiver->handle_f4 FOR g_grid.
    ENDFORM. " register_events
    * MODULE status_0101 OUTPUT
    MODULE status_0101 OUTPUT.
    SET PF-STATUS 'POPUP'.
    SET TITLEBAR 'POPUP'.
    CALL METHOD o_event_receiver->show_f4.
    ENDMODULE. " STATUS_0101 OUTPUT
    *& Module USER_COMMAND_0101 INPUT
    * text
    MODULE user_command_0101 INPUT.
    PERFORM user_command.
    ENDMODULE. " USER_COMMAND_0101 INPUT
    *& Form user_command
    * text
    FORM user_command.
    DATA: save_ok TYPE sy-ucomm.
    save_ok = sy-ucomm.
    CLEAR sy-ucomm.
    CASE save_ok.
    WHEN 'CANCEL'.
    CALL METHOD o_event_receiver->reset.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDFORM. "user_command
    *& Form switch_edit_mode
    * text
    FORM switch_edit_mode.
    IF g_grid->is_ready_for_input( ) EQ 0.
    * set edit enabled cells ready for input
    CALL METHOD g_grid->set_ready_for_input
    EXPORTING
    i_ready_for_input = 1.
    ELSE.
    * lock edit enabled cells against input
    CALL METHOD g_grid->set_ready_for_input
    EXPORTING
    i_ready_for_input = 0.
    ENDIF.
    ENDFORM. "switch_edit_mode
    For popup try this
    reward if helpfull
    Regards
    Pavan

  • How to save only changed data of ALV in a local table ?

    Hi everyone,
    I created and alv with cl_gui_alv_grid, and I made it editable
    Now I need that when I click on a button only the changed data to be saved on a local (internal) table
    Is there a way I can do that ?
    I tried with methods like check_changed_data() but they don't return a table like that
    Regards,
    Dren Selimi

    ok than
    class lcl_event_receiver definition.
         methods:
    * Handle Data Changed
         handle_data_changed
         for event data_changed of cl_gui_alv_grid
         importing er_data_changed,
    endclass.                    "lcl_event DEFINITION
    class lcl_event_receiver implementation.
         method handle_data_changed.
              data: ls_good type lvc_s_modi.
              loop at er_data_changed->mt_good_cells into ls_good.
                   read table gt_table into gs_table index ls_good-index. "is your changed row in ALV
                    ls_good-fieldname "is your changed field
                   if ls_good-fieldname eq 'MATNR'.
                        gs_table-matnr " is your changed field old value.
                   endif. "i couldn't find a dynamic solution for old value
                   "if you do not have so many columns in alv you can use this solution
                    ls_good-value "is your changed field new value
                   append these values to your changed field table.
                   modify gt_table from gs_table index ls_good-index.           
              endloop.
              call method g_alvgrid->refresh_table_display.
         endmethod.
    endclass.

  • Getting changed data back from editable ALV...

    Hello Gurus,
    I am working on ALV using standard ALV function module REUSE_ALV_GRID_DISPLAY. Now, To make the fields editale, I am using flag EDIT = 'X' in field catalog. This working fine.
    Now, when the data is changed in ALV grid and user clicks on SAVE button that I have programmed in i_callback_usercommand, how can I get the changed data back from editable ALV so that I can change data in custom table ?
    Please help.
    Regards,
    Rajesh.

    I see that the method CHECK_CHANGED_DATA is used. I am also doing it as follows. But how do I get the changed data back in table. There are no table parameters in
    CALL METHOD REF_GRID->CHECK_CHANGED_DATA .
    DATA: 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.
    Please guide

  • ALV Grid data changed

    Hello;
    i am using fm REUSE_ALV_GRID (not OO) to display an internal table. The user wants to change the data in a certain cell. I have marked this cell as editable and it works fine. I want to learn what to check in the event of data_changed. I have added this event in table ALV_EVENTS and directed to a subroutine. What parameters should i pass to the subroutine and what should i check to read the relevant line? Is it possible to control changes in more than one line?
    Thx
    Ali

    <i>Is it possible to control changes in more than one line?</i>
    yes.
    for usage of the method, and editable grid please refer the sample code.
    REPORT  ZTESTDFALV1                             .
    *Data Declaration
    DATA: BEGIN OF T_EKKO,
      EBELN TYPE EKPO-EBELN,
      EBELP TYPE EKPO-EBELP,
    END OF T_EKKO.
    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,
          GD_REPID     LIKE SY-REPID.
    *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>DATA: GD_REPID LIKE SY-REPID, "Exists
      REF_GRID TYPE REF TO CL_GUI_ALV_GRID. "new
    *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>
      CASE R_UCOMM.
        WHEN '&IC1'.
          CHECK RS_SELFIELD-TABINDEX > 0.
          IF RS_SELFIELD-VALUE EQ '6000000001'.
            CALL TRANSACTION 'ZDF2'.
          ENDIF.
        WHEN 'ENTER'.
          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

  • How to get changed data in ALV in Web Dynpro for ABAP

    METHOD on_data_check .
    DATA:
        node_spfli                          TYPE REF TO if_wd_context_node,
        node_sflight                        TYPE REF TO if_wd_context_node,
        itab_sflight2                        TYPE if_display_view=>elements_sflight.
      node_spfli = wd_context->get_child_node( name = if_display_view=>wdctx_spfli ).
      node_sflight = node_spfli->get_child_node( name = if_display_view=>wdctx_sflight ).
      CALL METHOD node_sflight->get_static_attributes_table
        IMPORTING
          table = itab_sflight2.
    this code is ..get all data(changed and not changed)
    but i want get changed data only, not all data.
    how to get changed data?
    Edited by: Ki-Joon Seo on Dec 27, 2007 6:04 AM

    Hi,
    To get only the changed data in the ALV grid of a WD, you need to capture the "ON_DATA_CHECK" of the ALV grid.
    To this please do the following in the ALV initialization of the ALV table settings :
        lr_table_settings->set_data_check(
                IF_SALV_WD_C_TABLE_SETTINGS=>DATA_CHECK_ON_CELL_EVENT ).
    You may also do this:
        lr_table_settings->set_data_check(            IF_SALV_WD_C_TABLE_SETTINGS=>DATA_CHECK_ON_CHECK_EVENT)
    The above two ways would depend on when do you need to check for the changed data. If you want to check the data as soon as it is entered, then use the first method. Else, use the second method.
    You need to register an EVENT HANDLER for this event.(You may do this in your VIEW or Component Controller).
    In this Event handler, you would find an importing parameter R_PARAM which is a ref type of      IF_SALV_WD_TABLE_DATA_CHECK.
    The attribute T_MODIFIED_CELLS of this interface IF_SALV_WD_TABLE_DATA_CHECK will contain the modified cells of the ALV with the old & new values.

  • How to update changed data in alv grid.

    hi experts,
    i have a editable alv report how to update the changed data on the grid to database table when i click save.
    can anybody tell me how to do this if possible with example.
    thanks in advance.
    regards,
    venu

    The code below isn't a working program, but has most of what you should need.  Field-symbol <dyn_table> will always have what is in the grid.
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                   <dyn_wa>.
    DATA: pt_fieldcat TYPE lvc_t_fcat,
          ls_fcat TYPE lvc_s_fcat,
          new_table TYPE REF TO data,
          new_line TYPE REF TO data.
    CREATE OBJECT g_custom_container
          EXPORTING container_name = g_container.
    CREATE OBJECT g_grid EXPORTING i_parent = g_custom_container.
    CLEAR ls_fcat.
    ls_fcat-fieldname = 'MATERIAL'.
    ls_fcat-datatype  = 'CHAR'.
    ls_fcat-intlen    = 18.
    ls_fcat-outputlen = 18.
    ls_fcat-coltext   = 'Material'.
    ls_fcat-edit      = 1.
    APPEND ls_fcat TO pt_fieldcat.
    CLEAR ls_fcat.
    ls_fcat-fieldname = 'QUANTITY'.
    ls_fcat-datatype  = 'INT4'.
    ls_fcat-intlen    = 6.
    ls_fcat-outputlen = 6.
    ls_fcat-coltext   = 'Qty'.
    ls_fcat-edit      = 1.
    APPEND ls_fcat TO pt_fieldcat.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
                 EXPORTING
                    it_fieldcatalog = pt_fieldcat
                 IMPORTING
                    ep_table = new_table.
    * assign ref variable  to a field symbol
    ASSIGN new_table->* TO <dyn_table>.
    * Create dynamic work area and assign to FS
    CREATE DATA new_line LIKE LINE OF <dyn_table>.
    ASSIGN new_line->* TO <dyn_wa>.
    * data_itab is filled with data that you want in grid
    LOOP AT data_itab INTO data_wa.
      CLEAR <dyn_wa>.
      ASSIGN COMPONENT 'MATERIAL' OF STRUCTURE <dyn_wa> TO <fs>.
      <fs> = data_wa-material.
      ASSIGN COMPONENT 'QUANTITY' OF STRUCTURE <dyn_wa> TO <fs>.
      <fs> = data_wa-quantity.
      APPEND <dyn_wa> TO <dyn_table>.
    ENDLOOP.
    CALL METHOD g_grid->set_table_for_first_display
        EXPORTING
          i_structure_name              = '<DYN_TABLE>'
          is_variant                    = gs_variant
          i_save                        = 'A'
          i_default                     = 'X'
          is_layout                     = gs_layout
          it_toolbar_excluding          = gt_exclude
        CHANGING
          it_outtab                     = <dyn_table>
          it_fieldcatalog               = pt_fieldcat[]
          it_sort                       = gt_sort[].

  • 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

  • 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

  • ALV CHECK CHANGED DATA WITH REUSE_ALV_GRID_DISPLAY

    HELLO  EVERY-ONE.
        I have a question that how to check changed data in ALV. I know we can use CHECK_CHANGE_DATA Method in OO, and how to check it in REUSE_ALV_GRID_DISPLAY <b>without double click</b> ?

    Try this code , it will give the solution that has been solved with funtion module
    REPORT zalvprg1.
    TYPE-POOLS: slis.
    TABLES: ekko.
    DATA : it_list_top_of_page TYPE slis_t_listheader,
           it_list_end_of_page TYPE slis_t_listheader,
           it_events           TYPE slis_t_event,
           wa_line             TYPE slis_listheader,
           wa_event            TYPE slis_alv_event.
    DATA :  it_fieldcat  TYPE slis_t_fieldcat_alv ,
            wa_fieldcat  TYPE slis_fieldcat_alv.
    TYPES :BEGIN OF ty_ekko,
           ebeln TYPE ebeln,
           bukrs TYPE bukrs,
           ernam TYPE ernam,
           bsart TYPE esart,
           waers TYPE waers,
           END   OF ty_ekko.
    TYPES :BEGIN OF ty_ekpo,
           ebeln TYPE ebeln,
           ebelp TYPE ebelp,
           matnr TYPE matnr,
           werks TYPE werks,
           menge TYPE bstmg,
           END   OF ty_ekpo.
    TYPES :BEGIN OF ty_marc,
           matnr TYPE matnr,
           werks TYPE werks_d,
           tranz TYPE tranz,
           herbl TYPE herbl,
           END   OF ty_marc.
    TYPES : BEGIN OF ty_show,
            old  TYPE i,
            new(10) TYPE c,
            END OF ty_show.
    TYPES : BEGIN OF ty_final,
           ebeln TYPE ebeln,
           bukrs TYPE bukrs,
           ernam TYPE ernam,
           bsart TYPE esart,
           waers TYPE waers,
           matnr TYPE matnr,
           werks TYPE werks,
           menge TYPE bstmg,
           END   OF ty_final.
    DATA: it_ekko  TYPE TABLE OF ty_ekko,
          it_ekpo  TYPE TABLE OF ty_ekpo,
          it_marc TYPE TABLE OF ty_marc,
          it_final TYPE TABLE OF ty_final,
          it_show  TYPE TABLE OF ty_show WITH HEADER LINE,
          wa_marc  TYPE ty_marc,
          wa_ekko  TYPE ty_ekko,
          wa_ekpo  TYPE ty_ekpo,
          wa_show  TYPE ty_show,
          wa_final TYPE ty_final.
    SELECT-OPTIONS: so_ebeln FOR ekko-ebeln.
    START-OF-SELECTION.
      PERFORM data_fetch.
      PERFORM alv_display.
    END-OF-SELECTION.
    *&      Form  data_fetch
          text
    -->  p1        text
    <--  p2        text
    FORM data_fetch .
      SELECT ebeln
             bukrs
             ernam
             bsart
             waers
             FROM ekko
             INTO TABLE it_ekko
             WHERE ebeln IN so_ebeln.
      SELECT ebeln
             ebelp
             matnr
             werks
             menge
             FROM ekpo
             INTO TABLE it_ekpo
             FOR ALL ENTRIES IN it_ekko
             WHERE ebeln = it_ekko-ebeln.
      LOOP AT it_ekko INTO wa_ekko.
        wa_final-ebeln = wa_ekko-ebeln.
        wa_final-bukrs = wa_ekko-bukrs.
        wa_final-ernam = wa_ekko-ernam.
        wa_final-bsart = wa_ekko-bsart.
        wa_final-waers = wa_ekko-waers.
        READ TABLE it_ekpo INTO wa_ekpo WITH KEY ebeln = wa_ekko-ebeln.
        IF sy-subrc EQ 0.
          wa_final-matnr = wa_ekpo-matnr.
          wa_final-werks = wa_ekpo-werks.
          wa_final-menge = wa_ekpo-menge.
        ENDIF.
        APPEND wa_final TO it_final.
      ENDLOOP.
    ENDFORM.                    " data_fetch
    *&      Form  alv_display
          text
    -->  p1        text
    <--  p2        text
    FORM alv_display .
      REFRESH it_fieldcat.
      PERFORM field_cat USING 'EBELN' 'PURCHASE ORDER NO'.
      PERFORM field_cat USING 'BUKRS' 'COMPANY CODE'.
      PERFORM field_cat USING 'ERNAM' 'USERNAME CREATED'.
      PERFORM field_cat USING 'BSART' 'DOCUMENT TYPE'.
      PERFORM field_cat USING 'WAERS' 'CURRENCY'.
      PERFORM field_cat USING 'MATNR' 'MATERIAL NO'.
      PERFORM field_cat USING 'WERKS' 'PLANT '.
      PERFORM field_cat USING 'MENGE' 'QUANTITY'.
      CLEAR it_list_top_of_page.
      PERFORM f009_list_header .
      CLEAR it_list_end_of_page.
      PERFORM f009_list_footer.
      PERFORM f012_grid_function_module TABLES it_final USING it_fieldcat.
    ENDFORM.                    " alv_display
    **&      Form  f009_list_header
          text
    FORM f009_list_header.
    **..... Header detail for ALV
      wa_event-name = text-001. "TOP_OF_PAGE
      wa_event-form = text-002. "F010_TOP_OF_PAGE
      APPEND wa_event TO it_events.
      CLEAR wa_event.
      CLEAR wa_line.
      wa_line-typ  = text-003.   "S
      wa_line-key  = text-004.   "9 - BLOCKER REPORT
      wa_line-info = text-005.
      APPEND wa_line TO it_list_top_of_page.
      CLEAR wa_line.
    ENDFORM.                    "f009_list_header
    *&      Form  f010_top_of_page
          text
    FORM f010_top_of_page.
    **......The form 'F010_TOP_OF_PAGE' cannot be called directly
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = it_list_top_of_page.
    ENDFORM.                    "f010_top_of_page
    *&      Form  field_cat
          text
         -->W_FIELD    text
         -->W_COL      text
    FORM field_cat  USING    w_field
                             w_col.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = w_field.
      wa_fieldcat-seltext_l = w_col.
      wa_fieldcat-outputlen = 15.
      APPEND wa_fieldcat TO it_fieldcat.
    ENDFORM.                    " field_cat
    *&      Form  f012_grid_function_module
          text
    FORM f012_grid_function_module TABLES w_tab USING  w_fcat TYPE any.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          it_fieldcat              = w_fcat
          i_callback_pf_status_set = 'F010_PF_STATUS'
          i_callback_user_command  = 'USER_COMMAND'
          it_events                = it_events[]
        TABLES
          t_outtab                 = w_tab
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc IS NOT INITIAL.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    "f011_grid_function_module
    *&      Form  f009_list_footer
          text
    FORM f009_list_footer.
    **..... Footer  detail for ALV
      CLEAR wa_event.
      CLEAR wa_line.
      wa_event-name = text-007. "BOTTOM_OF_PAGE
      wa_event-form = text-008. "F010_BOTTOM_OF_PAGE
      APPEND wa_event TO it_events.
      wa_line-typ  = text-009.   "S
      wa_line-key  = text-010.   "9 - BLOCKER REPORT
      wa_line-info = text-011.
      APPEND wa_line TO it_list_end_of_page.
      CLEAR wa_line.
    ENDFORM.                    "f009_list_footer
    *&      Form  f010_top_of_page
          text
    FORM f010_bottom_of_page.
    **......The form 'F010_TOP_OF_PAGE' cannot be called directly
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = it_list_end_of_page.
    ENDFORM.                    "f010_end_of_page
          FORM user_command                                             *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                               rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN '&IC1'.
          IF rs_selfield-fieldname = 'MATNR'.
            SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
            SET PARAMETER ID 'WRK' FIELD '1000'.     "<- Your plant here
            CALL TRANSACTION 'MD04' AND SKIP FIRST SCREEN.
           call transaction 'MM02' and skip first screen.
          ENDIF.
          IF rs_selfield-fieldname = 'WERKS'.
            PERFORM disp_marc USING rs_selfield.
          ENDIF.
        WHEN '&CHANGE'.
          IF rs_selfield-fieldname = 'MENGE'.
            PERFORM disp_alter USING rs_selfield.
          ENDIF.
      ENDCASE.
    ENDFORM.                    "callback_ucomm
    *&      Form  f010_pf_status
          text
         -->RT_EXTAB   text
    FORM f010_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZS_ALV'.
    ENDFORM.                    "F010_PF_STATUS
    *ENDFORM.                    "dialog
    *&      Form  f002_FIELDCAT
          text
         -->P_0512   text
         -->P_0513   text
         -->P_0514   text
    FORM f002_fieldcat  USING   w_field
                                w_col
                                w_change   .
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = w_field.
      wa_fieldcat-seltext_l = w_col.
      wa_fieldcat-outputlen = 15.
      wa_fieldcat-edit      = w_change.
      wa_fieldcat-input     = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
    ENDFORM.                    " f002_FIELDCAT
    *&      Form  disp_marc
          text
         -->P_W_SELFIELD  text
    FORM disp_marc  USING    rs_selfield TYPE slis_selfield.
      SELECT   matnr
               werks
               tranz
             FROM  marc INTO TABLE it_marc
             WHERE werks = rs_selfield-value.
      REFRESH it_fieldcat.
      PERFORM field_cat USING 'MATNR' 'MATERIAL NUMBER'.
      PERFORM field_cat USING 'WERKS' 'PLANT '.
      PERFORM field_cat USING 'TRANZ' 'INTER-OPERATION TIME'.
    PERFORM field_cat USING 'HERBL' 'STATE OF MANUFACTURE'.
      PERFORM f012_grid_function_module TABLES it_marc USING it_fieldcat .
      IF sy-subrc NE 0.
        MESSAGE 'MATERIAL DETAILS' TYPE 'S'.
      ENDIF.
    ENDFORM.                    " disp_marc
    *&      Form  disp_alter
          text
         -->P_RS_SELFIELD  text
    FORM disp_alter  USING    rs_selfield TYPE slis_selfield.
      DATA:l_var(10) TYPE c.
      REFRESH : it_fieldcat,
                it_show.
      it_show-old = rs_selfield-value.
      CLEAR it_show-new.
      APPEND it_show TO it_show.
      PERFORM field_cat  USING 'OLD'  'OLD QTY (MENGE)'.
      PERFORM f002_fieldcat USING 'NEW' 'NEW QTY (MENGE)' 'X'.
      CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
        EXPORTING
          i_title            = 'CHANGES IN MATERIAL'
          i_tabname          = 'IT_SHOW'
          it_fieldcat        = it_fieldcat
          i_callback_program = sy-repid
        TABLES
          t_outtab           = it_show
        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.
      l_var = it_show-new.
      READ TABLE it_final INDEX rs_selfield-tabindex INTO wa_final.
      wa_final-menge = l_var.
      MODIFY it_final INDEX rs_selfield-tabindex  FROM wa_final TRANSPORTING menge .
      PERFORM alv_display.
    ENDFORM.                    " disp_alter
    Reward points for the same
    Regards,
    Shanmuga perumal.L

  • 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

  • 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

Maybe you are looking for

  • Urgent!!!!Add a Horizontal Scroll Bar for Table Control

    Hi Experts, I want to have a Horizontal Scroll Bar on my Table control. I tried with few properties for the Table UI Element but not able to solve it. If any one who had already done this please help me out. Thanks in advance.. Regards, Kishore K

  • BBP_GET_CATEGORIES_F4 short dump

    Hi Gurus, We are building SRM 7 with ECS. Product categories are replicated froom ECC 6 EHP4. When we are searching product categories in SC with match code it leads to a time out with the following error message : Error application is coming up. htt

  • Can I revert back to earlier version???

    I did the January '08 update (1.1.3) and now I am having all sorts of problems. For starters, I have lost Wi-fi and Blue-tooth (greyed out and unaccessible) and I am sure I will find other things wrong after reading some of the forum posts in here. R

  • Issue expanding SIT files on MS Windows

    Some MS Windows users may be unable to decompress SIT files. Please post files as SITX or ZIP instead; and repost any existing SIT files as SITX or ZIP. Thanks! Adobe User to User forums.

  • Why can't Apple allow/sell basic upgrade proprietary hardware?

    If Apple would market their own basic hardware upgrades through Apple & their re-sellers, they would create a new, BIG revenue stream by allowing consumers that might not be able to afford to 'buy new' as soon as others at least 'upgrade' & stay loya