To deactivate filters in ALV grid

Hi all,
    Please help me to deactivate the filters in ALV grid.
Thanks in Advance,
  Regards,
  Shaju

Hi,
you can exclude buttons from ALV toolbar in your program.
Check these links -
Re: ALV Exclude Functions
Re: How we will exclude some buttons from alv list display
Re: ALV classes - exclude function codes
Regards,
Amit
Reward all helpful replies.

Similar Messages

  • Deactivate buttons in ALV GRID being called in subscreen

    Hi,
    In a screen, when a specific tab is selected (tab strip), the subscreen area is filled with ALV GRID. I need to deactivate few buttons on the ALV GRID. How can that be done??
    Advance Thanks

    Hi Aadarsh,
    Check out the following program.
    Global data definitions for ALV
    To allow the declaration of gr_event_handler before the
    lcl_event_receiver class is defined, decale it as deferred in the
    start of the program
    CLASS lcl_event_handler DEFINITION DEFERRED.
    Object reference
    ALV Grid instance reference
    DATA: gr_alvgrid    TYPE REF TO cl_gui_alv_grid,
    Custom container instance reference
          gr_ccontainer TYPE REF TO cl_gui_custom_container,
    Event class reference
          gr_event_handler TYPE REF TO lcl_event_handler.       "IC210507+
    Internal Table
    Field catalog table
    DATA: gt_fieldcat TYPE lvc_t_fcat,
    Internal table holding list data
          gt_list     TYPE STANDARD TABLE OF sflight,
    Table to be filled up for excluding some of the standard function
    buttons
          gt_exclude  TYPE ui_functions.                        "IC210507+
    Work area
    Layout structure
    DATA: gs_layout   TYPE lvc_s_layo,
    Field catalog structure
          gs_fcat     TYPE lvc_s_fcat,
    Exclude button structure
          gs_exclude  TYPE ui_func,                             "IC210507+
    Structure to add button in the ALV toolbar
          gs_toolbar  TYPE stb_button.                          "IC210507+
    Variables
    DATA: ok_code                TYPE sy-ucomm,
          save_ok                TYPE sy-ucomm,
    Name of the custom control added on the screen
          gv_custom_control_name TYPE scrfname VALUE 'CC_ALV'.
    Begin of IC210507
    Local classes
    CLASS lcl_event_handler DEFINITION .
      PUBLIC SECTION.
        METHODS:
    To add new functional buttons to the ALV toolbar
        handle_toolbar      FOR EVENT toolbar OF cl_gui_alv_grid
                            IMPORTING e_object e_interactive,
    To implement user commands
        handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
                            IMPORTING e_ucomm.
    ENDCLASS.                    "lcl_event_handler DEFINITION
    End of IC210507
    Calling the screen where ALV output is displayed
    CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
          PBO
    MODULE status_0100 OUTPUT.
    ALV display
      PERFORM display_alv.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          PAI
    MODULE user_command_0100 INPUT.
      save_ok = ok_code.
      CLEAR ok_code.
      IF save_ok EQ 'EXIT'.
        LEAVE PROGRAM.
      ENDIF.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  display_alv
          ALV display
    FORM display_alv.
      PERFORM get_data.
      PERFORM create_alv.
    ENDFORM.                    " display_alv
    *&      Form  get_data
          Fetch data to be displayed in the list
    FORM get_data.
      SELECT * FROM sflight
               INTO TABLE gt_list.
    ENDFORM.                    " get_data
    *&      Form  create_alv
          Create and set or Refresh ALV
    FORM create_alv.
    Checking whether an instance of the container (or ALV Grid) exists.
      IF gr_alvgrid IS INITIAL.
    If not, creating and setting ALV for the first display.
    Creating custom container instance
        CREATE OBJECT gr_ccontainer
          EXPORTING
            container_name              = gv_custom_control_name
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6.
    Creating ALV Grid instance
        CREATE OBJECT gr_alvgrid
          EXPORTING
            i_parent          = gr_ccontainer
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            OTHERS            = 5.
    Begin of IC210507
    Creating an instance for the event handler
        CREATE OBJECT gr_event_handler.
    Registering handler methods to handle ALV Grid events
        SET HANDLER gr_event_handler->handle_user_command FOR gr_alvgrid.
        SET HANDLER gr_event_handler->handle_toolbar FOR gr_alvgrid.
    End of IC210507
    Preparing field catalog.
        PERFORM prepare_field_catalog CHANGING gt_fieldcat.
    Preparing layout structure
        PERFORM prepare_layout CHANGING gs_layout.
    Excluding Unwanted Standard Function Buttons
        PERFORM exclude_tb_functions CHANGING gt_exclude.       "IC210507+
    Method to display ALV grid
        CALL METHOD gr_alvgrid->set_table_for_first_display
          EXPORTING
            is_layout                     = gs_layout
    To exclude buttons the exclusion table must be passed to the following
    field
            it_toolbar_excluding          = gt_exclude          "IC210507+
          CHANGING
            it_outtab                     = gt_list
            it_fieldcatalog               = gt_fieldcat
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
    To make ALV show our additional buttons, we must call the method
    “set_toolbar_interactive” for the ALV Grid instance after the instance
    is created.
        CALL METHOD gr_alvgrid->set_toolbar_interactive.       "IC210507+
      ELSE.
    If an instance of the container (or ALV Grid) exists, refreshing it.
        CALL METHOD gr_alvgrid->refresh_table_display
          EXCEPTIONS
            finished = 1
            OTHERS   = 2.
      ENDIF.
    ENDFORM.                    " create_alv
    *&      Form  prepare_field_catalog
          Subroutine to populate field catalog
         <--P_GT_FIELDCAT  Table to describe the field catalog
    FORM prepare_field_catalog  CHANGING p_gt_fieldcat TYPE lvc_t_fcat.
    Generating the field catalog semi automatically
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'SFLIGHT'
        CHANGING
          ct_fieldcat            = p_gt_fieldcat
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      LOOP AT p_gt_fieldcat INTO gs_fcat.
        CASE gs_fcat-fieldname.
          WHEN 'CARRID'.
            gs_fcat-outputlen = '10'.
            gs_fcat-coltext = 'Airline Carrier ID'.
            MODIFY p_gt_fieldcat FROM gs_fcat.
          WHEN 'FLDATE'.
            gs_fcat-just = 'C'.
            gs_fcat-hotspot = 'X'.
            MODIFY p_gt_fieldcat FROM gs_fcat.
        ENDCASE.
      ENDLOOP.
    ENDFORM.                    " prepare_field_catalog
    *&      Form  prepare_layout
          Preparing layout structure
         <--P_GS_LAYOUT  Layout structure
    FORM prepare_layout  CHANGING p_gs_layout TYPE lvc_s_layo.
      p_gs_layout-zebra = 'X' .
      p_gs_layout-grid_title = 'Flight Info System'.
      p_gs_layout-smalltitle = 'X'.
    ENDFORM.                    " prepare_layout
    Begin of IC210507
    *&      Form  exclude_tb_functions
          Excluding Unwanted Standard Function Buttons
         <--P_GT_EXCLUDE  Table to be filled up to exclude buttons
    FORM exclude_tb_functions  CHANGING p_gt_exclude TYPE ui_functions.
    “MC_FC_” are names for functions directly and the names beginning with
    “MC_MB_” are for the function menus including some subfunctions as menu
    entries.
    In this case 'Maximum' and 'Minimum' options under 'Sum' button & 'Print'
    button are excluded
      gs_exclude = cl_gui_alv_grid=>mc_fc_maximum.
      APPEND gs_exclude TO p_gt_exclude.
      gs_exclude = cl_gui_alv_grid=>mc_fc_minimum.
      APPEND gs_exclude TO p_gt_exclude.
      gs_exclude = cl_gui_alv_grid=>mc_fc_print.
      APPEND gs_exclude TO p_gt_exclude.
    ENDFORM.                    " exclude_tb_functions
    *&       Class (Implementation)  lcl_event_handler
           Event handler for the ALV Grid instance.
    CLASS lcl_event_handler IMPLEMENTATION.
    Handle Toolbar
      METHOD handle_toolbar.
        PERFORM handle_toolbar USING e_object e_interactive .
      ENDMETHOD .                    "handle_toolbar
    Handle User Command
      METHOD handle_user_command .
        PERFORM handle_user_command USING e_ucomm .
      ENDMETHOD.                    "handle_user_command
    ENDCLASS.               "lcl_event_handler
    *&      Form  handle_toolbar
          Subroutine called from event handler method for event toolbar.
          This is to add a new button in the ALV application toolbar
         -->P_E_OBJECT
         -->P_E_INTERACTIVE
    FORM handle_toolbar  USING    p_e_object TYPE REF TO cl_alv_event_toolbar_set
                                  p_e_interactive.
    Begin of 'Adding a new Button'
      CLEAR gs_toolbar.
    Function code
      MOVE 'EXIT' TO gs_toolbar-function.
    Button type that will be added to the toolbar
      gs_toolbar-butn_type = 0.
    Icon for the button
    From the type group ICON in SE11, we can get the value to be passed
    for icon
      gs_toolbar-icon = '@2N@'.
    Quick info for the button
      MOVE 'Exit' TO gs_toolbar-quickinfo.
    Text for the button
      MOVE 'Exit' TO gs_toolbar-text.
    Adds the button as disabled if set to X
      MOVE ' ' TO gs_toolbar-disabled.
    Appending the structure to the table attribute “mt_toolbar” of the object
      APPEND gs_toolbar TO p_e_object->mt_toolbar.
    End of 'Adding a new Button'
    Begin of 'Disabling an existing standard Button'
      LOOP AT p_e_object->mt_toolbar
              INTO gs_toolbar
    Identify which button to disable from the function code
    In this case disabling the 'Filter' button
              WHERE function = '&MB_FILTER'.
    Set the 'DISABLED' field to disable a button
        gs_toolbar-disabled = 'X'.
        MODIFY p_e_object->mt_toolbar FROM gs_toolbar.
      ENDLOOP.
    End of 'Disabling an existing standard Button'
    ENDFORM.                    " handle_toolbar
    *&      Form  handle_user_command
          Implement any new function
         -->P_E_UCOMM  text
    FORM handle_user_command  USING    p_e_ucomm TYPE syucomm.
      IF p_e_ucomm EQ 'EXIT'.
        LEAVE PROGRAM.
      ENDIF.
    ENDFORM.                    " handle_user_command
    End of IC210507
    Award points if found useful.
    Regards
    Indrajit.

  • To activate/deactivate checkbox in ALV grid report

    Hi All,
    I am trying to create an ALV Grid that contains check-box as column fields. I am able to either activate or deactivate all the check-boxes in the entire column. But, I need to keep only certain check-boxes for editing based on certain conditions. The other check-boxes in the column should be deactivated for editing by the user. Any help is appreciated.
    -Dinesh

    Hi dinesh babu ,
    In this example, i use 'REUSE_ALV_GRID_DISPLAY_LVC'
    FORM display_alv .
    DATA: ls_event_exit TYPE slis_event_exit,
          lt_event_exit TYPE slis_event_exit OCCURS 1.
    DESCRIBE TABLE itab_data LINES lv_cont.
    PERFORM layout_build   USING gs_layout.
    PERFORM eventtab_build USING gt_events[].
    PERFORM comment_build  USING gt_lheader[].
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
    i_structure_name            = 'ZHRESS_FORMACION_ALV'
    i_client_never_display   = 'X'
    i_bypassing_buffer         = 'X'
    CHANGING
    ct_fieldcat                      = gt_fieldcat[]
    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_fieldcat INTO ls_fcat.
    Active check field
      IF ls_fcat-fieldname EQ 'CHECK'.
         ls_fcat-checkbox     = 'X'.
         ls_fcat-edit             = 'X'.
         ls_fcat-fix_column  = 'X'.
         ls_fcat-reptext        = 'Check'.
      ENDIF.
      PERFORM field_attributes.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
         i_background_id                   = 'ALV_BACKGROUND'
    i_callback_program             = g_repid
    i_callback_pf_status_set      = 'PF_STATUS'
    i_callback_user_command  = 'USER_COMMAND'
    is_layout_lvc                       = gs_layout
    it_fieldcat_lvc                     = gt_fieldcat[]
    i_save                                 = g_save
    is_variant                            = g_variant
    it_events                             = gt_events[]
    it_event_exit                       = lt_event_exit
    i_default                             = 'X'
    TABLES
    t_outtab                              = itab_data.
    ENDFORM.                    " DISPLAY_ALV
    FORM field_attributes .
      DATA ls_stylerow TYPE lvc_s_styl .
      DATA lt_styletab TYPE lvc_t_styl .
      LOOP AT itab_data INTO wa_data.
        IF wa_data-status NE c_status_p.         " Condition for enable / disable check
          ls_stylerow-fieldname = 'CHECK' .
          ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.  "set field to disabled
          APPEND ls_stylerow TO wa_data-field_style.
          MODIFY itab_data FROM wa_data.
        ENDIF.
      ENDLOOP.
    ENDFORM.   
    Regards,
    José
    Edited by: Jose Luzardo on Oct 6, 2009 3:37 PM

  • Deactivate the double click/ hot spot for a particular row in alv grid.

    Hello,
       As per a certain condition how to deactivate the double click/ hot spot for a particular row in alv grid.
    Regards,
    Saroj

    where u define layout there is a field hotspot.like
    data: var.
    if con is true
    var = 'X'. (show hotspot)
    else.
    var = ' '. (deactive hotspot)
    elseif ws_fieldcat-fieldname = 'DMBTR'
                    AND ws_fieldcat-tabname = 'T_MTAB'.
          ws_fieldcat-do_sum = C_X.
          <b>ws_fieldcat-hotsopts = var.</b>
          MODIFY Wt_fieldcat FROM ws_fieldcat
                  TRANSPORTING   DO_SUM.
    It is helpful for u. if any problen send me ur coding i will change it.
    Regards
    Manish Kumar

  • Sub:Filtering is not working in ALV Grid

    Hi All,
    I developed a new ALV report,where in the out put i can set filtering for other columns(ex:Date,Number),but i can'nt able to set Filtering for one of the column which is CHAR type.
    But when we went to table for this field filtering is working,but not in the ALV Grid  of our report.
    Regards,
    Seshadri G

    hi,
    1) for filtering, we create an internak table of type <b>LVC_T_FILT</b>,
    U can assign fields to the above created internal as per u requirements.
    2) passing the above internal table to CHANGING parameter of method SET_TABLE FORFIRST_DISPLAY in ALV GRID.
    <b>IT_FILTER = < internal table TYPE LVC_T_FLIT>.</b>
    <u><b>OR call this method for setting filter criteria as per u r requirement.</b></u>
    Set current filter settings. A row of the table describes the selection conditions for column entries that are not to be displayed.
    You should never manually set up the internal table with the filter settings. Use this method only to set filter criteria that you got using get_filter_criteria or a layout.
    Features
    CALL METHOD <ref. var. to CL_GUI_ALV_GRID > ->set_filter_criteria
       EXPORTING
          IT_FILTER  =   <internal table of type LVC_T_FILT > .
    Parameter
    Meaning
    IT_FILTER
    Table with filter settings
    regards,
    AshokReddy.
    Message was edited by:
            Ashok Reddy
    Message was edited by:
            Ashok Reddy

  • ALV GRID Display Column Width problem when filtering

    Hello All,
       When i displaying ALV Grid Display ,i selected one column and set filter for that.
    the problem is column width at display is 12 charecters but in filter it is allowing only 10 charecters to enter which is wrong. i am unable to set filter.please give solution.
    Thanks
    Sandeep.G

    hello i am calling perform, ineed to set OUTPUTLEN according to field length how can i do that.
    FORM fill_fieldcat  USING  p_field TYPE slis_fieldcat_alv-fieldname
                               p_text  TYPE slis_fieldcat_alv-seltext_l
                               p_flag TYPE c.
      wa_fieldcat-fieldname    = p_field.
      wa_fieldcat-seltext_l    = p_text.
      wa_fieldcat-no_out  = p_flag.
       wa_fieldcat-outputlen = 20.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.

  • Field filtering of FI-AA balance report by ALV grid

    Hi, Gurus,
    Here is very simple question for reporting program in FI-AA
    Symptoms likes below,
    Transaction : Impossible to filter " Asset class" field on several FI-AA standard reporting 
    Display option:  ALV GRID ,
    Field name : Asset class (ANLAV-ANLKL, Character)
    Length of field : 8
    Status : Asslet class criteria is already involved to their layout of report.
                 Indivisual asset list and each asset class is successfully displayed.
                 When set filter on asset class cuolumn, Possible entry list is displayed.
                But filnally after i determine value for filter asset class cretiera, result of execution is nothing to be displayed
    As you konw, several standard reporting program is services in Fi-AA
    For this reason , I guess this symptommay will be found on your coompany code
    If you have any good idea or solution for this , Just let me know
    I will appreciate your response in advance,
    Regard

    Try to write an * after the value of the class of the asset on the filter.
    Bye

  • Change of count on the header on filtering the ALV

    Hi Gurus!
    I have this ALV report which gives the sales order report, in the output right on the top the report shows the count of all the distinct sales order displayed when the report is run based ona  selection criteria. Is it possible to show the total count of teh sales order in the report to change and show teh number of distinct sales doc when we use filter on teh report. Suppose if we run the report based on a particular selection criteria and it gives a count of 30 . In the output if we put filter on a particular column and the report shows fewer lines , which will reduce the number of sales doc, is it possible to show this number which for eg will be say 20 , is it possible to show the number 20 after filetr on ALV instead of that 30 remainiung constant. I am wanting the report to show the change in count of distinct sales doc when I put filter on any columnh.
    report  zsales_orders message-id zsd no standard page heading.
    * For ALV usage
    type-pools: slis.
    data: gs_layout   type slis_layout_alv,
          ta_events   type slis_t_event_exit,
          tp_event    type slis_event_exit,
          tp_print    type slis_print_alv,
          gt_sort     type slis_t_sortinfo_alv,
          gt_events   type slis_t_event,
          t_fieldcat  type slis_t_fieldcat_alv with header line,
          repid       type syrepid,               " ABAP Program.
          gt_list_top_of_page type slis_t_listheader,     " Top of page text.
          gs_list_top_of_page type slis_listheader,
          alv_variant   type disvariant.           " Customize Disp. Variant
    data: w_field    type slis_fieldcat_alv.
    data: count type i.
    data: count1 type i.
    tables: vbak, vbap, vbpa, knvv.
    * Definition of selection screen                                       *
    *   By plant, storage location, sold-to customers, material and        *
    *   posting date of the sales orders                                   *
    selection-screen begin of block one with frame title text-001.
    parameters:     p_vkorg  type vkorg obligatory memory id vko,"DEVK906677
                    p_vtweg  type vtweg obligatory default '01',
                    p_spart  type spart obligatory default '01'.
    select-options: s_vkbur  for  vbak-vkbur,      " Sales Office     "DEVK906677
                    s_kunnr  for  vbak-kunnr.      " Sold-to customer number.
    select-options: s_shipto for  vbap-oid_ship,   " Ship-to customer number.
                    s_billto for  vbpa-kunnr,      " bill-to from S.O. header.
                    s_load   for  vbpa-kunnr,      " Load confirmation contact.
                    s_truck  for  vbap-oid_extbol. " Trucking ticket number.
    select-options: s_werks for vbap-werks obligatory no intervals. " Plant.
    select-options: s_lgort for vbap-lgort.        " Storage location.
    select-options: s_matnr for vbap-matnr.        " Material number.
    select-options: s_konda for knvv-konda.        " price group
    selection-screen skip 1.
    select-options: s_vdatu for vbak-vdatu default sy-datum.
    selection-screen end of block one.
    * ALV display layout
    selection-screen begin of block layout with frame title text-003.
    parameters: pa_vari type slis_vari default ' '. " Display variant.
    selection-screen end of block layout.
    selection-screen begin of block two with frame title text-028.
    selection-screen comment: /1(79) text-029.
    selection-screen comment: /1(79) text-030.
    selection-screen comment: /1(79) text-031.
    selection-screen comment: /1(79) text-032.
    selection-screen comment: /1(79) text-033.
    selection-screen comment: /1(79) text-034.
    selection-screen comment: /1(79) text-035.
    selection-screen comment: /1(79) text-036.
    selection-screen end of block two.
    * Data Definitions                                                     *
    * Storing Extracted Info.
    types: begin of t_extract,
             vbeln        type vbeln_va,   " Sales order number.
             augru        type augru,      " order reason
             vdatu        type edatu_vbak, " Requested delivery date.
             kunnr        type kunag,      " Sold-to customer number.
             soldto_name  type name1_gp,   " Sold-to name.
             posnr        type posnr_va,   " Item number.
             matnr        type matnr,      " Material number.
             vrkme        type vrkme,      " Sales UoM.
             mseh3        type mseh3,      " UoM text.
             netwr        type netwr_ap,   " Net value of the order item.
             kwmeng       type p length 13 decimals 1, " Quantity.
             werks        type werks_d,    " Plant.
             lgort        type lgort_d,    " Storage location.
             oid_extbol   type oid_extbol, " External BOL or truck ticker header.
             maktx        type maktx,      " Material description.
             oid_ship     type kunwe,      " Ship-to customer number.
             shipto_name  type name1_gp,   " Ship-to name.
             billto       type kunre,      " Bill-to customer number.
             billto_name  type name1_gp,   " Bill-to name.
             load_contact type kunnr,      " Load confirmation contact.
             load_name    type name1_gp,   " Load confirmation contact name.
             truck        type kunnr,      " Truck company number.
             truck_name   type name1_gp,   " Truck company name.
             bstkd        type bstkd,      " PO number.
             ihrez        type ihrez,      " AFE number per the contract/sales order.
             delivery     type vbeln_vl,   " Delivery number.
             posnr_vl     type posnr_vl,   " Delivery item number.
             bill_vbeln   type vbeln_vf,   " Invoice number.
             bill_posnr   type posnr_vf,   " Invoice item number.
             bill_netwr   type netwr_fp,   " Invoice net value.
             statu        type stats,      " Document status.
             auart        type auart,      " order type
             vkorg        type vkorg,      " sales org.
             vtweg        type vtweg,      " distrbtn channel
             spart        type spart,      " division
             vkbur        like vbak-vkbur, " Sales Office DEVK906677
             konda        type konda,      " price group
             tdline       type tdline,     " text for customer account reference
             count        type i,
           end of t_extract.
    data : it_extract  type table of t_extract with header line,
           it_extract2 type table of t_extract with header line.
    data:  it_text type table of tline with header line.
    data: w_index type sy-index,
          w_tdname type tdobname.
    constants: c_minus1       type netwr_ap value '1.00-'.
    *RANGES: r_auart FOR vbak-auart.
    data: r_auart type range of t_extract-auart,
          r_auart_line like line of r_auart.
    * initialization
    initialization.
      tp_event-ucomm = '&ILT'.  " Filter event.
      tp_event-after = 'X'.
      append tp_event to ta_events.
      gs_layout-colwidth_optimize = 'X'.
      tp_print-no_print_listinfos = 'X'.
      tp_print-no_coverpage = 'X'.
      perform set_fieldcat.
      perform alv_eventtab_build using:
    **    Event name     Form to execute     Event internal table
       'TOP_OF_PAGE'  'TOP_OF_PAGE'       gt_events[].
    * changed to exclude following order types
      r_auart_line-sign   = 'I'.
      r_auart_line-option = 'EQ'.
      r_auart_line-low    = 'ZEQ'.
      clear r_auart_line-high.
      append r_auart_line to r_auart.
    * credit memo
      r_auart_line-sign   = 'I'.
      r_auart_line-option = 'EQ'.
      r_auart_line-low    = 'ZPRC'.
      clear r_auart_line-high.
      append r_auart_line to r_auart.
    * debit memo
      r_auart_line-sign   = 'I'.
      r_auart_line-option = 'EQ'.
      r_auart_line-low    = 'ZPRD'.
      clear r_auart_line-high.
      append r_auart_line to r_auart.
      r_auart_line-sign   = 'I'.
      r_auart_line-option = 'EQ'.
      r_auart_line-low    = 'ZDR'.
      clear r_auart_line-high.
      append r_auart_line to r_auart.
    * Industry sales order correction
      r_auart_line-sign   = 'I'.
      r_auart_line-option = 'EQ'.
      r_auart_line-low    = 'ZSOC'.
      clear r_auart_line-high.
      append r_auart_line to r_auart.
    * oilfield FF correction
      r_auart_line-sign   = 'I'.
      r_auart_line-option = 'EQ'.
      r_auart_line-low    = 'ZOCF'.
      clear r_auart_line-high.
      append r_auart_line to r_auart.
    * oilfield WP correction
      r_auart_line-sign   = 'I'.
      r_auart_line-option = 'EQ'.
      r_auart_line-low    = 'ZOCW'.
      clear r_auart_line-high.
      append r_auart_line to r_auart.
    * Dropdown list for all created ALV layouts, global or user-specific
    at selection-screen on value-request for pa_vari.
      perform alv_variant_f4 changing pa_vari.
    * Main BODY of processing logic
    start-of-selection.
      perform extract_data.
    end-of-selection.
      if not it_extract[] is initial.
    * Build headings for report.
        perform build_top_of_page  using gt_list_top_of_page[].
        perform call_alv.
      endif.
    *&      Form  EXTRACT_KEY_DATA
    * Retreive the data for the report.
    form extract_data.
      clear: it_extract.  refresh: it_extract.
    * orders
      select vbak~vbeln vbak~auart vbak~augru vbak~vkorg vbak~vtweg
             vbak~spart vbak~vdatu vbak~kunnr vbak~vkbur
             vbap~posnr vbap~matnr vbap~vrkme vbap~netwr vbap~kwmeng
             vbap~werks vbap~lgort vbap~oid_extbol vbap~oid_ship
        into corresponding fields of table it_extract
        from vbak inner join vbap
             on  vbak~mandt = vbap~mandt
             and vbak~vbeln = vbap~vbeln where
        vbak~auart not in r_auart and
        vbak~vkorg eq p_vkorg and
        vbak~vtweg eq p_vtweg and
        vbak~spart eq p_spart and
        vbak~vkbur in s_vkbur and                               "DEVK906677
        vbak~vdatu in s_vdatu and
        vbak~kunnr in s_kunnr and
        vbap~matnr in s_matnr and
        vbap~werks in s_werks and
        vbap~lgort in s_lgort and
        vbap~oid_extbol in s_truck and
        vbap~oid_ship in s_shipto.
      if sy-subrc <> 0.
        message i000 with text-002 ' ' ' ' ' '.
      endif.
      sort it_extract by vbeln.
      check sy-subrc = 0.
      loop at it_extract.
    * Retrieve and select by load confirmation contacts from header
        select single kunnr from vbpa into it_extract-load_contact
         where vbeln = it_extract-vbeln
           and posnr = '000000'
           and parvw = 'ZB'.
        if it_extract-load_contact in s_load.
          it_extract-load_name = zcl_kna1=>get_name1( it_extract-load_contact ).
        else.
          delete it_extract.
          continue.
        endif.
    * Retrieve and select by sales order bill-to on header level
    * as well as lookup bill-to customer name/description
        select single kunnr from vbpa into it_extract-billto
         where vbeln = it_extract-vbeln
           and posnr = '000000'
           and parvw = 'RE'.
        if sy-subrc = 0.
          if s_billto is initial.
            it_extract-billto_name = zcl_kna1=>get_name1( it_extract-billto ).
          else.
            if it_extract-billto in s_billto.
              it_extract-billto_name = zcl_kna1=>get_name1( it_extract-billto ).
            else.
              delete it_extract.
              continue.
            endif.
          endif.
        else.
    * Newalta - always has bill-to, following will not occur but included
    *           as good programming practice.
          it_extract-billto_name = it_extract-billto.
        endif.
    * Retrieve and select by price group of sold-to
        select single konda from knvv into it_extract-konda
         where kunnr = it_extract-kunnr
           and vkorg = it_extract-vkorg
           and vtweg = it_extract-vtweg
           and spart = it_extract-spart.
        if sy-subrc = 0.
          if not ( it_extract-konda in s_konda ).
            delete it_extract.
            continue.
          endif.
        endif.
    * Retrieve trucking company customer
        select single kunnr from vbpa into it_extract-truck where
          vbeln = it_extract-vbeln and
          posnr = '000000' and
          parvw = 'ZT'.
        if sy-subrc = 0.
          it_extract-truck_name = zcl_kna1=>get_name1( it_extract-truck ).
        endif.
    * Retrieve sold-to name
        it_extract-soldto_name = zcl_kna1=>get_name1( it_extract-kunnr ).
    * Retrieve ship-to name
        it_extract-shipto_name = zcl_kna1=>get_name1( it_extract-oid_ship ).
    * lookup P.O.
        select single bstkd ihrez from vbkd into (it_extract-bstkd, it_extract-ihrez)
         where vbeln = it_extract-vbeln
           and posnr = '000000'.
    * Retreive the material description.
        it_extract-maktx = zcl_material=>get_maktx( it_extract-matnr ).
    * cosmetic change of material number, donot display leading zeros.
        shift it_extract-matnr left deleting leading '0'.
    * translate unit of measure
        it_extract-mseh3 = it_extract-vrkme.
        select single mseh3 from t006a into it_extract-mseh3
         where spras = sy-langu
           and msehi = it_extract-vrkme.
        w_tdname = it_extract-vbeln.
    * read customer account reference which is under 'text'
        call function 'READ_TEXT'
          exporting
            client                        = sy-mandt
            id                            = 'Z010'
            language                      = sy-langu
            name                          = w_tdname
            object                        = 'VBBK'
    *   ARCHIVE_HANDLE                = 0
    *   LOCAL_CAT                     = ' '
    * IMPORTING
    *   HEADER                        =
          tables
            lines                         = it_text
          exceptions
            id                            = 1
            language                      = 2
            name                          = 3
            not_found                     = 4
            object                        = 5
            reference_check               = 6
            wrong_access_to_archive       = 7
            others                        = 8.
        if sy-subrc = 0.
          read table it_text index 1.
          if sy-subrc = 0.
            it_extract-tdline = it_text-tdline.
          else.
            clear it_extract-tdline.
          endif.
        else.
          clear it_extract-tdline.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
    * Get the delivery item.
        call method zcl_vbap=>get_delivery
          exporting
            itp_vbeln = it_extract-vbeln
            itp_posnr = it_extract-posnr
          importing
            etp_vbeln = it_extract-delivery
            etp_posnr = it_extract-posnr_vl.
        if it_extract-delivery is not initial.
          perform process_deliveries.
        else.
          perform invoice_process.
        endif.
        it_extract-count = 1 .
        move-corresponding it_extract to it_extract2.
        append it_extract2.
        at new vbeln.
          count1 = count1 + 1.
        endat.
      endloop.
    endform.                    " EXTRACT_DATA
    *&      Form  SET_FIELDCAT
    * Create the field catalogue.
    form set_fieldcat .
      clear w_field.
      clear t_fieldcat.  refresh t_fieldcat.
      w_field-col_pos = 1 .
      w_field-fieldname = 'VBELN'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Document.Nbr'.
      w_field-emphasize = 'X'.
      w_field-hotspot   = 'X'.
      append w_field to t_fieldcat.
      clear w_field.
      w_field-col_pos = 2 .
      w_field-fieldname = 'POSNR'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Item'(023).
      append w_field to t_fieldcat.
      clear w_field.
      w_field-col_pos = 3 .
      w_field-fieldname = 'VDATU'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Req. Del. Date'(005).
      append w_field to t_fieldcat.
      w_field-col_pos = 4.                                      "DEVK909658
      w_field-fieldname = 'KUNNR'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Sold-to.'(038).
      append w_field to t_fieldcat.
      w_field-col_pos = 5 .
      w_field-fieldname = 'SOLDTO_NAME'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Sold-to'(006).
      append w_field to t_fieldcat.
      w_field-col_pos = 6 .
      w_field-fieldname = 'MATNR'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Material'(007).
      append w_field to t_fieldcat.
      w_field-col_pos = 7 .
      w_field-fieldname = 'KWMENG'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Quantity'(008).
      append w_field to t_fieldcat.
      w_field-col_pos = 8.
      w_field-fieldname = 'MSEH3'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'UOM'(009).
      append w_field to t_fieldcat.
      w_field-col_pos = 9 .
      w_field-fieldname = 'BILL_VBELN'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Invoice #'(010).
      w_field-emphasize = 'X'.
      w_field-hotspot   = 'X'.
      append w_field to t_fieldcat.
      clear w_field.
      w_field-col_pos = 10 .
      w_field-fieldname = 'BILL_NETWR'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Values'(011).
      append w_field to t_fieldcat.
      w_field-col_pos = 11.
      w_field-fieldname = 'WERKS'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Plant'(012).
      append w_field to t_fieldcat.
      w_field-col_pos = 12.
      w_field-fieldname = 'LGORT'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Storage Loc'(013).
      append w_field to t_fieldcat.
      w_field-col_pos = 13 .
      w_field-fieldname = 'MAKTX'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Description'(014).
      append w_field to t_fieldcat.
      w_field-col_pos = 14.                                     "DEVK909658
      w_field-fieldname = 'OID_SHIP'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Ship-to.'(039).
      append w_field to t_fieldcat.
      w_field-col_pos = 15 .
      w_field-fieldname = 'SHIPTO_NAME'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Ship-to'(015).
      append w_field to t_fieldcat.
      w_field-col_pos = 16.                                     "DEVK909658
      w_field-fieldname = 'BILLTO'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Bill-to .'(040).
      append w_field to t_fieldcat.
      w_field-col_pos = 17 .
      w_field-fieldname = 'BILLTO_NAME'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Bill-to'(016).
      append w_field to t_fieldcat.
      w_field-col_pos = 18 .
      w_field-fieldname = 'LOAD_NAME'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Load Contact'(017).
      append w_field to t_fieldcat.
      w_field-col_pos = 19 .
      w_field-fieldname = 'TRUCK_NAME'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Truck Comp.'(018).
      append w_field to t_fieldcat.
      w_field-col_pos = 20 .
      w_field-fieldname = 'BSTKD'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'P.O.'(019).
      append w_field to t_fieldcat.
      w_field-col_pos = 21 .
      w_field-fieldname = 'IHREZ'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'AFE Nbr'(020).
      append w_field to t_fieldcat.
      w_field-col_pos = 22 .
      w_field-fieldname = 'OID_EXTBOL'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Truck Ticket'(021).
      append w_field to t_fieldcat.
      w_field-col_pos = 23.
      w_field-fieldname = 'STATU'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Status'(022).
      append w_field to t_fieldcat.
      w_field-col_pos = 24.
      w_field-fieldname = 'AUGRU'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Ord.Reason'(024).
      append w_field to t_fieldcat.
      w_field-col_pos = 25.
      w_field-fieldname = 'TDLINE'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'cstmr.acct.ref.'(027).
      append w_field to t_fieldcat.
      w_field-col_pos = 26 .                                    "DEVK906678
      w_field-fieldname = 'VKBUR'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Sales Office'(037).
      append w_field to t_fieldcat.
      w_field-col_pos = 27.                                     "DEVK909658
      w_field-fieldname = 'COUNT'.
      w_field-tabname = 'IT_EXTRACT2'.
      w_field-seltext_l = 'Count'(041).
      w_field-do_sum = 'X'.
      append w_field to t_fieldcat.
    endform.                    " SET_FIELDCAT
    *&      Form  CALL_ALV
    * Call the ALV Grid function.
    form call_alv .
      sort it_extract by lgort vbeln.
    * repid is necessary since the ALV F.M. does not work properly with
    * sy-repid.
      repid = sy-repid.
      alv_variant-variant  = pa_vari.
      alv_variant-report   = sy-repid.
      alv_variant-username = sy-uname.
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          i_callback_program      = repid
          i_callback_user_command = 'USER_COMMAND'
          is_layout               = gs_layout
          it_fieldcat             = t_fieldcat[]
          it_sort                 = gt_sort[]
          i_default               = 'X'
          i_save                  = 'A'
          is_variant              = alv_variant
          it_events               = gt_events[]
          it_event_exit           = ta_events[]
          is_print                = tp_print
        tables
          t_outtab                = it_extract2
        exceptions
          program_error           = 1
          others                  = 2.
      if sy-subrc ne 0.
        message w000 with text-004 ' ' ' ' ' '.
      endif.
    endform.                    " CALL_ALV
    *&      Form  build_top_of_page
    * Build heading for report.                                            *
    *      -->P_GT_LIST_TOP_OF_PAGE[]  Header stuff for report
    form build_top_of_page using   e04_lt_top_of_page type slis_t_listheader.
      data: ls_line type slis_listheader.  "Header table for top of page
    * construct 'top of page' info. to display. In this case, one line.
      data: w_selections(40) type c,
            w_date_from(10) type c,
            w_date_to(10) type c.
      write: s_vdatu-low to w_date_from dd/mm/yyyy.
      if s_vdatu-high is not initial.
        write: s_vdatu-high to w_date_to dd/mm/yyyy.
        clear w_selections.
        concatenate 'Del.Req.Date: ' w_date_from 'To' w_date_to
          into w_selections separated by space.
        clear ls_line.
        ls_line-typ  = 'H'.
        ls_line-info = w_selections.
        append ls_line to e04_lt_top_of_page.
        gs_list_top_of_page-typ = 'S'.
        gs_list_top_of_page-info = ' Total Number of Sales Documents'.
        append gs_list_top_of_page to gt_list_top_of_page.
        gs_list_top_of_page-typ  = 'S'.
        gs_list_top_of_page-info = count1.
        append gs_list_top_of_page to gt_list_top_of_page.
      else.
        clear w_date_to.
        concatenate 'Del.Req.Date: ' w_date_from
             into w_selections separated by space.
        clear ls_line.
        ls_line-typ  = 'H'.
        ls_line-info = w_selections.
        append ls_line to e04_lt_top_of_page.
      endif.
    endform.                    " build_top_of_page
    *&      Form  alv_eventtab_build
    *     Pass list of events to be triggered by the ALV function module
    form alv_eventtab_build using  u_name  type slis_alv_event-name
                                   u_form  type slis_alv_event-form
                                   alv_lt_events  type slis_t_event.
      data: ls_event type slis_alv_event.   " structure for event handling
      ls_event-name = u_name.
      ls_event-form = u_form.
      append ls_event to alv_lt_events.
    endform.                    " alv_eventtab_build
    *       FORM TOP_OF_PAGE                                              *
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        exporting
          i_logo             = 'NEWALTA_LOGO'
          it_list_commentary = gt_list_top_of_page.
    endform.                    " TOP_OF_PAGE
    *&      Form  process_deliveries
    * Process the delivery related records.
    form process_deliveries .
      data:
        ltp_date  type wadat_ist, " Goods movement date.
        ltp_vbtyp type vbtyp_n,
        ltp_mtart type mtart, " Material type.
        w_lfimg   type lfimg, " Actual quantity delivered (in sales units).
        w_vrkme   type vrkme. " Sales unit of measure.
    * Read delivery quantity and uom.
      select single lfimg vrkme into (w_lfimg, w_vrkme)
        from lips where
        vbeln = it_extract-delivery and
        posnr = it_extract-posnr_vl.
    * these fields have values from vbap. override with lips values
      if sy-subrc = 0.
        it_extract-kwmeng = w_lfimg.
        it_extract-vrkme  = w_vrkme.
    * translate unit of measure
        it_extract-mseh3 = it_extract-vrkme.
        select single mseh3 from t006a into it_extract-mseh3
         where spras = sy-langu
           and msehi = it_extract-vrkme.
      endif.
    * Determine STATUS by reading 'service confirmation', R (goods movemt)
    * it is possible to have multiple 'service confirmation' records for
    * one item. ie. delivery 80010390 in PRD.
    * As long as there is at least one 'service confirmation' record,
    * status is considered 'complete'.
    * Validate the created on date of the goods movement or service confirmation.
      ltp_mtart = zcl_material=>get_mtart( it_extract-matnr ).
    *  ltp_date = zcl_lips=>get_goods_movement_date( itp_vbeln = it_extract-delivery
    *                           itp_posnr = it_extract-posnr_vl itp_mtart = ltp_mtart ).
      call method zcl_lips=>get_goods_mvt_info
        exporting
          itp_vbeln = it_extract-delivery
          itp_posnr = it_extract-posnr_vl
          itp_mtart = ltp_mtart
        importing
          rtp_date  = ltp_date
          rtp_vbtyp = ltp_vbtyp.
    * 'h' is cancel goods issue
      if ltp_vbtyp = 'h'.
        it_extract-statu = 'Incomplete'(025).
      else.
        if ltp_date is not initial.
          it_extract-statu = 'COMPLETE'(026).
        endif.
      endif.
    * Retrieve the invoice/billing document item.
      call method zcl_lips=>get_invoice
        exporting
          itp_vbeln = it_extract-delivery
          itp_posnr = it_extract-posnr_vl
        importing
          rtp_vbeln = it_extract-bill_vbeln
          rtp_posnr = it_extract-bill_posnr.
      if it_extract-bill_vbeln is not initial.
    * retrieve net value from the invoice.
        clear it_extract-bill_netwr.
        select single netwr into it_extract-bill_netwr from vbrp
         where vbeln = it_extract-bill_vbeln
           and posnr = it_extract-bill_posnr.
      else.
        it_extract-bill_netwr = it_extract-netwr. " Use order net value.
      endif.
    endform.                    " process_deliveries
    *&      Form  user_command
    * Process the user command.
    *      -->R_UCOMM      User command
    *      -->RS_SELFIELD  Field selected
    form user_command using r_ucomm     like sy-ucomm
                            rs_selfield type slis_selfield.
      data: ltp_vbeln type vbeln.  " Sales document number.
      case  r_ucomm.
        when '&IC1'.
          if ( rs_selfield-fieldname = 'VBELN'
            or rs_selfield-fieldname = 'BILL_VBELN' )
           and rs_selfield-value is not initial.        " Display sales document.
            ltp_vbeln = rs_selfield-value.
            zcl_sales_doc=>display( ltp_vbeln ).
          endif.
        when '&ILT'.
          data:
    lta_filt type slis_t_filtered_entries.
          break rdrury.
          call function 'REUSE_ALV_LIST_LAYOUT_INFO_GET'
    importing
    *      es_layout               = gs_layout
    *      et_fieldcat             = t_fieldcat[]
    *      et_sort                 = gt_sort[]
    *   ES_LAYOUT                        =
    *   ET_FIELDCAT                      =
    *   ET_SORT                          =
    *   ET_FILTER                        =
    *   ES_LIST_SCROLL                   =
    *   ES_VARIANT                       =
    *   E_WIDTH                          =
    *   ET_MARKED_COLUMNS                =
       et_filtered_entries              = lta_filt
    *   ET_FILTERED_ENTRIES_HEADER       =
    *   ET_FILTERED_ENTRIES_ITEM         =  lta_filt
    *       TABLES
    *   et_outtab                        =
    *   ET_OUTTAB_HEADER                 =
    *   et_outtab_item                   =
    *   ET_COLLECT00                     =
    *   ET_COLLECT01                     =
    *   ET_COLLECT02                     =
    *   ET_COLLECT03                     =
    *   ET_COLLECT04                     =
    *   ET_COLLECT05                     =
    *   ET_COLLECT06                     =
    *   ET_COLLECT07                     =
    *   ET_COLLECT08                     =
    *   ET_COLLECT09                     =
           exceptions
             no_infos                         = 1
             program_error                    = 2
      endcase.
    endform.                    "user_command
    *&      Form  invoice_process
    * Process for orders without deliveries.                               *
    form invoice_process .
    * Translate unit of measure.
      select single mseh3 from t006a into it_extract-mseh3
       where spras = sy-langu
         and msehi = it_extract-vrkme.
    * Retrieve the invoice/billing document item.
      call method zcl_vbap=>get_invoice
        exporting
          itp_vbeln = it_extract-vbeln
          itp_posnr = it_extract-posnr
        importing
          rtp_vbeln = it_extract-bill_vbeln
          rtp_posnr = it_extract-bill_posnr.
      if it_extract-bill_vbeln is not initial.
    * retrieve net value from the invoice.
        clear it_extract-bill_netwr.
        select single netwr into it_extract-bill_netwr from vbrp
         where vbeln = it_extract-bill_vbeln
           and posnr = it_extract-bill_posnr.
      else. " If no Invoice, then status becomes 'incomplete'.
        it_extract-bill_netwr = it_extract-netwr. " Use order net value.
        it_extract-statu = 'Incomplete'(025).
      endif.
    endform.                    " invoice_process
    *&      Form  alv_variant_f4
    * Get the display variant.
    *      <--CTP_VARI  Variant name
    form alv_variant_f4 changing ctp_vari type slis_vari.
      alv_variant-report   = sy-repid.             " Report ID
      alv_variant-username = sy-uname.             " User ID
      call function 'REUSE_ALV_VARIANT_F4'
        exporting
          is_variant = alv_variant
          i_save     = 'A'
        importing
          es_variant = alv_variant
        exceptions
          others     = 1.
      if sy-subrc = 0.
        ctp_vari = alv_variant-variant.
      endif.
    endform.                    " alv_variant_f4

    I have used all the FM modules mentioned but I am not able to get the total of the sales doc on the top of the page to chnage when filtering of data is done . I just want to see this count of sales document (distict ) and to see it change as filtering is done , be it at any place in teh ALV , its not necessary that it has to be on the top of the ALV output. Could I get some inputs please. As you can see I used the below mentioned FM but on debugging I find the gt_stack is empty still.
    *&      Form  build_top_of_page
    * Build heading for report.                                            *
    *      -->P_GT_LIST_TOP_OF_PAGE[]  Header stuff for report
    FORM build_top_of_page USING   e04_lt_top_of_page TYPE slis_t_listheader.
      DATA: ls_line TYPE slis_listheader.  "Header table for top of page
    * construct 'top of page' info. to display. In this case, one line.
      DATA: w_selections(40) TYPE c,
            w_date_from(10) TYPE c,
            w_date_to(10) TYPE c.
      WRITE: s_vdatu-low TO w_date_from DD/MM/YYYY.
      IF s_vdatu-high IS NOT INITIAL.
        WRITE: s_vdatu-high TO w_date_to DD/MM/YYYY.
        CLEAR w_selections.
        CONCATENATE 'Del.Req.Date: ' w_date_from 'To' w_date_to
          INTO w_selections SEPARATED BY space.
        CLEAR ls_line.
        ls_line-typ  = 'H'.
        ls_line-info = w_selections.
        APPEND ls_line TO e04_lt_top_of_page.
        gs_list_top_of_page-typ = 'S'.
        gs_list_top_of_page-info = ' Total Number of Sales Documents'.
        append gs_list_top_of_page to gt_list_top_of_page.
        gs_list_top_of_page-typ  = 'S'.
        gs_list_top_of_page-info = count1.
        append gs_list_top_of_page to gt_list_top_of_page.
      ELSE.
        CLEAR w_date_to.
        CONCATENATE 'Del.Req.Date: ' w_date_from
             INTO w_selections SEPARATED BY space.
        CLEAR ls_line.
        ls_line-typ  = 'H'.
        ls_line-info = w_selections.
        APPEND ls_line TO e04_lt_top_of_page.
      ENDIF.
    ENDFORM.                    " build_top_of_page
    *&      Form  alv_eventtab_build
    *     Pass list of events to be triggered by the ALV function module
    FORM alv_eventtab_build USING  u_name  TYPE slis_alv_event-name
                                   u_form  TYPE slis_alv_event-form
                                   alv_lt_events  TYPE slis_t_event.
      DATA: ls_event TYPE slis_alv_event.   " structure for event handling
      ls_event-name = u_name.
      ls_event-form = u_form.
      APPEND ls_event TO alv_lt_events.
    ENDFORM.                    " alv_eventtab_build
    *       FORM TOP_OF_PAGE                                              *
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          i_logo             = 'NEWALTA_LOGO'
          it_list_commentary = gt_list_top_of_page.
      Data:lt_FILTERED_ENTRIES type SLIS_T_FILTERED_ENTRIES,
      wa_filter like line of lt_FILTERED_ENTRIES.
      data: count2 type i.
    data: it_fieldcat  type slis_t_fieldcat_alv with header line.
      CALL FUNCTION 'REUSE_ALV_LIST_LAYOUT_INFO_GET'
        IMPORTING
          ET_FILTERED_ENTRIES = lt_FILTERED_ENTRIES
        EXCEPTIONS
          NO_INFOS            = 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.
        MESSAGE i000 WITH  count1  .
      ENDIF.
      loop at lt_FILTERED_ENTRIES into wa_filter.
    *    if sy-tabix <> 0.
        if sy-subrc = 0 .
          count2 = count2 + 1.
    *count3 =  count1 - count2 .
    *  write:/ 'Total number of Sales Documents =', count3 .
        endif.
      endloop.
    ENDFORM.                    " TOP_OF_PAGE
    I tried using it at user-command level too but it dosent help.
    Thanks

  • Need to display two ALV GRIDs in a single screen

    Hi,
    I have a question, i'm using version 4.6. I want to display 2 ALVs in a single screen or by calling.
    Step 1 : The internal table (which holds the data for the ALVs has to be populated before calling ALV1 or ALV2) 
    Step 2 : Display In a single report
    ALV1 report (Editable ,Has to be a GRID)
    ALV2 report (Non Editable, Has to be a GRID)
                             (or)
    Step 1 : The internal table (which holds the data for the ALVs has to be populated before calling ALV1 or ALV2)
    Step 2 :
    ALV1 report (Editable ,Has to be a GRID, with a custom button to call ALV2 hiding the ALV1 ie not visible to user)
    ALV2 report (Non Editable ,Has to be a GRID, with a custom button to call ALV1 hiding the ALV2 ie not visible to user)
    Please help me <b><REMOVED BY MODERATOR></b>
    Message was edited by:
            Alvaro Tejada Galindo

    Hi
    ABAP List Viewer
    Simple ALV report
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    Check the program in the following link:
    http://sap-img.com/abap/display-secondary-list-using-alv-grid.htm
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_basic.htm
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    13. Top-of-page in ALV
    selection-screen and top-of-page in ALV
    14.  ALV Group Heading
    http://www.sap-img.com/fu037.htm
    How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    15. ALV output to PDF conversion
    It has an example code for PDF Conversion.
    http://www.erpgenie.com/abap/code/abap51.htm
    converting the output of alv in pdf
    Go thru these programs they may help u to try on some hands on
    ALV Demo program
    BCALV_DEMO_HTML
    BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
    BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
    BCALV_GRID_DEMO Simple ALV Control Call Demo Program
    BCALV_TREE_DEMO Demo for ALV tree control
    BCALV_TREE_SIMPLE_DEMO
    BC_ALV_DEMO_HTML_D0100
    The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
    This helps us to implement all the features mentioned very effectively.
    Using ALV, We can have three types of reports:
    1. Simple Report
    2. Block Report
    3. Hierarchical Sequential Report
    There are some function modules which will enable to produce the above reports without much effort.
    All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
    1. SIMPLE REPORT.
    The important function modules are
    a. Reuse_alv_list_display
    b. Reuse_alv_fieldcatalog_merge
    c. Reuse_alv_events_get
    d. Reuse_alv_commentary_write
    e. Reuse_alv_grid_display
    A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
    The important parameters are :
    I. Export :
    i. I_callback_program : report id
    ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status
    iii. I_callback_user_command : routine where the function codes are handled
    iv. I_structure name : name of the dictionary table
    v. Is_layout : structure to set the layout of the report
    vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE
    vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
    II. Tables :
    i. t_outtab : internal table with the data to be output
    B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.
    The Important Parameters are :
    I. Export :
    i. I_program_name : report id
    ii. I_internal_tabname : the internal output table
    iii. I_inclname : include or the report name where all the dynamic forms are handled.
    II Changing
    ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is
    declared in the type pool SLIS.
    C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
    Parameters :
    I. Import :
    Et_Events : The event table is returned with all possible CALLBACK events
    for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
    II. Export :
    I_List_type :
    0 = simple list REUSE_ALV_LIST_DISPLAY
    1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
    2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
    3 = hierarchical-sequential block list
    REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
    Parameters :
    I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
    This internal table has three fields :
    Typ : ‘H’ – header, ‘S’ – selection , ‘A’ - action
    Key : only when typ is ‘S’.
    Info : the text to be printed
    E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
    Parameters : same as reuse_alv_list_display
    This is an example for simple list.
    2. BLOCK REPORT
    This is used to have multiple lists continuously.
    The important functions used in this report are:
    A. REUSE_ALV_BLOCK_LIST_INIT
    B. REUSE_ALV_BLOCK_LIST_APPEND
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    A. REUSE_ALV_BLOCK_LIST_INIT
    Parameters:
    I. I_CALLBACK_PROGRAM
    II. I_CALLBACK_PF_STATUS_SET
    III. I_CALLBACK_USER_COMMAND
    This function module is used to set the default gui status etc.
    B. REUSE_ALV_BLOCK_LIST_APPEND
    Parameters :
    Export :
    I. is_layout : layout settings for block
    II. it_fieldcat : field catalog
    III. i_tabname : internal table name with output data
    IV. it_events : internal table with all possible events
    Tables :
    i. t_outtab : internal table with output data.
    This function module adds the data to the block.
    Repeat this function for all the different blocks to be displayed one after the other.
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    This function module is used for hierarchical sequential blocks.
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    Parameters : All the parameters are optional.
    This function module display the list with data appended by the above function.
    Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
    3. Hierarchical reports :
    Hierarchical sequential list output.
    The function module is
    A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
    Parameters:
    I. Export:
    i. I_CALLBACK_PROGRAM
    ii. I_CALLBACK_PF_STATUS_SET
    iii. I_CALLBACK_USER_COMMAND
    iv. IS_LAYOUT
    v. IT_FIELDCAT
    vi. IT_EVENTS
    vii. i_tabname_header : Name of the internal table in the program containing the
    output data of the highest hierarchy level.
    viii. i_tabname_item : Name of the internal table in the program containing the
    output data of the lowest hierarchy level.
    ix. is_keyinfo : This structure contains the header and item table field
    names which link the two tables (shared key).
    II. Tables
    i. t_outtab_header : Header table with data to be output
    ii. t_outtab_item : Name of the internal table in the program containing the
    output data of the lowest hierarchy level.
    slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using ‘REUSE_ALV_FIELDCATALOG_MERGE’.
    Important Attributes :
    A. col_pos : position of the column
    B. fieldname : internal fieldname
    C. tabname : internal table name
    D. ref_fieldname : fieldname (dictionary)
    E. ref_tabname : table (dictionary)
    F. key(1) : column with key-color
    G. icon(1) : icon
    H. symbol(1) : symbol
    I. checkbox(1) : checkbox
    J. just(1) : (R)ight (L)eft (C)ent.
    K. do_sum(1) : sum up
    L. no_out(1) : (O)blig.(X)no out
    M. outputlen : output length
    N. seltext_l : long key word
    O. seltext_m : middle key word
    P. seltext_s : short key word
    Q. reptext_ddic : heading (ddic)
    R. ddictxt(1) : (S)hort (M)iddle (L)ong
    S. datatype : datatype
    T. hotspot(1) : hotspot
    Regards
    Anji

  • ALV GRID Problem with reading contents

    Hi there! I'm quite new with ABAP and I have some problems with the syntax of it. Maybe I should first describe my aim and then I'll show you my code.
    1. I read contents from two database tables, called 'zbc_dan_registry' and 'zbc_dan_category'.
    'zbc_dan_registry' has 2 columns: name, value.
    zbc_dan_category' has 1 column: category.
    Now I want to have an ALV Grid, that displays the contents of 'zbc_dan_registry' and one additional column with dropdown fields, where the user can select a category for each row. This is, what my code already does.
    Now I want to save the contents of the whole table in a new table 'zbc_dan_registrz' (you see: 'registrz', not 'registry'!) with 3 columns:
    name, category, value.
    My problem is, how can I read the contents of the ALV Grid, with the user selected category for each row, and save them in an internal table? I've tried to adapt the code of "BCALV_EDIT_04", but I don't get it running.
    Some detailled help would be great, you know, I'm really working hard to understand ABAP, but it's really hard for me. Thanks for your support and help!!
    Here's my code so far:
    *& Report  ZBC400_DAN_TESTNO4
    REPORT  ZBC400_DAN_TESTNO4.
    DATA: lt_registrz TYPE TABLE OF zbc_dan_regstrz WITH HEADER LINE,
          lt_category TYPE TABLE OF zbc_dan_category WITH HEADER LINE,
          ls_category TYPE zbc_dan_category, "Struktur Kategorie
          ok_code LIKE sy-ucomm,
          container_r TYPE REF TO cl_gui_custom_container,
          grid_r TYPE REF TO cl_gui_alv_grid,
          gc_custom_control_name TYPE scrfname VALUE 'CONTAINER_REG',
          fieldcat_r TYPE lvc_t_fcat,
          layout_r TYPE lvc_s_layo,
          lt_ddval TYPE lvc_t_drop,
          ls_ddval TYPE lvc_s_drop,
          c TYPE i.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
      DATA g_verifier TYPE REF TO lcl_event_receiver.
      DATA: BEGIN OF gt_outtab OCCURS 0.
        INCLUDE STRUCTURE zbc_dan_regstrz.
        DATA: celltab TYPE lvc_t_styl.
      DATA: END OF gt_outtab.
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
      TYPES: BEGIN OF lt_registrz_key.         "Struktur mit den Schlüsseln der Tabelle 'Registry'
        TYPES:  name TYPE zbc_dan_name,
                value TYPE zbc_dan_value,
                category TYPE zbc_dan_cat.
      TYPES: END OF lt_registrz_key.
      TYPES:  ls_registrz_keys TYPE STANDARD TABLE OF lt_registrz_key,
              ls_registrz_table TYPE STANDARD TABLE OF zbc_dan_regstrz.
      METHODS: get_inserted_rows EXPORTING inserted_rows TYPE ls_registrz_keys.
      METHODS: refresh_delta_tables.
      METHODS: handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid IMPORTING er_data_changed.
    *  METHODS: get_inserted_rows EXPORTING inserted_rows TYPE registrz_keys.
    *  METHODS: refresh_delta_tables.
      PRIVATE SECTION.
      DATA: inserted_rows TYPE ls_registrz_keys.
      DATA: error_in_data TYPE c.
      METHODS: get_cell_values IMPORTING row_id TYPE int4 pr_data_changed TYPE REF TO cl_alv_changed_data_protocol EXPORTING key TYPE lt_registrz_key.
    ENDCLASS.
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_data_changed.
        DATA: ls_good TYPE lvc_s_modi,
              ls_new TYPE lvc_s_moce.
        error_in_data = space.
        IF error_in_data = 'X'.
          CALL METHOD er_data_changed->display_protocol.
        ENDIF.
      ENDMETHOD.
      METHOD get_cell_values.
        CALL METHOD pr_data_changed->get_cell_value
          EXPORTING i_row_id = row_id i_fieldname = 'NAME'
            IMPORTING e_value = key-name.
        CALL METHOD pr_data_changed->get_cell_value
          EXPORTING i_row_id = row_id i_fieldname = 'VALUE'
            IMPORTING e_value = key-value.
        CALL METHOD pr_data_changed->get_cell_value
          EXPORTING i_row_id = row_id i_fieldname = 'CATEGORY'
            IMPORTING e_value = key-category.
      ENDMETHOD.
      METHOD get_inserted_rows.
        inserted_rows = me->inserted_rows.
      ENDMETHOD.
      METHOD refresh_delta_tables.
        clear me->inserted_rows[].
      ENDMETHOD.
    ENDCLASS.
    START-OF-SELECTION.
        SELECT client name value
          INTO CORRESPONDING FIELDS OF TABLE lt_registrz FROM zbc_dan_regstry.
        SELECT category INTO CORRESPONDING FIELDS OF TABLE lt_category FROM zbc_dan_category.
    CALL SCREEN 0100.
    MODULE user_command_0100 INPUT.
      CASE ok_code.
        WHEN 'BACK'.
          SET SCREEN 0.
          MESSAGE ID 'BC400' TYPE 'S' NUMBER '057'.
        WHEN 'SAVE'.
          PERFORM save_data.
        WHEN OTHERS.
      ENDCASE.
    ENDMODULE.
    MODULE clear_ok_code OUTPUT.
      CLEAR ok_code.
    ENDMODULE.
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'DYNPRO100'.
      SET TITLEBAR 'D0100'.
    ENDMODULE.
    MODULE display_alv OUTPUT.
      PERFORM display_alv.
    ENDMODULE.
    FORM display_alv.
    IF grid_r IS INITIAL.
    *----Creating custom container instance
      CREATE OBJECT container_r
      EXPORTING
        container_name = gc_custom_control_name
      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.
    *--Exception handling
        ENDIF.
    *----Creating ALV Grid instance
        CREATE OBJECT grid_r
        EXPORTING
          i_parent = container_r
        EXCEPTIONS
          error_cntl_create = 1
          error_cntl_init = 2
          error_cntl_link = 3
          error_dp_create = 4
          others = 5.
          IF sy-subrc <> 0.
    *--Exception handling
          ENDIF.
          CREATE OBJECT g_verifier.
          SET HANDLER g_verifier->handle_data_changed FOR grid_r.
    *----Preparing field catalog.
          PERFORM prepare_field_catalog CHANGING fieldcat_r.
    *----Preparing layout structure
          PERFORM prepare_layout CHANGING layout_r.
    *----Here will be additional preparations
    *--e.g. initial sorting criteria, initial filtering criteria, excluding
    *--functions
          CALL METHOD grid_r->set_table_for_first_display
          EXPORTING
    * I_BUFFER_ACTIVE =
    * I_CONSISTENCY_CHECK =
    * I_STRUCTURE_NAME =
    * IS_VARIANT =
    * I_SAVE =
    * I_DEFAULT = 'X'
            is_layout = layout_r
    * IS_PRINT =
    * IT_SPECIAL_GROUPS =
    * IT_TOOLBAR_EXCLUDING =
    * IT_HYPERLINK =
          CHANGING
            it_outtab = lt_registrz[]
            it_fieldcatalog = fieldcat_r
    * IT_SORT =
    * IT_FILTER =
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error = 2
            too_many_lines = 3
            OTHERS = 4.
          IF sy-subrc <> 0.
    *--Exception handling
          ENDIF.
          ELSE.
            CALL METHOD grid_r->refresh_table_display
    * EXPORTING
    * IS_STABLE =
    * I_SOFT_REFRESH =
          EXCEPTIONS
            finished = 1
            OTHERS = 2.
          IF sy-subrc <> 0.
    *--Exception handling
          ENDIF.
        ENDIF.
        CALL METHOD grid_r->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        CALL METHOD grid_r->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    ENDFORM.
    FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
      DATA ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
      EXPORTING
        i_structure_name = 'ZBC_DAN_REGSTR2'
      CHANGING
        ct_fieldcat = pt_fieldcat[]
      EXCEPTIONS
        inconsistent_interface = 1
        program_error = 2
        OTHERS = 3.
      IF sy-subrc <> 0.
    *--Exception handling
      ENDIF.
      LOOP AT pt_fieldcat INTO ls_fcat.
        CASE ls_fcat-fieldname.
          WHEN 'NAME'.
            ls_fcat-coltext = 'Name'.
            ls_fcat-outputlen = '40'.
            MODIFY pt_fieldcat FROM ls_fcat.
          WHEN 'VALUE'.
            ls_fcat-coltext = 'Wert'.
            ls_fcat-outputlen = '30'.
            MODIFY pt_fieldcat FROM ls_fcat.
          WHEN 'CATEGORY'.
              LOOP AT lt_category into ls_category.
                ls_ddval-handle = 1.
                ls_ddval-value = ls_category-category.
    *            ls_ddval-style = cl_gui_alv_grid=>mc_style_enabled.
                APPEND ls_ddval TO lt_ddval.
             ENDLOOP.
             CALL METHOD grid_r->set_drop_down_table
                EXPORTING it_drop_down = lt_ddval.
            ls_fcat-edit = 'X'.
            ls_fcat-drdn_hndl = '1'.
            ls_fcat-coltext = 'Kategorie'.
            MODIFY pt_fieldcat FROM ls_fcat.
        ENDCASE.
      ENDLOOP.
    ENDFORM.
    FORM prepare_layout CHANGING ps_layout TYPE lvc_s_layo.
      ps_layout-zebra = 'X'.
      ps_layout-grid_title = 'Kategorie zur Registry hinzufügen'.
      ps_layout-smalltitle = 'X'.
    ENDFORM.
    FORM save_data.
      DATA: ls_ins_keys TYPE g_verifier->ls_registrz_keys,
            ls_ins_key TYPE g_verifier->lt_registrz_key,
            ls_registrz TYPE zbc_dan_regstrz,
            ls_outtab LIKE LINE OF gt_outtab,
            lt_instab TYPE TABLE OF zbc_dan_regstrz.
      CALL METHOD g_verifier->get_inserted_rows IMPORTING inserted_rows = ls_ins_keys.
      LOOP AT ls_ins_keys INTO ls_ins_key.
        READ TABLE gt_outtab INTO ls_outtab
        WITH KEY  name = ls_ins_key-name
                  value = ls_ins_key-value
                  category = ls_ins_key-category.
        IF sy-subrc = 0.
          MOVE-CORRESPONDING ls_outtab TO ls_registrz.
          APPEND ls_registrz TO lt_instab.
        ENDIF.
      ENDLOOP.
      INSERT zbc_dan_regstrz FROM TABLE lt_instab.
      CALL METHOD g_verifier->refresh_delta_tables.
      ENDFORM.

    Hi Hans,
    You raised the Question in the Webdynpro ABAP forum. Here its very diffcult to get the answer from this forum. Please close it here and raise the same question in ABAP General Forum there you will get faster and so many anwsers.
    Please close the question here.
    Warm Regards,
    Vijay

  • Color a row with ALV GRID

    Hi my friends,
    I have written a small ALV Grid where some rows should be colored, dependend on their status in a table. But it's not working and I can't find out, why it is not working. I've already studied all the topics in this forum, which are related to 'row color alv grid', but I can't find the mistake in my code. Is anyone able to find out what is wrong here?
    Thanks a lot for your help!
    *& Report  /BMC_TST_SHOWLOG
    REPORT  /BMC_TST_SHOWLOG.
    TYPES: BEGIN OF log_table.
      TYPES:  log_level TYPE /bmc_log_message,
              cr_date TYPE /bmc_cr_date,
              message TYPE /bmc_log_message,
              linecolor(4) TYPE c.
    TYPES: END OF log_table.
    DATA: lt_log TYPE TABLE OF log_table with HEADER LINE,
          lt_log2 TYPE TABLE OF log_table with HEADER LINE,
          lt_log_list TYPE TABLE OF log_table,
          lt_line LIKE LINE OF lt_log_list,
          container_r TYPE REF TO cl_gui_custom_container,
          grid_r TYPE REF TO cl_gui_alv_grid,
          gc_custom_control_name TYPE scrfname VALUE 'CONTAINER_LOG',
          fieldcat_r TYPE lvc_t_fcat,
          layout_r TYPE lvc_s_layo,
          logA TYPE /bmc_log_level,
          logB TYPE /bmc_log_level,
          logC TYPE /bmc_log_level,
          logD TYPE /bmc_log_level,
          logE TYPE /bmc_log_level,
          ls_ct TYPE lvc_s_scol,
          ok_code LIKE sy-ucomm.
    *DATA BEGIN OF ls_log_list OCCURS 0.
    *DATA: log_level TYPE /bmc_log_message,
    *      cr_date TYPE /bmc_cr_date,
    *      message TYPE /bmc_log_message,
    *      rowcolor(4) TYPE c.
    *DATA END OF ls_log_list.
    *DATA: lt_log_list TYPE TABLE OF log_table.
    PARAMETERS: loglevlA  TYPE c AS CHECKBOX,
                loglevlB  TYPE c as CHECKBOX,
                loglevlC  TYPE c As CHECKBOX,
                loglevlD  TYPE c aS CHECKBOX,
                loglevlE  TYPE c AS CHECKBOX,
                dateA     TYPE /bmc_cr_date OBLIGATORY,
                dateB     TYPE /bmc_cr_date.
    CALL SCREEN 0200.
    MODULE user_command_0200 INPUT.
      CASE ok_code.
        WHEN 'BACK'.
          SET SCREEN 0.
          MESSAGE ID 'BC400' TYPE 'S' NUMBER '057'.
        WHEN OTHERS.
      ENDCASE.
    ENDMODULE.
    MODULE clear_ok_code OUTPUT.
      CLEAR ok_code.
    ENDMODULE.
    MODULE status_0200 OUTPUT.
      SET PF-STATUS 'DYNPRO200'.
      SET TITLEBAR 'D0200'.
    ENDMODULE.
    MODULE display_alv OUTPUT.
      PERFORM display_alv.
    ENDMODULE.
    FORM display_alv.
      IF grid_r IS INITIAL.
    *----Creating custom container instance
      CREATE OBJECT container_r
      EXPORTING
        container_name = gc_custom_control_name
      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.
    *--Exception handling
        ENDIF.
    *----Creating ALV Grid instance
        CREATE OBJECT grid_r
        EXPORTING
          i_parent = container_r
        EXCEPTIONS
          error_cntl_create = 1
          error_cntl_init = 2
          error_cntl_link = 3
          error_dp_create = 4
          others = 5.
          IF sy-subrc <> 0.
    *--Exception handling
          ENDIF.
          PERFORM get_log_data.
    *----Preparing field catalog.
          PERFORM prepare_field_catalog CHANGING fieldcat_r.
    *----Preparing layout structure
          PERFORM prepare_layout CHANGING layout_r.
    *----Here will be additional preparations
    *--e.g. initial sorting criteria, initial filtering criteria, excluding
    *--functions
          CALL METHOD grid_r->set_table_for_first_display
          EXPORTING
            is_layout = layout_r
          CHANGING
            it_outtab = lt_log2[]
            it_fieldcatalog = fieldcat_r
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error = 2
            too_many_lines = 3
            OTHERS = 4.
          IF sy-subrc <> 0.
    *--Exception handling
          ENDIF.
          ELSE.
            CALL METHOD grid_r->refresh_table_display
          EXCEPTIONS
            finished = 1
            OTHERS = 2.
          IF sy-subrc <> 0.
    *--Exception handling
          ENDIF.
        ENDIF.
        CALL METHOD grid_r->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        CALL METHOD grid_r->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    ENDFORM.
    FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
        DATA ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
      EXPORTING
        i_structure_name = '/BMC_LOG'
      CHANGING
        ct_fieldcat = pt_fieldcat[]
      EXCEPTIONS
        inconsistent_interface = 1
        program_error = 2
        OTHERS = 3.
      IF sy-subrc ne 0.
    *--Exception handling
      ENDIF.
      LOOP AT pt_fieldcat INTO ls_fcat.
        CASE ls_fcat-fieldname.
          WHEN 'UUID'.
            ls_fcat-no_out = 'X'.
            MODIFY pt_fieldcat FROM ls_fcat.
          WHEN 'LOG_LEVEL'.
            ls_fcat-coltext = 'Meldungsart'.
            ls_fcat-outputlen = '25'.
            MODIFY pt_fieldcat FROM ls_fcat.
          WHEN 'CR_DATE'.
            ls_fcat-coltext = 'Erstellungsdatum'.
            ls_fcat-outputlen = '20'.
            MODIFY pt_fieldcat FROM ls_fcat.
          WHEN 'CR_TIME'.
            ls_fcat-no_out = 'X'.
            MODIFY pt_fieldcat FROM ls_fcat.
          WHEN 'MESSAGE'.
            ls_fcat-coltext = 'Nachricht'.
            ls_fcat-outputlen = '50'.
            MODIFY pt_fieldcat FROM ls_fcat.
        ENDCASE.
    *    CASE ls_fcat-value.
    *      WHEN '1'.
    *        ls_fcat-line_color = 'c100'.
    *    ENDCASE.
      ENDLOOP.
    ENDFORM.
    FORM prepare_layout CHANGING ps_layout TYPE lvc_s_layo.
      ps_layout-zebra = 'X'.
      ps_layout-grid_title = 'Log'.
      ps_layout-smalltitle = 'X'.
      ps_layout-info_fname = 'linecolor'.
    ENDFORM.
    FORM get_log_data.
      if loglevlA = 'X'.
        logA = '1'.
      ENDIF.
      if loglevlB = 'X'.
        logB = '2'.
      ENDIF.
      if loglevlC = 'X'.
        logC = '3'.
      ENDIF.
      if loglevlD = 'X'.
        logD = '4'.
      ENDIF.
      if loglevlE = 'X'.
        logE = '5'.
      ENDIF.
      IF dateB ne 0.
        SELECT log_level cr_date message FROM /bmc_log INTO CORRESPONDING FIELDS OF TABLE lt_log_list WHERE log_level = logA
          OR log_level = logB OR log_level = logC OR log_level = logD OR log_level = logE and cr_date >= dateA and cr_date <= dateB.
      ELSE.
        SELECT log_level cr_date message FROM /bmc_log INTO CORRESPONDING FIELDS OF TABLE lt_log_list WHERE log_level = logA
          OR log_level = logB OR log_level = logC OR log_level = logD OR log_level = logE and cr_date >= dateA.
      ENDIF.
    *    and cr_date >= dateA.
        SORT lt_log_list ASCENDING.
        LOOP AT lt_log_list INTO lt_line.
        IF lt_line-log_level = '1'.
          lt_line-log_level = 'Info'.
          lt_line-linecolor = 'C100'.
        ENDIF.
        IF lt_line-log_level = '2'.
          lt_line-log_level = 'Warning'.
          lt_line-linecolor = 'C200'.
        ENDIF.
        IF lt_line-log_level = '3'.
          lt_line-log_level = 'Error'.
          lt_line-linecolor = 'C300'.
        ENDIF.
        IF lt_line-log_level = '4'.
          lt_line-log_level = 'Debug'.
          lt_line-linecolor = 'C400'.
        ENDIF.
        IF lt_line-log_level = '5'.
          lt_line-log_level = 'Trace'.
          lt_line-linecolor = 'C500'.
        ENDIF.
        APPEND lt_line TO lt_log2.
        ENDLOOP.
    ENDFORM.
    SELECTION-SCREEN BEGIN OF SCREEN 0100 TITLE text-001 AS WINDOW.
    SELECTION-SCREEN END OF SCREEN 0100.

    > change to this
    >
    > <b>ps_layout-stylefname = 'LINECOLOR'.</b>
    >
    > sorry ignore the above line
    >
    > just debug and check what is happening
    >
    > Message was edited by:
    >         Chandrasekhar Jagarlamudi
    Hi,
    I've changed the line to <b>ps_layout-stylefname = 'LINECOLOR'.</b>, but then I'm getting a runtime error 'ASSIGN_TYPE_CONFLICT' in program 'SAPLSLVC in line 2975'...
    I don't have any idea what is causing that.

  • ALV Grid output to Excel Spreadsheet

    I have one that is hopefully easy for you guys and when I search on the forum nothing comes up.
    Maybe I am searching wrong.
    When you have a program that outputs to an ALV grid, there is a button you can output to a file.
    Like an excel document. Icon is a document with an x on it.
    First time you run it, it will give you the option of excel, star office, or all available formats.
    There is also a button at the bottom that says Always Use Selected Format. User
    wants to change this, but once the option is gone, you cannot undo it.
    How do I basically deactivate the button to not always use the selected format???
    Any suggestions would be terrific.
    Thanks for your help.
    Steve

    Steve,
    Try running report SALV_BS_ADMIN_MAINTAIN as indicated in [Note 1080608|https://service.sap.com/sap/support/notes/1080608]. 
    I found this Note with the following search string: "Always Use Selected Format ALV Excel".  You may also want to consider doing a search on the report name "SALV_BS_ADMIN_MAINTAIN" for further information.
    Also check [Note 1157927|https://service.sap.com/sap/support/notes/1157927] "Export Excel: Reset export parameter from ALV list."
    Best Regards,
    Jamie
    Edited by: James Gaddis on Nov 19, 2008 2:47 PM  - Added another Note reference

  • How can I hide the marker button in an ALV GRID line?

    Hi all,
    I am switching an old program from ALV LIST to ALV GRID. In the old list, I put a checkbox on each line to abilify the user to mark some lines. However, there are some lines that I don't want the user to select. In the list, I set the field for the box name to "*" (asterisk) and in the list, the checkbox is not input enabled.
    Now in the grid, this does not function any more. all lines are markable. How can I deactivate the marker function for some lines?
    Greetings
    Jörg

    Hi,
         use the below snippet in your code
      DATA: ls_celltab TYPE lvc_s_styl.
      REFRESH pt_celltab.
      IF p_mode EQ text-103.
    *§2a.Use attribute CL_GUI_ALV_GRID=>MC_STYLE_ENABLED to set a cell
       to status "editable".
        ls_celltab-fieldname = c_character1.
        ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
        ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
        INSERT ls_celltab INTO TABLE pt_celltab.
        ls_celltab-fieldname = c_character2.
        ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
        ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
        INSERT ls_celltab INTO TABLE pt_celltab.
        ls_celltab-fieldname = c_character3.
        ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
        ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
        INSERT ls_celltab INTO TABLE pt_celltab.
        ls_celltab-fieldname = text-107.
        ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
        ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
        INSERT ls_celltab INTO TABLE pt_celltab.
        ls_celltab-fieldname = c_selectionid.
        ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
        INSERT ls_celltab INTO TABLE pt_celltab.
    Regards

  • Two ALV Grid in the same screeen

    Hi,
      I have created a module pool with a screen.
    In this screen I have defined two customer objects and I dipslay two different ALV grid.
    DATA: grid_1         TYPE REF TO cl_gui_alv_grid,
              grid_2         TYPE REF TO cl_gui_alv_grid.
    When the user puts the values into the field in both lists and pushes "enter", the program gets the input value by method
    "get_selected_rows". It works only for the list where there is the cursor.
    I need to read the value of each list at the same moment.
    Thanks in advance
    Marco

    *& Report  Z7CC_ALV_OOPS_TWO_ALV_SCREENS                               *
    report  z7cc_alv_oops_two_alv_screens           .
    * TEMP DECLARATION TYPE DECLARATIONS
    * Structure for Sales Order
    types: begin of y_vbak      ,
    vbeln type vbeln_va ,
    end of y_vbak        ,
    * Structure for Sales Order Details.
    begin of y_vbap           ,
    vbeln type vbeln_va    ,
    posnr type posnr_va    ,
    matnr type matnr       ,
    charg type charg_d     ,
    arktx type arktx       ,
    end of y_vbap             ,
    *& Structure of line item ----------
    begin of  y_po_item,
    ebeln type ekko-ebeln, " PO NUMBER
    ebelp type ekpo-ebelp,  "LINE ITEM
    matnr like ekpo-matnr,  " Material Number
    netpr like ekpo-netpr,  " Price per unit.
    menge like ekpo-menge,  " Purchase order quantity.
    netwr like ekpo-netwr,  " Net order in Purchase order currency
    meins like ekpo-meins,  " UOM
    end of y_po_item.
    data: t_y_po_item type standard table of y_po_item.
    data:  w_container_1        type ref to cl_gui_container        .
    data: t_vbap      type standard table of y_vbap.
    *--------- END OF TEMP DECLARATION ------------
    data: ok_code like sy-ucomm.
    *-- Global data definitions for ALV
    *--- ALV Grid instance reference
    data gr_alvgrid type ref to cl_gui_alv_grid .
    *--- Name of the custom control added on the screen
    data gc_custom_control_name type scrfname value 'Z7CC_ALV2' .
    *--- Custom container instance reference
    data gr_ccontainer type ref to cl_gui_custom_container .
    *--- Field catalog table
    data gt_fieldcat type lvc_t_fcat .
    data gt_fieldcat_2 type lvc_t_fcat .
    *--- Layout structure
    data gs_layout type lvc_s_layo .
    *&------- DECLARATION FOR THE NEXT SCREEN ------------------
    *--- ALV Grid instance reference
    data gr_alvgrid_2 type ref to cl_gui_alv_grid .
    *--- Name of the custom control added on the screen-----------
    data gc_custom_control_name_2 type scrfname value 'Z7CC_ALV' .
    *--- Custom container instance reference
    data gr_ccontainer_2 type ref to cl_gui_custom_container .
    *Declare your internal table which is supposed to hold the list data.
    *&Let’s name it “gt_list”.
    *Here is an example declaration.
    *--- Internal table holding list data
    data begin of gt_list occurs 0.
    data   matnr like mara-matnr.
    data   maktx like makt-maktx.
    data end of gt_list .
    data: begin of gt_list_2 occurs 0.
    include structure  z7cc_po_header.
    data: linecolor(4) type c, "Color for corresponding line
    end of gt_list_2.
    data: t_gt_list_2   type standard table of z7cc_po_header.
    *----- CLASS DECLARATION ------
    * FIELD-SYMBOLS
    field-symbols <fs_vbap> type y_vbap.
    field-symbols <fs_gt_list_2> type z7cc_po_header.
    class lcl_event_receiver definition deferred.
    data w_event_receiver type ref to lcl_event_receiver.
    * Creating a class definition for handling events on the ALV Grid.
    class lcl_event_receiver definition.
    public section.
    methods: handle_top_of_page for event top_of_page
    of cl_gui_alv_grid
    importing e_dyndoc_id,
    handle_hotspot_click for event hotspot_click
    of cl_gui_alv_grid
    importing e_row_id,
    handle_toolbar_event for event toolbar
    of cl_gui_alv_grid
    importing e_object,
    handle_user_command  for event user_command
    of cl_gui_alv_grid
    importing e_ucomm.
    endclass.                    "lcl_event_receiver  DEFINATION
    * Implementing the Class for handling events on the ALV Grid.
    class lcl_event_receiver implementation.
    method handle_top_of_page.
    perform show_top_of_page using e_dyndoc_id   w_container_1.
    endmethod.                    "handle_top_of_page
    method handle_hotspot_click.
    perform show_hotspot_click_details using e_row_id.
    endmethod.                    "lcl_event_receiver
    method handle_toolbar_event.
    perform create_alv_toolbar using e_object.
    endmethod.                    "handle_toolbar_event
    method handle_user_command.
    perform handle_user_command using e_ucomm.
    endmethod.                    "handle_user_command
    endclass.                    "lcl_event_receiver IMPLEMENTATION
    data:   w_grid               type ref to cl_gui_alv_grid         .
    *-------- END OF CLASS DECLARATION -------------
    start-of-selection.
    perform populate_table.
    call screen 100.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    module status_0100 output.
    set pf-status 'Z7CC_ALV1'.
    *  SET TITLEBAR 'xxx'.
    endmodule.                 " STATUS_0100  OUTPUT
    *&      Module  DISPLAY_ALV  OUTPUT
    *       text
    module display_alv output.
    perform display_alv.
    endmodule.                 " DISPLAY_ALV  OUTPUT
    *&      Form  POPULATE_TABLE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form populate_table .
    select ebeln ebelp matnr  netpr menge netwr meins into corresponding fields of table t_y_po_item
    from ekpo.
    select ekko~ebeln ekko~bukrs ekko~aedat ekko~ernam
    ekko~lifnr ekko~zterm ekko~angnr  into corresponding fields of
    table t_gt_list_2    from ekko .
    endform.                    " POPULATE_TABLE
    *&      Form  DISPLAY_ALV
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form display_alv .
    if gr_alvgrid is initial .
    perform create_first_obj_container.
    *&----------- ONE MORE CONTROL ON THE SCREEN-------------------
    perform create_second_obj_container.
    " DISPLAY_ALV
    *   Creating ALV Grid instance
    perform create_first_alvgrid.
    perform create_second_alvgrid.
    *  PERFORM FIELD_CATALOG.  " CREATE A FIELD CATALOG.
    perform field_cat changing gt_fieldcat.
    perform field_cat_1 changing gt_fieldcat_2.
    *----Here will be additional preparations
    *--e.g. initial sorting criteria, initial filtering criteria, excluding
    *--functions
    perform call_mthd_display_both_grid.
    *&---------  create a field catalog.------------
    perform event_handling.
    else.
    *&-----------CALL ALV GRID REFRESH  TABLE DISPLAY
    perform call_mthd_alv_refresh.
    endif.
    endform.                    "DISPLAY_ALV
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    module user_command_0100 input.
    endmodule.                 " USER_COMMAND_0100  INPUT
    *&      Form  EXIT_PROGRAM
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form exit_program .
    leave program.
    endform.                    " EXIT_PROGRAM
    *&      Module  PAI  INPUT
    *       text
    module pai input.
    case ok_code.
    when '&EXT'.
    perform exit_program.
    when others.
    *     do nothing
    endcase.
    clear ok_code.
    endmodule.                 " PAI  INPUT
    *&      Form  CREATE_FIRST_OBJ_CONTAINER
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form create_first_obj_container .
    create object gr_ccontainer
    exporting
    container_name              = gc_custom_control_name
    if sy-subrc <> 0.
    *          MESSAGE ID SY-MSGID TYPE  SY-MSGTY NUMBER SY-MSGNO
    *                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    endform.                    " CREATE_FIRST_OBJ_CONTAINER
    *&----------------------------------------

  • How to focus a cell on ALV grid display

    hi,
    I need to set the focus to the first cell on the first row in the ALV grid.I am using object oriented ALV grid control.Can anyone help me out in this regard.
    Regards,
    Anil.

    Re: simple Grid display
    Have a look at below links. It contains sample code for alv grid.
    http://www.erpgenie.com/abap/controls/alvgrid.htm#Complete%20code%20for%20the%20ALV%20grid%20example
    http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm
    http://sap.niraj.tripod.com/id64.html
    Also have a look at below for OO alv grid:
    http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b5533cd30911d2b467006094192fe3/frameset.htm
    -->
    ABAP List Viewer
    The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
    This helps us to implement all the features mentioned very effectively.
    Using ALV, We can have three types of reports:
    1. Simple Report
    2. Block Report
    3. Hierarchical Sequential Report
    There are some function modules which will enable to produce the above reports without much effort.
    All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
    1. SIMPLE REPORT.
    The important function modules are
    a. Reuse_alv_list_display
    b. Reuse_alv_fieldcatalog_merge
    c. Reuse_alv_events_get
    d. Reuse_alv_commentary_write
    e. Reuse_alv_grid_display
    A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
    The important parameters are :
    I. Export :
    i. I_callback_program : report id
    ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status iii. I_callback_user_command : routine where the function codes are handled iv. I_structure name : name of the dictionary table v. Is_layout : structure to set the layout of the report vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
    II. Tables :
    i. t_outtab : internal table with the data to be output
    B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.
    The Important Parameters are :
    I. Export :
    i. I_program_name : report id
    ii. I_internal_tabname : the internal output table iii. I_inclname : include or the report name where all the dynamic forms are handled.
    II Changing
    ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is declared in the type pool SLIS.
    C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
    Parameters :
    I. Import :
    Et_Events : The event table is returned with all possible CALLBACK events for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
    II. Export :
    I_List_type :
    0 = simple list REUSE_ALV_LIST_DISPLAY
    1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
    2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
    3 = hierarchical-sequential block list
    REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
    Parameters :
    I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
    This internal table has three fields :
    Typ : ‘H’ – header, ‘S’ – selection , ‘A’ - action Key : only when typ is ‘S’.
    Info : the text to be printed
    E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
    Parameters : same as reuse_alv_list_display
    This is an example for simple list.
    2. BLOCK REPORT
    This is used to have multiple lists continuously.
    The important functions used in this report are:
    A. REUSE_ALV_BLOCK_LIST_INIT
    B. REUSE_ALV_BLOCK_LIST_APPEND
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    A. REUSE_ALV_BLOCK_LIST_INIT
    Parameters:
    I. I_CALLBACK_PROGRAM
    II. I_CALLBACK_PF_STATUS_SET
    III. I_CALLBACK_USER_COMMAND
    This function module is used to set the default gui status etc.
    B. REUSE_ALV_BLOCK_LIST_APPEND
    Parameters :
    Export :
    I. is_layout : layout settings for block II. it_fieldcat : field catalog III. i_tabname : internal table name with output data IV. it_events : internal table with all possible events
    Tables :
    i. t_outtab : internal table with output data.
    This function module adds the data to the block.
    Repeat this function for all the different blocks to be displayed one after the other.
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    This function module is used for hierarchical sequential blocks.
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    Parameters : All the parameters are optional.
    This function module display the list with data appended by the above function.
    Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
    3. Hierarchical reports :
    Hierarchical sequential list output.
    The function module is
    A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
    Parameters:
    I. Export:
    i. I_CALLBACK_PROGRAM
    ii. I_CALLBACK_PF_STATUS_SET
    iii. I_CALLBACK_USER_COMMAND
    iv. IS_LAYOUT
    v. IT_FIELDCAT
    vi. IT_EVENTS
    vii. i_tabname_header : Name of the internal table in the program containing the output data of the highest hierarchy level.
    viii. i_tabname_item : Name of the internal table in the program containing the output data of the lowest hierarchy level.
    ix. is_keyinfo : This structure contains the header and item table field names which link the two tables (shared key).
    II. Tables
    i. t_outtab_header : Header table with data to be output ii. t_outtab_item : Name of the internal table in the program containing the output data of the lowest hierarchy level.
    slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using ‘REUSE_ALV_FIELDCATALOG_MERGE’.
    Important Attributes :
    A. col_pos : position of the column
    B. fieldname : internal fieldname
    C. tabname : internal table name
    D. ref_fieldname : fieldname (dictionary) E. ref_tabname : table (dictionary) F. key(1) : column with key-color G. icon(1) : icon H. symbol(1) : symbol I. checkbox(1) : checkbox J. just(1) : (R)ight (L)eft (C)ent.
    K. do_sum(1) : sum up
    L. no_out(1) : (O)blig.(X)no out
    M. outputlen : output length
    N. seltext_l : long key word
    O. seltext_m : middle key word
    P. seltext_s : short key word
    Q. reptext_ddic : heading (ddic)
    R. ddictxt(1) : (S)hort (M)iddle (L)ong
    S. datatype : datatype
    T. hotspot(1) : hotspot
    Simple ALV report
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Go thru these programs they may help u to try on some hands on
    ALV Demo program
    BCALV_DEMO_HTML
    BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode BCALV_GRID_DEMO Simple ALV Control Call Demo Program BCALV_TREE_DEMO Demo for ALV tree control BCALV_TREE_SIMPLE_DEMO BC_ALV_DEMO_HTML_D0100
    Reward If useful

Maybe you are looking for