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

Similar Messages

  • 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

  • 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

  • PM order change date with IW32

    Hi Guys,
    one of my customer is facing this issue.
    he has a PM order with status REL  ESTC MANC PRC  SETC
    now he want to change the basic finish date because he messed it up.
    but the system does not change the dates, what can i do? i am not so confident with PM order.
    thanks for your kind reply.
    c.

    Hi,
    Check out these BTE events it might help u...
    PM000010 Update notification
    PM000020 Update equipment
    PM000030 Update order
    PM000040 Update measurement documents/points
    PM000050 Update confirmation
    Regards,
    Ravi Ganji

  • How to check  the date with current day after 5 days

    Hello,
    I need to make the visible of delete button in my struts application. I've application in which user can be deactivated. If the user is deactivated and the admin can't delete the user for the specific period of time (set in property file). while deactivating the user, system time is set. and 5 days after the system time's set, i need to make the button visible.
    This is my code.
    Calendar cal = Calendar.getInstance();
    Date deActivatedDate = null;
    deActivatedDate =new Date(userData.getDeActivatedTime().getTime());// Set it in the Calendar object
    cal.setTime(deActivatedDate);                    // Add 5 days
    cal.add(Calendar.DATE, 5);// get the current date
    Calendar currentCal = Calendar.getInstance();
    Date currentDate = new Date();
    currentCal.setTime(currentDate);// check if the de-activation time is over.
    if (cal.get(Calendar.DATE) < currentCal.get(Calendar.DATE)) {
    userData.setDeletionAllowed(true);}
    can anyone help to solve this issue?

    What's the problem with the code that you posted?

  • Cross check BW data with R/3.

    Hello Experts,
         I have sales queries in BW and can someone tell me how to validate the reports based on R/3 data. I mean where to look in R/3 to get all the fields in the sales cube in BW.
         Thanks in advance for the time and input.
    Nikki

    Hi Nikki,
    One way to do this is go backwards from the data source and extractors to see on which tables they are based so that you can get the table filed to InfoObject mapping. Are you using a business content cube and / or data sources?

  • How can I change Time data with List Entry Screen ?

    Hi expert.
    I transfer Time Data (Infotype 2003) via CAT6.
    When I go to transaction PA61 and click List Entry icon.
    Record is display and cannot change data.
    If I wanna change data.I must to click Choose Icon one by one record.
    How can I change data with List Entry Screen?
    ps. If record create via PA61. I can change data with List Entry Screen.
    I can't change with record that create via CAT6.
    Best Regards.

    have u tried to change your time entry through CAT2 tcode, ithink if u have created profile for time entry then it should allow you to change and you can use esc otherwise, its generally the standard profile given by SAP. but is 4 one user
    hope this helps
    guds

  • How to compare date with null value

    Hi
    I have a date filed and i assigned that input box with context attribute of type Date.
    Here my problem is
    when the end user not entered any thing (null ) the i have give some defaul date.
    so first in the action method i have to check the date with null
    if it is null i have to give default date.
    so please let me know how to over come this.
    thanks
    Mukesh

    Hi
    You can get your date in your action method like
    Date newDate=new Date();
    Date myDate= wdThis
                              .wdGetYourComponentNameController()
                                      .wdGetContext()
                                           .currentYourNodeNameElement()
                                                           .getYourDateName();
    if ( myDate== null) {
             wdContext.currentContextElement().setYourDateName(newDate);
    else{...........//continue your other validations or calling other methods}
    Regards
    Abhijith YS
    Message was edited by:
            Abhijith YS

  • URGENT !!! HOW CAN CHANGE DATA IN JTABLE!!!

    My Program ....
    pLinhas.dataModel.addTableModelListener(new TableModelListener() {
    public void tableChanged(TableModelEvent e) {
    int row = e.getFirstRow();
    int column = e.getColumn();
    Object data = pLinhas.dataModel.getValueAt(row,column);
    Object valor = pLinhas.dataModel.getValueAt(row,6);
    System.out.println("Quantidade -" + data.toString());
    System.out.println("Valor a Cobrar -" + valor.toString());
    setValueAt(data,row,6);
    public void setValueAt(Object value, int row, int col) {
    System.out.println("Mudou ou nao");
    pLinhas.dataModel.fireTableCellUpdated(row, col);
    this dont work. When the method setValue() run, the java break.
    the message are :
    # An EXCEPTION_STACK_OVERFLOW exception has been detected in native code outside the VM.
    # Program counter=0x77e94aa0
    how can i change my data for a new data in jtable.
    tx for help.

    I had a problem similar to this. I was writing my own table model which would work sometimes and at other times fail similar to what you describe. I ended up printing out the source code to the DefaultTableModel and taking a look at it and then deciding to subclass that class and add my additional functionality as opposed to writing a completely new model and trying to duplicate the DefaultTableModel. My needs were relatively simple and the subclassing fixed the problem. I can change data with no problem in the displayed table. If you're not already subclassing and trying to write your own table model you may want to give this a try. I'd struggled with the problem for several days thinking I'd fixed it and having it come up again. I invested 2 hours doing the subclassing and the problem has never appeared since then. I know I just missed doing something in the table model I was trying to write but my schedule was tight and the subclassing offered a quick fix. Hope this helps!

  • 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.

  • Check unchanged data in an editable alv grid

    Hi,
    I have a problem with my editable ALV. As long as I'm changing my data the event DATA_CHANGED is raised and my fields are checked correctly. But what about unchanged data like appended rows. In that case no changes have been made and the event is not triggered.
    Even if i raise the event by using the method:      
    CALL METHOD gr_grid1->check_changed_data
        IMPORTING
          e_valid   = lv_valid
        CHANGING
          c_refresh = lv_refresh.
    there are no changed data so that my checks:
    FORM data_changed USING  lr_data_changed TYPE REF TO
                                             cl_alv_changed_data_protocol.
      DATA: ls_mod_cells TYPE lvc_s_modi.
      DATA: ls_cells TYPE lvc_s_modi,
            lv_value TYPE lvc_value ,
            lv_matnr TYPE matnr,
            lv_maktx TYPE maktx,
            lv_error TYPE c.
      CLEAR lv_error.
      LOOP AT lr_data_changed->mt_good_cells INTO ls_mod_cells.
        CASE ls_mod_cells-fieldname.
          WHEN 'MATNR'.
            CALL METHOD lr_data_changed->get_cell_value
              EXPORTING
                i_row_id    = ls_mod_cells-row_id
                i_fieldname = 'MATNR'
              IMPORTING
                e_value     = lv_value.
    * CHECK MARA SEGMENT
            SELECT SINGLE mara~matnr
                          makt~maktx INTO (lv_matnr,
                                           lv_maktx)
                                      FROM mara AS mara
                                INNER JOIN makt AS makt
                                        ON mara~matnr = makt~matnr
                                WHERE mara~matnr = lv_value AND
                                      makt~spras = sy-langu.
            IF NOT sy-subrc IS INITIAL.
              CALL METHOD lr_data_changed->add_protocol_entry
                EXPORTING
                  i_msgid     = 'M3'
                  i_msgno     = '305'
                  i_msgty     = 'E'
                  i_msgv1     = lv_value
                  i_fieldname = ls_mod_cells-fieldname
                  i_row_id    = ls_mod_cells-row_id.
              lv_error = 'X'.
            ELSE.
              CALL METHOD lr_data_changed->modify_cell
                EXPORTING
                  i_row_id    = ls_mod_cells-row_id
                  i_fieldname = 'MAKTX'
                  i_value     = lv_maktx.
            ENDIF.
          WHEN OTHERS.
        ENDCASE.
      ENDLOOP.
    ENDFORM.
       are not working.
    Thank you for your help
    Gregor
    Edited by: Gregor Sure on Oct 13, 2009 1:58 PM

    Try to capture the event DATA_CHANGED_FINISHED. You can use the method REGISTER_EDIT_EVENT of the class CL_GUI_ALV_GRID to register the edit events.
    Regards,
    Naimesh Patel

  • 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[].

  • SharePoint PPS 2013 Dashboard Designer error "Please check the data source for any unsaved changes and click on Test Data Source button"

    Hi,
    I am getting below error in SharePoint PPS 2013 Dashboard Designer. While create the Analysis Service by using "PROVIDER="MSOLAP";DATA SOURCE="http://testpivot2013:9090/Source%20Documents/TestSSource.xlsx"
    "An error occurred connecting to this data source. Please check the data source for any unsaved changes and click on Test Data Source button to confirm connection to the data source. "
    I have checked all the Sites and done all the steps also. But still getting the error.Its frustrating like anything. Everything is configured correctly but still getting this error.
    Thanks in advance.
    Poomani Sankaran

    Hi Poomani,
    Thanks for posting your issue,
    you must have to Install SQL Server 2012 ADOMD.Net  on your machine and find the browse the below mentioned URL to create SharePoint Dashboard with Analysis service step by step.
    http://www.c-sharpcorner.com/UploadFile/a9d961/create-an-analysis-service-data-source-connection-using-shar/
    I hope this is helpful to you, mark it as Helpful.
    If this works, Please mark it as Answered.
    Regards,
    Dharmendra Singh (MCPD-EA | MCTS)
    Blog : http://sharepoint-community.net/profile/DharmendraSingh

  • 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

  • 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

Maybe you are looking for

  • Quick select tool not working.

    I'm making a really simple layer for a logo i've done it but i want to merge it with other programs and it don't copy anything. (sorry if i said anything bad because i'm not perfect in english and adobe photoshop as well)

  • Why is the Touch more expensive than the phone?

    The iPhone which does MORE than the iPod Touch is $100 cheaper for the 32GB model! What the heck?!? iPhone 3G S 32GB $299 iPod Touch 32GB $399

  • Replace Color(s)

    I couldn't figure out how to use the Replace Color function in Photoshop, so I checked out Fireworks and was pleased to see it's user friendly in the extreme. The only problem is it doesn't work! First, I opened an image with a .png extension. (It on

  • Loading legacy TB

    Could somebody please suggest the best method for Legacy Finance Data Load please or confirm that the steps that I am proposing are correct:- YE TB will be manually journalled into SAP - the debtor and creditor balances will be journalled to a data l

  • Using Expression in commandButton "Icon" property

    I have 2 images and i have 2 conditions. i want to show one image at a time under a condition. I am using the following expression to determine the image to be displayed on CommandButton in adf: #{row.bindings.PolicyExceptionApprovedFlag.inputValue==