Skip to Content
author's profile photo Former Member
Former Member

ALV Grid Display:Filter problem

Hi All.

In the OOALV Grid display,My set filter button is enabled and the delete button is siabled.Howto enable this button?

I am displaying My ALV List (50 Records) and I am filtering those contents on some condition (20 Records).

In these 20 records ,i am deleting 5 records . (15 records).

Now if I remove the filter,it should dispaly me (15 + 30 = 45 Records ) But is just diaplying the 15 records.

Since the delete filter button is standard one,any statements under it are not executing.

How to resolve this issue ? Please point at it.

I am making use of the method GET_FILTERED_ENTRIES .

Any pointers will be helpful.

Regards,

SSR.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on May 19, 2008 at 03:35 AM

    Hello

    When I run a sample report of mine with an editable ALV grid it behaves as expected:

    1.) Select 20 entries of customers from KNB1

    2.) Filter for specific "Created by" user -> 16 rows are filtered, 4 rows remain

    3.) Delete 2 out of 4 visible rows

    4.) Delete filter on column -> 16 + 2 = 18 rows visible

    The easiest explanation for your observation is that at some point in your report you replace the 40 entries in your OUTTAB with the filtered records (20) you retrieved from method GET_FILTERED_ENTRIES.

    Thus, when you delete rows from the ALV list you no longer have 40 but 20 records and then everything is ok (20 - 5 deleted records = 15).

    I used the sample report ZUS_SDN_ALVGRID_EDITABLE:

    *&---------------------------------------------------------------------*
    *& Report  ZUS_SDN_ALVGRID_EDITABLE
    *&
    *&---------------------------------------------------------------------*
    *&
    *&
    *&---------------------------------------------------------------------*
    
    REPORT  zus_sdn_alvgrid_editable.
    
    DATA:
      gd_okcode        TYPE ui_func,
    *
      gt_fcat          TYPE lvc_t_fcat,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid.
    
    
    DATA:
      gt_knb1          TYPE STANDARD TABLE OF knb1.
    
    
    PARAMETERS:
      p_bukrs      TYPE bukrs  DEFAULT '2000'  OBLIGATORY.
    
    
    
    
    
    
    START-OF-SELECTION.
    
      SELECT        * FROM  knb1 INTO TABLE gt_knb1 UP TO 30 ROWS
             WHERE  bukrs  = p_bukrs.
    
    
    
    * 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 ALV grid
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent = go_docking
        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.
    
    
    
    
    * Build fieldcatalog and set hotspot for field KUNNR
      PERFORM build_fieldcatalog_knb1.
    
    
    
    * Display data
      CALL METHOD go_grid1->set_table_for_first_display
        CHANGING
          it_outtab       = gt_knb1
          it_fieldcatalog = gt_fcat
        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.
    
    
    * ok-code field = GD_OKCODE
      CALL SCREEN '0100'.
    
    
    END-OF-SELECTION.
    
    *&---------------------------------------------------------------------*
    *&      Module  STATUS_0100  OUTPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    
    
    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.
    
    
    
        WHEN OTHERS.
          CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
            EXPORTING
              i_structure_name = 'KNB1'
              i_grid_title     = 'before CHECK_DATA_CHANGED'
            TABLES
              t_outtab         = gt_knb1
            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.
    
    
    *     Transport of changes from ALV grid -> itab
          go_grid1->check_changed_data( ).
    
          CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
            EXPORTING
              i_structure_name = 'KNB1'
              i_grid_title     = 'after CHECK_DATA_CHANGED'
            TABLES
              t_outtab         = gt_knb1
            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.
    
    
      ENDCASE.
    
      CLEAR: gd_okcode.
    
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    
    
    *&---------------------------------------------------------------------*
    *&      Form  BUILD_FIELDCATALOG_KNB1
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *  -->  p1        text
    *  <--  p2        text
    *----------------------------------------------------------------------*
    FORM build_fieldcatalog_knb1 .
    * define local data
      DATA:
        ls_fcat        TYPE lvc_s_fcat.
    
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'KNB1'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_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.
    
    
      LOOP AT gt_fcat INTO ls_fcat
              WHERE ( fieldname = 'ZUAWA' ).
        ls_fcat-edit    = abap_true.
        ls_fcat-col_opt = abap_true.
        MODIFY gt_fcat FROM ls_fcat.
      ENDLOOP.
    
    
    ENDFORM.                    " BUILD_FIELDCATALOG_KNB1
    

    Regards

    Uwe

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.