Refresh an ALV grid

Hi all.
When I'm using set_table_for_first_display method how can implement refreshing option after the user had pressed a button and activated a process ?
Thanks all,
Rebeka

hi,
use this code..
DATA:    g_alv_grid       TYPE REF TO cl_gui_alv_grid,       " ALV Declaration
CALL METHOD g_alv_grid->refresh_table_display.

Similar Messages

  • ALV OO and refreshing the ALV grid

    Hi,
    i have some problems with my ALV 00 program.
    On screen 1 i have to fill in a material number.
    For that material i'm getting some data and show in screen 2 in a ALV grid.
    Via BACK-button i'm getting back to screen 1 and can fill in another material number.
    But the 2nd (and 3rd, etc) time i fill a material, the ALV grid data from material 1 is shown. Even if the internal table I_ALV where the data is, is changed.
    What should i do ?
    I have initialized the customer container and the grid, but that didn't solved the problem.
    regards,
    Hans

    Hi,
    Try clearing and refreshing the alv grid data table in screen 2.
    Check with this code. this code is working fine. If we go back and change the input, it is showing the output corresponding to the second input only.
    Have you use this method?
    <b> GR_ALVGRID->REFRESH_TABLE_DISPLAY</b>
    TYPE-POOLS : SLIS.
    * Tables                                                              *
    TABLES:
      VBRK,
      VBRP.
    * Parameters and select options OR SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS:
                S_VBELN FOR VBRK-VBELN.
    SELECTION-SCREEN END OF BLOCK B1.
    * Internal Tables                                                     *
    * work areas
    DATA: BEGIN OF IT_VBRP OCCURS 0,
           VBELN LIKE VBRK-VBELN,
           POSNR LIKE VBRP-POSNR,
           UEPOS LIKE VBRP-UEPOS,
           FKIMG LIKE VBRP-FKIMG,
           NETWR LIKE VBRP-NETWR,
           MEINS LIKE VBRP-MEINS.
    DATA : END OF IT_VBRP.
    * Variables                                                           *
    DATA : GR_ALVGRID TYPE REF TO CL_GUI_ALV_GRID,
           GC_CUSTOM_CONTROL_NAME TYPE SCRFNAME VALUE 'CC_ALV',
           GR_CCONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
           GT_FIELDCAT TYPE LVC_T_FCAT,
           GS_LAYOUT TYPE LVC_S_LAYO,
           V_FLAG VALUE 'X'.
    * Start of Program                                                    *
    *       INITIALIZATION.                                               *
    INITIALIZATION.
      S_VBELN-LOW = 1.
      S_VBELN-HIGH = 1000000000.
      S_VBELN-OPTION = 'EQ'.
      S_VBELN-SIGN = 'I'.
      APPEND S_VBELN.
    *       SELECTION-SCREEN                                              *
    AT SELECTION-SCREEN.
      PERFORM VALIDATION.
    *       START-OF-SELECTION                                            *
    START-OF-SELECTION.
      PERFORM GET_DATA.
      CALL SCREEN 0100.
    *       END-OF-SELECTION                                              *
    END-OF-SELECTION.
    *       TOP-OF-PAGE                                                   *
    TOP-OF-PAGE.
    *       END-OF-PAGE                                                   *
    END-OF-PAGE.
    *       AT USER-COMMAND                                               *
    *&      Form  VALIDATION
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM VALIDATION .
      SELECT SINGLE VBELN
      FROM VBRK
      INTO VBRK-VBELN
      WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'no billing documents found'.
      ENDIF.
    ENDFORM.                    " VALIDATION
    *&      Form  GET_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM GET_DATA .
      SELECT VBELN
             POSNR
             UEPOS
             FKIMG
             NETWR
             MEINS
      FROM VBRP
      INTO TABLE IT_VBRP
      WHERE VBELN IN S_VBELN.
    ENDFORM.                    " GET_DATA
    *&      Module  DISPLAY_ALV  OUTPUT
    *       text
    MODULE DISPLAY_ALV OUTPUT.
      IF V_FLAG = 'X'.
        PERFORM DISPLAY_ALV.
        PERFORM PREPARE_FIELD_CATALOG CHANGING GT_FIELDCAT.
        PERFORM PREPARE_LAYOUT CHANGING GS_LAYOUT.
       CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
    *      I_BUFFER_ACTIVE               =
    *      I_BYPASSING_BUFFER            =
    *      I_CONSISTENCY_CHECK           =
    *      I_STRUCTURE_NAME              = 'VBRP'
    *      IS_VARIANT                    =
    *      I_SAVE                        =
    *      I_DEFAULT                     = 'X'
              IS_LAYOUT                     = GS_LAYOUT
    *      IS_PRINT                      =
    *      IT_SPECIAL_GROUPS             =
    *      IT_TOOLBAR_EXCLUDING          =
    *      IT_HYPERLINK                  =
    *      IT_ALV_GRAPHICS               =
    *      IT_EXCEPT_QINFO               =
            CHANGING
              IT_OUTTAB                     = IT_VBRP[]
              IT_FIELDCATALOG               = GT_FIELDCAT
    *      IT_SORT                       =
    *      IT_FILTER                     =
            EXCEPTIONS
              INVALID_PARAMETER_COMBINATION = 1
              PROGRAM_ERROR                 = 2
              TOO_MANY_LINES                = 3
              OTHERS                        = 4
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          CALL METHOD GR_ALVGRID->SET_READY_FOR_INPUT
            EXPORTING
              I_READY_FOR_INPUT = 1.
        ELSE.
          <b>CALL METHOD GR_ALVGRID->REFRESH_TABLE_DISPLAY
    *    EXPORTING
    *      IS_STABLE      =
    *      I_SOFT_REFRESH =
            EXCEPTIONS
              FINISHED       = 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.</b>
        ENDIF.
        CLEAR V_FLAG.
      ENDIF.
    ENDMODULE.                 " DISPLAY_ALV  OUTPUT
    *&      Form  DISPLAY_ALV
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY_ALV .
      IF GR_ALVGRID IS INITIAL.
        CREATE OBJECT GR_ALVGRID
          EXPORTING
    *    I_SHELLSTYLE      = 0
    *    I_LIFETIME        =
            I_PARENT          = GR_CCONTAINER
    *    I_APPL_EVENTS     = space
    *    I_PARENTDBG       =
    *    I_APPLOGPARENT    =
    *    I_GRAPHICSPARENT  =
    *    I_NAME            =
          EXCEPTIONS
            ERROR_CNTL_CREATE = 1
            ERROR_CNTL_INIT   = 2
            ERROR_CNTL_LINK   = 3
            ERROR_DP_CREATE   = 4
            OTHERS            = 5
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    ENDFORM.                    " DISPLAY_ALV
    *&      Form  PREPARE_FIELD_CATALOG
    *       text
    *      <--P_GT_FIELDCAT  text
    FORM PREPARE_FIELD_CATALOG  CHANGING P_GT_FIELDCAT TYPE LVC_T_FCAT.
      DATA : LS_FCAT TYPE LVC_S_FCAT,
             L_POS TYPE I.
      L_POS = L_POS + 1.
      LS_FCAT-FIELDNAME = 'VBELN'.
      LS_FCAT-TABNAME = 'IT_VBRP'.
      LS_FCAT-COL_POS = L_POS.
      LS_FCAT-SCRTEXT_M = 'Billing Document'.
      LS_FCAT-OUTPUTLEN = '10'.
      APPEND LS_FCAT TO P_GT_FIELDCAT.
      CLEAR LS_FCAT.
      L_POS = L_POS + 1.
      LS_FCAT-FIELDNAME = 'POSNR'.
      LS_FCAT-TABNAME = 'IT_VBRP'.
      LS_FCAT-COL_POS = L_POS.
      LS_FCAT-SCRTEXT_M = 'Billing Item'.
      LS_FCAT-OUTPUTLEN = '6'.
      APPEND LS_FCAT TO P_GT_FIELDCAT.
      CLEAR LS_FCAT.
      L_POS = L_POS + 1.
      LS_FCAT-FIELDNAME = 'UEPOS'.
      LS_FCAT-TABNAME = 'IT_VBRP'.
      LS_FCAT-COL_POS = L_POS.
      LS_FCAT-SCRTEXT_M = 'Higher Level Item'.
      LS_FCAT-OUTPUTLEN = '6'.
      APPEND LS_FCAT TO P_GT_FIELDCAT.
      CLEAR LS_FCAT.
      L_POS = L_POS + 1.
      LS_FCAT-FIELDNAME = 'FKIMG'.
      LS_FCAT-TABNAME = 'IT_VBRP'.
      LS_FCAT-COL_POS = L_POS.
      LS_FCAT-SCRTEXT_M = 'Invoice Quantity'.
      LS_FCAT-OUTPUTLEN = '13'.
      APPEND LS_FCAT TO P_GT_FIELDCAT.
      CLEAR LS_FCAT.
      L_POS = L_POS + 1.
      LS_FCAT-FIELDNAME = 'NETWR'.
      LS_FCAT-TABNAME = 'IT_VBRP'.
      LS_FCAT-COL_POS = L_POS.
      LS_FCAT-SCRTEXT_M = 'Net Value'.
      LS_FCAT-OUTPUTLEN = '15'.
      APPEND LS_FCAT TO P_GT_FIELDCAT.
      CLEAR LS_FCAT.
      L_POS = L_POS + 1.
      LS_FCAT-FIELDNAME = 'MEINS'.
      LS_FCAT-TABNAME = 'IT_VBRP'.
      LS_FCAT-COL_POS = L_POS.
      LS_FCAT-SCRTEXT_M = 'Unit of Measure'.
      LS_FCAT-OUTPUTLEN = '3'.
      APPEND LS_FCAT TO P_GT_FIELDCAT.
      CLEAR LS_FCAT.
      L_POS = L_POS + 1.
    ENDFORM.                    " PREPARE_FIELD_CATALOG
    *&      Form  PREPARE_LAYOUT
    *       text
    *      <--P_GS_LAYOUT  text
    FORM PREPARE_LAYOUT  CHANGING P_GS_LAYOUT TYPE LVC_S_LAYO.
      P_GS_LAYOUT-ZEBRA = 'X'.
      P_GS_LAYOUT-GRID_TITLE = 'INVOICE DETAILS'.
      P_GS_LAYOUT-SMALLTITLE = 'X'.
      P_GS_LAYOUT-EDIT = 'X'.
    ENDFORM.                    " PREPARE_LAYOUT
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'CANCEL'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'CANCEL'.
          LEAVE TO SCREEN 0.
        WHEN 'EXIT'.
          CALL TRANSACTION 'SE38'.
        WHEN 'CHANGE'.
          IF GR_ALVGRID->IS_READY_FOR_INPUT( ) = 0.
            CALL METHOD GR_ALVGRID->SET_READY_FOR_INPUT
              EXPORTING
                I_READY_FOR_INPUT = 1.
          ELSE.
            CALL METHOD GR_ALVGRID->SET_READY_FOR_INPUT
              EXPORTING
                I_READY_FOR_INPUT = 0.
          ENDIF.
      ENDCASE.
    Regards,
    Aswin

  • Automatic refresh in alv grids

    Hi!
    I've three containers with three alv grids on my screen.
    I've a self made save-button on the toolbar of the first grid.
    Now i insert data in grid2 and grid3 ...
    When i press now the save-button from grid1 there's no data in the internal tables from grid2 and grid3.
    When i first press the refresh-buttons on the toolbars from grid2 and grid3 and then the save-button from grid1 the internal tables from grid2 and grid3 are filled.
    Is it possible to simulate first the pressed refresh-buttons from grid2/grid3 when pressing the save-button from grid1?
    I've tried to set a "call method grid2->refresh_table_display" and "call method grid2->refresh_table_display" before the code for the save-button but this doesn't work.
    Is there any help for me?
    Thanks a lot in advance!
    Ingo

    Hello Ingo
    It is important to realise that pushing a toolbar button does <b>NOT </b>trigger PAI of the dynpro where the ALV list is displayed.
    In order to refresh the display of the other two ALV grids you need to pass PAI (followed by PBO). How to do that? There are at least two possible ways:
    (1) You handle the SAVE command in your method HANDLE_USER_COMMAND. Within this method you update the internal tables for grid2 and grid3 depending on the contents of grid1. At the end of this method you call method CL_GUI_CFW=>set_new_ok_code( 'REFRESH' ). This will trigger PAI of the dynpro. In the PAI module (e.g. USER_COMMAND_0100) you could write the following coding:
      CASE gd_okcode.
        WHEN 'REFRESH'. 
          go_grid2->refresh_table_display( ).
          go_grid3->refresh_table_display( ).
      ENDCASE.
    (2) You handle the SAVE command in your method HANDLE_USER_COMMAND and call method CL_GUI_CFW=>set_new_ok_code( 'REFRESH' ) without updating the itab2 and itab3 here. The updating of these itabs occurs in the PAI module.
    The following sample report shows you the second approach. On the first ALV grid customers are displayed. If you double-click on a single customer its sales areas (if any) are displayed in the second ALV list.
    *& Report  ZUS_SDN_TWO_ALV_GRIDS
    REPORT  zus_sdn_two_alv_grids.
    DATA:
      gd_okcode        TYPE ui_func,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_splitter      TYPE REF TO cl_gui_splitter_container,
      go_cell_top      TYPE REF TO cl_gui_container,
      go_cell_bottom   TYPE REF TO cl_gui_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid,
      go_grid2         TYPE REF TO cl_gui_alv_grid,
      gs_layout        TYPE lvc_s_layo.
    DATA:
      gt_knb1          TYPE STANDARD TABLE OF knb1,
      gt_knvv          TYPE STANDARD TABLE OF knvv.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
            IMPORTING
              e_row
              e_column
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_double_click.
    *   define local data
        DATA:
          ls_knb1      TYPE knb1.
        CHECK ( sender = go_grid1 ).
        READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
        CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
        CALL METHOD go_grid1->set_current_cell_via_id
          EXPORTING
    *        IS_ROW_ID    =
    *        IS_COLUMN_ID =
            is_row_no    = es_row_no.
    *   Triggers PAI of the dynpro with the specified ok-code
        CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DETAIL' ).
      ENDMETHOD.                    "handle_double_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT        * FROM  knb1 INTO TABLE gt_knb1
             WHERE  bukrs  = '1000'.
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          OTHERS                      = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Create splitter container
      CREATE OBJECT go_splitter
        EXPORTING
          parent            = go_docking
          rows              = 2
          columns           = 1
    *      NO_AUTODEF_PROGID_DYNNR =
    *      NAME              =
        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.
    * Get cell container
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = go_cell_top.
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 2
          column    = 1
        RECEIVING
          container = go_cell_bottom.
    * Create ALV grids
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_cell_top
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Set event handler
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.
      CREATE OBJECT go_grid2
        EXPORTING
          i_parent          = go_cell_bottom
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Display data
      gs_layout-grid_title = 'Customers'.
      CALL METHOD go_grid1->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNB1'
          is_layout        = gs_layout
        CHANGING
          it_outtab        = gt_knb1
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      gs_layout-grid_title = 'Customers Details (Sales Areas)'.
      CALL METHOD go_grid2->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNVV'
          is_layout        = gs_layout
        CHANGING
          it_outtab        = gt_knvv  " empty !!!
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * NOTE: dynpro does not contain any elements
      CALL SCREEN '0100'.
    * Flow logic of dynpro (does not contain any dynpro elements):
    *PROCESS BEFORE OUTPUT.
    *  MODULE STATUS_0100.
    *PROCESS AFTER INPUT.
    *  MODULE USER_COMMAND_0100.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.  " contains push button "DETAIL"
    *  SET TITLEBAR 'xxx'.
    * Refresh display of detail ALV list
      CALL METHOD go_grid2->refresh_table_display
    *    EXPORTING
    *      IS_STABLE      =
    *      I_SOFT_REFRESH =
        EXCEPTIONS
          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.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
    *   User has pushed button "Display Details"
        WHEN 'DETAIL'.
          PERFORM entry_show_details.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  ENTRY_SHOW_DETAILS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM entry_show_details .
    * define local data
      DATA:
        ld_row      TYPE i,
        ls_knb1     TYPE knb1.
      CALL METHOD go_grid1->get_current_cell
        IMPORTING
          e_row = ld_row.
      READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
      CHECK ( syst-subrc = 0 ).
      SELECT        * FROM  knvv INTO TABLE gt_knvv
             WHERE  kunnr  = ls_knb1-kunnr.
    ENDFORM.                    " ENTRY_SHOW_DETAILS
    Regards
      Uwe

  • Refreshing of ALV Grid(using class)

    Hi all,
      In my program, i found that the ALV grid is displaying the same data for different criteria's. when debugging i found that the data is populated correctly in the output table that is passed to the method SET_TABLE_FOR_FIRST_DISPLAY according to the criteria's, yet i could only see the grid with the previous data.Please suggest on what could be done to correct this.
    Thanks,
    saran

    Hi Saran,
    There is a lifetime attribute that you have to set .
    Set this when you create object container at the first time .
    Here is the sample syntax :
    Variable definition
    DATA: grid_pr1 TYPE REF TO cl_gui_alv_grid,
          g_cconth TYPE REF TO cl_gui_custom_container,
          gs_layout2 TYPE lvc_s_layo,
          it_alv TYPE lvc_t_fcat .
    DATA: it_pr1 type table of ZP119H. " custom structure
    Create the object
    IF g_cconth is INITIAL.
        CREATE OBJECT g_cconth
           EXPORTING
              container_name = 'CCONTH'
              lifetime = g_cconth->lifetime_dynpro.
        CREATE OBJECT grid_pr1
           EXPORTING
             i_parent = g_cconth .
        CALL METHOD grid_pr1->set_table_for_first_display
          EXPORTING
            is_layout            = gs_layout2
          CHANGING
            it_outtab            = it_pr1
            it_fieldcatalog      = it_alv.
    ENDIF. " g_cconth
    Message was edited by:
            TUWUHSIH WINEDYA

  • Reset lead selection after refresh in alv grid

    Hi experts,
    I've a problem with holding the lead selection in an alv grid table view in web dynpro.
    After changing an attribute the lead selection in the view gets lost, but is hold in the referenced context node.
    Is there a way to change the lead selection in alv by code?
    I've found the method "set_index()" in class CL_SALV_WD_TABLE_LEAD_SELECT, can I use that?
    Thanks a lot,
    Kai

    Hi Kai,
    I faced a similar problem earlier.
    Request you to elaborate about the  "attribute" you are changing.
    I was also facing a similar issue.
    It will be gr8 if I can help you.
    Please see the below thread for some reference.
    [Not able to select a row in ALV|Not able to select a row in ALV?;
    I hope it helps.
    Regards,
    Sumit Oberoi

  • Refresh Editable ALV Grid inside a custom Container

    Hello all,
    I am having a screen with custom container in which i am populating datas and a entry screen which is going to have my
    filtering condition for this custom container screen..
    The problem i am facing is whenever i come out of the custom container screen after displaying and again give the
    necessary filtering data in the previous screen...
    the custom container screen displays wrong values...
    But when i refresh the data with the refresh icon in the container right datas are coming...
    I even used CALL METHOD C_ALVGD->REFRESH_TABLE_DISPLAY
    EXPORTING
    IS_STABLE = STABLE
    EXCEPTIONS
    FINISHED = 1
    OTHERS = 2. after displaying the values using
    CALL METHOD C_ALVGD->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    IT_TOOLBAR_EXCLUDING = T_FUNC
    IS_LAYOUT = IT_LAYOUT
    I_SAVE = 'A'
    CHANGING
    IT_OUTTAB = IT_ZCAWNT_V
    IT_FIELDCATALOG = IT_FCAT
    EXCEPTIONS
    INVALID_PARAMETER_COMBINATION = 1
    PROGRAM_ERROR = 2
    TOO_MANY_LINES = 3
    OTHERS = 4.
    IF SY-SUBRC 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    I have refreshed my internal table once when i display and again fetched from the DB according to the filtering conditions given
    in the first screen.
    I have tried clearing the Object created once when i display and again recreated it.But could not get the output.
    solution would be really helpful...

    Hey all,
    Thanks a lot for helping me...
    The problem is solved....
    i just used,
            CALL METHOD C_ALVGD->FREE. 'Grid inside the container
            CLEAR C_ALVGD.
            CALL METHOD C_CCONT->FREE. "Container
            CLEAR C_CCONT.
    when i click BACK Button from screen 2 to screen1.

  • REFRESH FUNCTIONALITy in ALV GRID

    Hi Experts,
    I have added two custom buttons (CO40 and REFRESH) in ALV GRID .
    WHEN CO40 button is clicked it will go the CO40 transaction.
    here the problem is when clicking the REFRESH , the REFRESH fuctionality is not working.
    (here i went to CO40 transaction by clicking CO40 button and deleted one planned order and come back and clicked REFRESH button but the planned order still showing in the output but the planned oreder is deleted in the table ) please help me rgarding this
    pls see my code and pls send me the code with modifications
    Thanks
    Nagendra
    REPORT  zpp_plannedorder_conv LINE-SIZE 200.
    TYPE-POOLS: slis.
    TABLES: plaf, vbak.
    PLANNED ORDER TABLE
    CONSTANTS: c_e TYPE c LENGTH 01 VALUE 'E'.
    TYPES: BEGIN OF ty_plaf,
           kdauf     TYPE kdauf,
           kdpos     TYPE kdpos,
           plnum TYPE plnum,     
           dispo TYPE dispo,
           matnr     TYPE matnr,
           maktx     TYPE maktx,
           pwwrk     TYPE pwwrk,
           paart     TYPE paart,
           beskz     TYPE beskz,
           gsmng     TYPE gsmng,
           END OF ty_plaf.
    SALES FIELDS
    TYPES: BEGIN OF ty_vbak,
           vbeln TYPE vbeln,
           posnr TYPE posnr,
           kunnr     TYPE kunnr,
           grkor     TYPE grkor,
           autlf     TYPE autlf,
           mvgr2     TYPE mvgr2,
           fixmg     TYPE  fixmg,
           bstdk     TYPE bstdk,
           edatu     TYPE edatu,
           posex  TYPE posex,
           END OF ty_vbak.
    output table.
    TYPES: BEGIN OF ty_out,
           plnum TYPE plnum,     
           dispo TYPE dispo,
           matnr     TYPE matnr,
           maktx     TYPE maktx,
           pwwrk     TYPE pwwrk,
           paart     TYPE paart,
           beskz     TYPE beskz,
           gsmng     TYPE gsmng,
           kdauf     TYPE kdauf,
           kdpos     TYPE kdpos,
           kunnr     TYPE kunnr,
           grkor     TYPE grkor,
           autlf     TYPE autlf,
           mvgr2     TYPE mvgr2,
           fixmg     TYPE  fixmg,
           bstdk     TYPE bstdk,
           edatu     TYPE edatu,
           posex  TYPE posex,
           END OF ty_out.
    DATA: tb_plaf TYPE STANDARD TABLE OF ty_plaf,
          tb_vbak TYPE STANDARD TABLE OF ty_vbak,
          tb_out  TYPE STANDARD TABLE OF ty_out.
    DATA: lv_plaf TYPE ty_plaf,
          lv_vbak TYPE ty_vbak,
          lv_out  TYPE ty_out.
    TYPES: BEGIN OF ty_vbep,
        vbeln TYPE vbeln,
        posnr TYPE posnr,
        etenr TYPE etenr,
        edatu TYPE edatu,
       END OF ty_vbep.
    DATA: tb_vbep TYPE STANDARD TABLE OF ty_vbep.
    DATA: lv_flag(1) TYPE c.
    **Start changes RFS: SANN - 0856
    DATA:  w_repid            TYPE sy-repid.
    DATA:  it_fieldcat        TYPE slis_t_fieldcat_alv, "field catalog table
           gs_layout          TYPE slis_layout_alv, "struct data type
           it_sort            TYPE slis_t_sortinfo_alv,
           it_events          TYPE slis_t_event,
           gt_event_exit          TYPE slis_t_event_exit.
    **End changes RFS: SANN - 0856
    SELECT OPTIONS.
    SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-t01.
    SELECT-OPTIONS: sel_pln FOR plaf-plnum,
                    sel_pww FOR plaf-pwwrk OBLIGATORY,
                    sel_dis FOR plaf-dispo,
                    sel_kun FOR vbak-kunnr,
                    sel_paa FOR plaf-paart,
                    sel_kda FOR plaf-kdauf.
    SELECTION-SCREEN END OF BLOCK a1.
    START-OF-SELECTION.
      REFRESH: tb_plaf ,tb_vbak.
      SELECT pkdauf pkdpos pplnum pdispo pmatnr mmaktx
              ppwwrk ppaart pbeskz pgsmng INTO TABLE tb_plaf
              FROM plaf AS p JOIN makt AS m
                ON pmatnr EQ mmatnr
                WHERE p~plnum IN sel_pln
                  AND p~pwwrk IN sel_pww
                  AND p~dispo IN sel_dis
                  AND p~paart IN sel_paa
                  AND p~kdauf IN sel_kda
                  AND m~spras EQ c_e.
      IF NOT  tb_plaf[] IS INITIAL.
        SORT tb_plaf BY kdauf DESCENDING.
        SELECT  kvbeln pposnr kkunnr pgrkor kautlf pmvgr2 p~fixmg     
                kbstdk vedatu p~posex INTO TABLE tb_vbak
                 FROM vbak AS k JOIN vbap AS p
                   ON kvbeln EQ pvbeln
                      INNER JOIN vbep AS v
                         ON pvbeln EQ vvbeln
                        AND pposnr EQ vposnr
        FOR ALL ENTRIES IN tb_plaf
            WHERE k~vbeln EQ tb_plaf-kdauf
              AND p~posnr EQ tb_plaf-kdpos
              AND k~kunnr IN sel_kun
              AND v~etenr EQ '0001'.
        IF NOT  tb_vbak[] IS INITIAL.
          LOOP AT tb_plaf INTO lv_plaf.
            CLEAR lv_out.
            MOVE-CORRESPONDING lv_plaf TO lv_out.
            IF NOT lv_plaf-kdauf IS INITIAL.
              READ TABLE tb_vbak INTO lv_vbak WITH KEY vbeln = lv_plaf-kdauf
                                                       posnr = lv_plaf-kdpos.
              MOVE-CORRESPONDING lv_vbak TO lv_out.
            ENDIF.
            APPEND lv_out TO tb_out.
          ENDLOOP.
        ENDIF.
      ENDIF.
    END-OF-SELECTION.
      PERFORM f_build_fcat.
      PERFORM f_get_display.
    *&      Form  F_BUILD_FCAT
    FORM f_build_fcat .
      CLEAR: w_repid.
      PERFORM fill_fieldcat " TABLES it_fieldcat
            USING:
                   text-f01 'TB_OUT'  text-k01  text-k01 '10' ,
                   text-f02 'TB_OUT'  text-k02  text-k02 '10' ,
                   text-f03 'TB_OUT'  text-k03  text-k03 '06' ,
                   text-f04 'TB_OUT'  text-k04  text-k04 '18' ,
                   text-f05 'TB_OUT'  text-k05  text-k05 '06' ,
                   text-f06 'TB_OUT'  text-k06  text-k06 '08' ,
                   text-f07 'TB_OUT'  text-k07  text-k07 '05' ,
                   text-f08 'TB_OUT'  text-k08  text-k08 '05' ,
                   text-f09 'TB_OUT'  text-k09  text-k09 '15' ,
                   text-f10 'TB_OUT'  text-k10  text-k10 '05' ,
                   text-f11 'TB_OUT'  text-k11  text-k11 '05' ,
                   text-f12 'TB_OUT'  text-k12  text-k12 '10' ,
                   text-f13 'TB_OUT'  text-k13  text-k13 '10' ,
                   text-f14 'TB_OUT'  text-k14  text-k14 '10' ,
                   text-f15 'TB_OUT'  text-t15  text-k15 '10' ,
                   text-f16 'TB_OUT'  text-k16  text-k16 '10' ,
                   text-f17 'TB_OUT'  text-k17  text-k17 '10' .
    ENDFORM.                    " F_BUILD_FCAT
    *&      Form  fill_fieldcat
    FORM  fill_fieldcat  " TABLES  l_catalog TYPE slis_t_fieldcat_alv       "#EC *
                       USING    p_field                         "#EC *
                                p_table                         "#EC *
                                p_desc                          "#EC *
                                p_desc_l                        "#EC *
                                p_len.                          "#EC *
      DATA: ls_fieldcat   TYPE slis_fieldcat_alv.
      ls_fieldcat-fieldname       = p_field.
      ls_fieldcat-tabname         = p_table.
      ls_fieldcat-seltext_l       = p_desc_l.
      ls_fieldcat-reptext_ddic    = p_desc.
      ls_fieldcat-outputlen       = p_len.
      APPEND ls_fieldcat TO it_fieldcat.
      CLEAR ls_fieldcat.
    ENDFORM.                    " fill_fieldcat
    *&     FORM F_GET_DISPLAY
          text
    FORM f_get_display .
      CLEAR w_repid.
      MOVE sy-repid TO w_repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = w_repid
          i_callback_pf_status_set = 'PF_STATUS'
          i_callback_user_command  = 'USER_COMMAND'
          is_layout                = gs_layout
          it_fieldcat              = it_fieldcat
          it_sort                  = it_sort
          i_save                   = 'X'
        TABLES
          t_outtab                 = tb_out
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc EQ 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " F_GET_DISPLAY
    *&      Form  PF_STATUS
          text
    FORM pf_status USING rt_extab TYPE slis_t_extab.
      DATA: wa_extab LIKE LINE OF rt_extab.
      REFRESH: rt_extab.
      wa_extab-fcode = '&REFRESH'.
      APPEND wa_extab TO rt_extab.
      SET PF-STATUS '0001' EXCLUDING rt_extab.
    ENDFORM.                    "PF_STATUS
         -->COMMAND    text
         -->SELFIELD   text
    FORM user_command USING command LIKE sy-ucomm selfield TYPE slis_selfield."#EC CALLED
      CLEAR : lv_out-plnum,lv_out-kdauf,lv_out-paart,lv_out-kdauf.
      CASE command.
        WHEN '&IC1'.                       "doubleclick
          CASE selfield-fieldname.
            WHEN 'PLNUM'.
              READ TABLE tb_out INTO lv_out INDEX selfield-tabindex.
              IF sy-subrc EQ 0.
                SET PARAMETER ID 'PAF'  FIELD lv_out-plnum.
                CALL TRANSACTION 'MD12' AND SKIP FIRST SCREEN.
              ENDIF.
            WHEN 'KDAUF'.
              READ TABLE tb_out INTO lv_out INDEX selfield-tabindex.
              IF sy-subrc EQ 0.
                SET PARAMETER ID 'AUN'  FIELD lv_out-kdauf.
                CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
              ENDIF.
          ENDCASE.
        WHEN 'CO40'.
          READ TABLE tb_out INTO lv_out INDEX selfield-tabindex.
          IF sy-subrc EQ 0.
            SET PARAMETER ID 'PAF'  FIELD lv_out-plnum.
            CALL TRANSACTION 'CO40' AND SKIP FIRST SCREEN.
          ENDIF.
        WHEN 'REFRESH'.
          PERFORM select_data.
      ENDCASE.
    ENDFORM.                    "user_command
    *End changes RFS: SANN - 0856
    *&      Form  SELECT_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM select_data .
      commit work and wait.
      REFRESH:tb_plaf[],tb_vbak[],tb_out[].
      SELECT pkdauf pkdpos pplnum pdispo pmatnr mmaktx
              ppwwrk ppaart pbeskz pgsmng INTO TABLE tb_plaf
              FROM plaf AS p JOIN makt AS m
                ON pmatnr EQ mmatnr
                WHERE p~plnum IN sel_pln
                  AND p~pwwrk IN sel_pww
                  AND p~dispo IN sel_dis
                  AND p~paart IN sel_paa
                  AND p~kdauf IN sel_kda
                  AND m~spras EQ c_e.
      IF NOT  tb_plaf[] IS INITIAL.
        SORT tb_plaf BY kdauf DESCENDING.
        SELECT  kvbeln pposnr kkunnr pgrkor kautlf pmvgr2 p~fixmg     
                kbstdk vedatu p~posex INTO TABLE tb_vbak
                 FROM vbak AS k JOIN vbap AS p
                   ON kvbeln EQ pvbeln
                      INNER JOIN vbep AS v
                         ON pvbeln EQ vvbeln
                        AND pposnr EQ vposnr
        FOR ALL ENTRIES IN tb_plaf
            WHERE k~vbeln EQ tb_plaf-kdauf
              AND p~posnr EQ tb_plaf-kdpos
              AND k~kunnr IN sel_kun
              AND v~etenr EQ '0001'.
        IF NOT  tb_vbak[] IS INITIAL.
          LOOP AT tb_plaf INTO lv_plaf.
            CLEAR lv_out.
            MOVE-CORRESPONDING lv_plaf TO lv_out.
            IF NOT lv_plaf-kdauf IS INITIAL.
              READ TABLE tb_vbak INTO lv_vbak WITH KEY vbeln = lv_plaf-kdauf
                                                       posnr = lv_plaf-kdpos.
              MOVE-CORRESPONDING lv_vbak TO lv_out.
            ENDIF.
            APPEND lv_out TO tb_out.
          ENDLOOP.
        ENDIF.
      ENDIF.
    ENDFORM.                    " SELECT_DATA

    Hi,
    Gothrough the following link,
    Handle Refresh button on ALV
    Regards,
    Harish

  • Value in ALV Grid ?

    Hello,
    is there a method which sets the cell value of a certain cell in a alv grid.
    I've to set a vallue of a cell after the user has entered a value in a special cell.

    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
         it_fieldcat                       = it_field       " field catalog
        TABLES
          t_outtab                          = it_final      " internal table
    *&      Form  pf
    *       SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
    *       ON WHICH THE ALV GRID IS DISPLAYED
    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
    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 = 'X'.
    "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

  • ALV Grid - Display/change Problem

    Hi Guys,
    I have a peculiar problem. I have developed a Module pool application containing two screens. In the first screen I have a input field and 2 buttons for display and change. When I enter the value and press Displaythe second screen is called which shows an ALV grid in the respective display mode. But If I come back and press change I could not get the change mode for the ALV grid still it remains in the Display mode. Again if rerun the transaction and press change it shows the ALV grid in change mode but if we press back and choose display then it is not getting changed still remains as such. In all at the first run what ever the mode is chosen it remains stationery. I am using OOALV and i have tried flushing the container, grid and also refreshing the ALV. But could not trace the problem. If you guys have worked or can put some inputs please reply back.
    Jagath.

    Please find the attached code...
    from the first screen 100 i am assigning the flag w_display or w_change based on the okcode. in the second screen 200 PBO i have the following code:
    MODULE status_0200 OUTPUT.
      SET PF-STATUS 'STAT200'.
      SET TITLEBAR 'TIT200'.
      if w_display eq 'X'.
      perform grid_display.
      else.
      perform grid_change.
      endif.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    Now in perform display I have the following code:
    form grid_display .
    Set the Fieldcatalog.
      REFRESH t_fieldcat.
      PERFORM get_field_catalog.
    set the Layout.
      CLEAR wa_layout.
      wa_layout-cwidth_opt = 'X'.
    wa_layout-stylefname = 'CELLTAB'.
    set the Variant
      w_variant-report = sy-repid.
    Create the Instance for container
      IF lcl_custom_disp IS INITIAL.
        CREATE OBJECT lcl_custom_disp
          EXPORTING
           PARENT                      =
            container_name              = 'CONTAINER1'
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6.
        IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    create the object for ALV grid
        CREATE OBJECT lcl_grid_disp
          EXPORTING
            i_parent          = lcl_custom_disp
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            OTHERS            = 5.
        IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    Create the object for events
        CREATE OBJECT lcl_events.
        SET HANDLER lcl_events->handle_top_of_list FOR lcl_grid_disp.
    Display the  ALV.
        CALL METHOD lcl_grid_disp->set_table_for_first_display
          EXPORTING
            is_variant                    = w_variant
            i_save                        = ' '
            is_layout                     = wa_layout
          CHANGING
            it_outtab                     = t_final[]
            it_fieldcatalog               = t_fieldcat
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
        IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ELSE.
    Refresh the ALV grid
        CALL METHOD lcl_grid_disp->refresh_table_display
       EXPORTING
         IS_STABLE      =
         I_SOFT_REFRESH =
          EXCEPTIONS
            finished       = 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.
      ENDIF.
    endform.                    " grid_display
    In the perform change the same code is followed for different object with the fieldcatalog  is changed to edit based on flag.
    Set the Fieldcatalog.
      REFRESH t_fieldcat.
      PERFORM get_field_catalog.
    set the Layout.
      CLEAR wa_layout.
      wa_layout-cwidth_opt = 'X'.
    wa_layout-stylefname = 'CELLTAB'.
    set the Variant
      w_variant-report = sy-repid.
    Create the Instance for container
      IF lcl_custom_chng IS INITIAL.
        CREATE OBJECT lcl_custom_chng
          EXPORTING
           PARENT                      =
            container_name              = 'CONTAINER1'
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6.
        IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    create the object for ALV grid
        CREATE OBJECT lcl_grid_chng
          EXPORTING
            i_parent          = lcl_custom_chng
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            OTHERS            = 5.
        IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    Create the object for events
        CREATE OBJECT lcl_events.
        SET HANDLER lcl_events->handle_top_of_list FOR lcl_grid_chng.
        SET HANDLER lcl_events->handle_data_changed FOR lcl_grid_chng.
        SET HANDLER lcl_events->handle_data_changed_finished FOR lcl_grid_chng.
    Display the  ALV.
        CALL METHOD lcl_grid_chng->set_table_for_first_display
          EXPORTING
            is_variant                    = w_variant
            i_save                        = ' '
            is_layout                     = wa_layout
          CHANGING
            it_outtab                     = t_final[]
            it_fieldcatalog               = t_fieldcat
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
        IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ELSE.
    Refresh the ALV grid
        CALL METHOD lcl_grid_chng->refresh_table_display
       EXPORTING
         IS_STABLE      =
         I_SOFT_REFRESH =
          EXCEPTIONS
            finished       = 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.
      ENDIF.
    Please let me know if you require some more inputs?
    Jagath

  • ALV grid using OOABAP

    Hi all,
             Can anyone help me in making checkbox editable after an event.
    In my application, there is a checkbox for every record . And there is an update button. when i check a checkbox ,the entire row gets into editable mode, i made changes and then updated using update button. But when i again tried to check checkbox ,its not getting checked. can anyone help me out to solve this issue.
    Thanks in Advance,
    G.Pushpa

    As per my understanding your requirement is that you want to make a row editable when the user checked a check box corresponding to row. So except to that checkbox column you entire alv is non editable. I am not sure that update button is on alv grid or it is seperatly in a dynpro scree. I am giving you a solution when it is not at your alv screen
    So when the user check particular check box use get selected rows method of alv and find out the row id. Now the user
    click upon the button for update(make a subroutine for your logic) use the row id and make this row ready for input using ready for input metod of alv.
    After user make the modification implement you logic for updating the database/internal table as per you requiremnt. Also
    refresh yor alv grid here. You can use refresh table display for refreshing alv grid. Now you can again modify your
    check box for other row.
    In your fieldcatalog only make check box field editable.
    <request removed by moderator>
    Edited by: Thomas Zloch on Jan 20, 2011 11:25 PM - do not ask for ...

  • 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

  • Back from ALV Grid with multiple refresh

    I have a report that from a selection screen shows an editable ALV Grid, and after I save it, it will refresh the grid.
    My problem is when I hit the BACK button it returns to the "previous grid" instead of the selection screen
    I am using the following:
    WHEN 'BACK_C'.
      LEAVE to SCREEN '0'.
    How can I force it to go back to the selection screen?
    sidenote: I have tried using call
    selection-screen '1000'
    but it adds a new problem as in the selection screen hitting back will return to the grid and I can never exit the report.

    Neither solution works.
    If it helps, I'm refreshing the grid with:
    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.
    CALL METHOD ref_grid->refresh_table_display( ).
    It seems when I refresh the grid it generates a completely independent grid screen and there's no way to skip them all and return to the selection screen.

  • Refreshing contents of ALV grid

    I am displaying 2 ALV grids in a splitter container on screen 100. There is an option for refresh on this screen to refresh the entries in both the grids (if any change). This refresh works fine using method REFRESH_TABLE_DISPLAY for both top and bottom grid contents.
    After processing the contents in screen 100, the user can navigate to screen 200 to view results of the current run. This screen also holds an ALV grid display of results on a custom container. When returning to screen 100 from 200, the results in top grid of screen 100 are fixed. The refresh option now only works with the grid on bottom container and not the top. I have tried using both REFRESH_TABLE_DISPLAY and SET_TABLE_FOR_FIRST_DISPLAY options and neither worked.
    How do I refresh the ALV to use the contents from the new dataset?
    Regards,
    Suri.

    Are you used refresh in PBO of 100 ?
    Like
        call method g_grid->refresh_table_display.   " Top grid
        call method g_grid1->refresh_table_display. " bottom grid

  • Reg : ALV Grid Refresh - Output not appearing

    Hi All ,
    Am calling a screen 100 at 3 different places.
    Though i use refresh_table_display , The value in the output table, say i_final changes, but while displaying the output , the whole screen is blank , even the container is not appearing in the output .
    Can you please help me with your inputs .
    Regards,
    Chitra

    yes it is good ...see the example...for your requirement..
    REPORT yztest .
    TYPE-POOLS: slis.
    Tables
    TABLES: mara.
    TYPES: BEGIN OF ty_name,
           name  TYPE char10,
           age   TYPE i,
           END OF ty_name.
    TYPES: BEGIN OF ty_marks,
           sub1   TYPE i,
           sub2   TYPE i,
           total  TYPE  i,
           END OF ty_marks.
    TYPES: BEGIN OF ty_phone,
           phnum TYPE char10,
           END  OF ty_phone.
    TYPES: BEGIN OF ty_addr,
           address TYPE char20,
           END  OF ty_addr .
    Output internal table
    DATA: itab TYPE TABLE OF ty_name,
          wa   TYPE ty_name,
          itab1 TYPE TABLE OF ty_marks,
          wa1  TYPE ty_marks,
          itab2 TYPE TABLE OF ty_phone,
          wa2  TYPE ty_phone,
          itab3 TYPE TABLE OF ty_addr,
          wa3  TYPE ty_addr.
    ALV Grid
    DATA: r_grid  TYPE REF TO cl_gui_alv_grid,
          r_grid1 TYPE REF TO cl_gui_alv_grid,
          r_grid2  TYPE REF TO cl_gui_alv_grid,
          r_grid3  TYPE REF TO cl_gui_alv_grid,
          g_dock TYPE REF TO cl_gui_docking_container,
          g_dock1 TYPE REF TO cl_gui_docking_container,
          g_dock2 TYPE REF TO cl_gui_docking_container,
          g_dock3 TYPE REF TO cl_gui_docking_container,
          g_dock4 TYPE REF TO cl_gui_docking_container,
          it_fieldcat  TYPE lvc_t_fcat,
          it_fieldcat1 TYPE lvc_t_fcat,
          it_fieldcat2 TYPE lvc_t_fcat,
          it_fieldcat3 TYPE lvc_t_fcat,
          wa_fieldcat TYPE lvc_s_fcat.
    DATA picture TYPE REF TO cl_gui_picture.
    DATA url(255).
    CLEAR url.
    DATA  init.
    START-OF-SELECTION.
      wa-name = 'test01'.
      wa-age = '1'.
      APPEND wa TO itab.
      wa-name = 'test02'.
      wa-age = '2'.
      APPEND wa TO itab.
      wa-name = 'test03'.
      wa-age = '3'.
      APPEND wa TO itab.
      wa1-sub1 = '11'.
      wa1-sub2 = '22'.
      wa1-total = wa1-sub1 + wa1-sub2.
      APPEND wa1 TO itab1.
      wa1-sub1 = '22'.
      wa1-sub2 = '33'.
      wa1-total = wa1-sub1 + wa1-sub2.
      APPEND wa1 TO itab1.
      wa2-phnum = '99999999999'.
      APPEND wa2 TO itab2.
      wa2-phnum = '888888888888'.
      APPEND wa2 TO itab2.
      wa2-phnum = '777777777777'.
      APPEND wa2 TO itab2.
      wa3-address = 'HItech City'.
      APPEND wa3 TO itab3.
      wa3-address = 'Secunderabad'.
      APPEND wa3 TO itab3.
      wa3-address = 'Hyderabad'.
      APPEND wa3 TO itab3.
      PERFORM display_image.
      CALL SCREEN 100.
    *& Module STATUS_0100 OUTPUT
    text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'LISTOUT1'.
      SET TITLEBAR 'LIST1'.
      wa_fieldcat-fieldname = 'NAME'.
      wa_fieldcat-seltext   = 'NAME OF THE STUDENT'.
      wa_fieldcat-coltext =   'NAME OF THE STUDENT'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'AGE'.
      wa_fieldcat-seltext   = 'AGE OF THE STUDENT'.
      wa_fieldcat-coltext =    'AGE OF THE STUDENT'.
      APPEND wa_fieldcat TO it_fieldcat.
      wa_fieldcat-fieldname = 'SUB1'.
      wa_fieldcat-seltext   = 'SUBJECT1'.
      wa_fieldcat-coltext =    'SUBJECT1'.
      APPEND wa_fieldcat TO it_fieldcat1.
      wa_fieldcat-fieldname = 'SUB2'.
      wa_fieldcat-seltext   = 'SUBJECT2'.
      wa_fieldcat-coltext =    'SUBJECT2'.
      APPEND wa_fieldcat TO it_fieldcat1.
      wa_fieldcat-fieldname = 'TOTAL'.
      wa_fieldcat-seltext   = 'TOTAL'.
      wa_fieldcat-coltext =    'TOTAL'.
      APPEND wa_fieldcat TO it_fieldcat1.
      wa_fieldcat-fieldname = 'PHNUM'.
      wa_fieldcat-seltext   = 'PHONE NO'.
      wa_fieldcat-coltext =    'PHONE NO'.
      APPEND wa_fieldcat TO it_fieldcat2.
      wa_fieldcat-fieldname = 'ADDRESS'.
      wa_fieldcat-seltext   = 'ADDRESS'.
      wa_fieldcat-coltext =    'ADDRESS'.
      APPEND wa_fieldcat TO it_fieldcat3.
      IF g_dock IS INITIAL.
        CREATE OBJECT g_dock
                      EXPORTING
                      repid     = sy-repid
                      dynnr     = sy-dynnr
                      side      = g_dock->dock_at_left
                      extension = 300.
        CREATE OBJECT r_grid
                  EXPORTING
                  i_parent = g_dock.
      ENDIF.
      IF g_dock1 IS INITIAL.
        CREATE OBJECT g_dock1
                      EXPORTING
                      repid     = sy-repid
                      dynnr     = sy-dynnr
                      side      = g_dock1->dock_at_right
                      extension = 300.
        CREATE OBJECT r_grid1
                  EXPORTING
                  i_parent = g_dock1.
      ENDIF.
      IF g_dock2 IS INITIAL.
        CREATE OBJECT g_dock2
                      EXPORTING
                      repid     = sy-repid
                      dynnr     = sy-dynnr
                      side      = g_dock2->dock_at_top
                      extension = 100.
        CREATE OBJECT r_grid2
                  EXPORTING
                  i_parent = g_dock2.
        IF g_dock3 IS INITIAL.
          CREATE OBJECT g_dock3
                        EXPORTING
                        repid     = sy-repid
                        dynnr     = sy-dynnr
                        side      = g_dock3->dock_at_top
                        extension = 100.
          CREATE OBJECT r_grid3
                    EXPORTING
                    i_parent = g_dock3.
        ENDIF.
        IF NOT itab[] IS INITIAL.
          CALL METHOD r_grid->set_table_for_first_display
            CHANGING
              it_outtab       = itab
              it_fieldcatalog = it_fieldcat.
        ENDIF.
        IF NOT itab1[] IS INITIAL.
          CALL METHOD r_grid1->set_table_for_first_display
            CHANGING
              it_outtab       = itab1
              it_fieldcatalog = it_fieldcat1.
        ENDIF.
        IF NOT itab2[] IS INITIAL.
          CALL METHOD r_grid2->set_table_for_first_display
            CHANGING
              it_outtab       = itab2
              it_fieldcatalog = it_fieldcat2.
        ENDIF.
        IF NOT itab3[] IS INITIAL.
          CALL METHOD r_grid3->set_table_for_first_display
            CHANGING
              it_outtab       = itab3
              it_fieldcatalog = it_fieldcat3.
        ENDIF.
    if   g_dock4 is initial.
        CREATE OBJECT g_dock4
                      EXPORTING
                      repid     = sy-repid
                      dynnr     = sy-dynnr
                      side      = g_dock4->dock_at_bottom
                      extension = 100.
        CREATE OBJECT picture
                          EXPORTING parent = g_dock4.
        CALL METHOD picture->load_picture_from_url
          EXPORTING
            url = url.
        init = 'X'.
    endif.
      ENDIF.
    ENDMODULE. " STATUS_0100 OUTPUT
    *& Module USER_COMMAND_0100 INPUT
    text
    MODULE user_command_0100 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    *&      Form  display_image
    FORM display_image .
      DATA query_table LIKE w3query OCCURS 1 WITH HEADER LINE.
      DATA html_table LIKE w3html OCCURS 1.
      DATA return_code LIKE  w3param-ret_code.
      DATA content_type LIKE  w3param-cont_type.
      DATA content_length LIKE  w3param-cont_len.
      DATA pic_data LIKE w3mime OCCURS 0.
      DATA pic_size TYPE i.
      REFRESH query_table.
      query_table-name = '_OBJECT_ID'.
      query_table-value = 'ENJOYSAP_LOGO'.
      APPEND query_table.
      CALL FUNCTION 'WWW_GET_MIME_OBJECT'
        TABLES
          query_string        = query_table
          html                = html_table
          mime                = pic_data
        CHANGING
          return_code         = return_code
          content_type        = content_type
          content_length      = content_length
        EXCEPTIONS
          object_not_found    = 1
          parameter_not_found = 2
          OTHERS              = 3.
      IF sy-subrc = 0.
        pic_size = content_length.
      ENDIF.
      CALL FUNCTION 'DP_CREATE_URL'
        EXPORTING
          type     = 'image'
          subtype  = cndp_sap_tab_unknown
          size     = pic_size
          lifetime = cndp_lifetime_transaction
        TABLES
          data     = pic_data
        CHANGING
          url      = url
        EXCEPTIONS
          OTHERS   = 1.
    ENDFORM.                    " display_image
    *&      Module  EXIT  INPUT
          text
    MODULE exit INPUT.
      CALL METHOD g_dock->free.
      CALL METHOD g_dock1->free.
      CALL METHOD g_dock2->free.
      CALL METHOD g_dock3->free.
    ENDMODULE.                 " EXIT  INPUT

  • Refresh alv grid after user clicks f4( value-request)

    Hello Experts,
    I am currently developing a module pool program wherein after the user selects a value via f4(value request),
    my ALV grid(using custom control) should be refreshed to show the new records selected based
    on the f4 value. How can this be achieved?
    thank you guys and take care!

    Did you try a CALL METHOD [cl_gui_cfw=>set_new_ok_code|http://help.sap.com/saphelp_sm32/helpdata/en/06/3fa1b79f2811d2bd68080009b4534c/frameset.htm] and [=>flush|http://help.sap.com/saphelp_sm32/helpdata/EN/06/3fa1879f2811d2bd68080009b4534c/content.htm] in the POV section or in event onF4 handler method to force execution of PAI (either it works either it dumps)
    Regards,
    Raymond

Maybe you are looking for

  • Is there a way to Auto-Correct Spelling of text as I write text in Dreamweaver CS6 ?

    While I write text on the html pages using Dreamweaver CS6 (Adobe Cloud downloaded version 2014), there is only an option to Spell Check the page. But I am asking if there is a way to set preferences to auto-correct suggestions such as how Word Docs

  • Will Apple's 30 " Display overheat a 17" PB?

    I am about ready to purchase a 17 PowerBook and the 30" Apple Cinema Display. Can anyone tell me if they have had any overheating issues with similar setups (ie; 15" PB)??? Does the PB fan run continuously when 30" display is used? Thanks to all that

  • Insert into two tables, how to insert multiple slave records

    Hi, I have a problem with insert into two tables wizard. The wizard works fine and I can add my records, but I need to enter multiple slave table records. My database: table: paper `id_paper` INTEGER(11) NOT NULL AUTO_INCREMENT, `make` VARCHAR(20) CO

  • How do I call image file names from MySQL & display the image?

    Hello everyone, I have image file names (not the full URL) stored in a MySQL database. The MySQL database is part of MAMP 1.7 and I am using Dreamweaver CS3 on a Mac Book Pro. I would like to create a catalog page using thumbnails, and PayPal buttons

  • Flash Player & AMD

    So.... It starts after I my PC went back to the body shop a couple of weeks ago. It came back fixed (new motherboard) & with a new set of Windows 8 loaded. Soon I started having troubles with the message 'Display driver has crashed & recovered'... ov