Reg: Top_Of_List Events in ALV GRID Display

Hi ,
How can i use the the the Top_of_list Event Alv grid Disply.
I have passed Events table with event name and form name to GRID FM it_events.
Form details:-
T_LISTHEADER header deatils table with data. . 
FORM TOP_OF_LIST.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
  IT_LIST_COMMENTARY = T_LISTHEADER.
ENDFORM.
But still its not calling the form and also end_of list is working with same coding but top_of_list is not  working can u give solution for this.
Regards,
raj

Hi Rajviji,
Please change the coding to below :-
*& Report  ZR2K9_ALV008
REPORT  alv_top_of_list
TABLES : t001.
TYPE-POOLS: slis.
DATA : w_repid LIKE sy-repid.
TYPES : BEGIN OF ty_comp.
        INCLUDE STRUCTURE t001.
TYPES : END OF ty_comp.
DATA: T_EVENTS  TYPE slis_t_event.
DATA: WA_EVENTS   TYPE slis_alv_event .
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
      wa_fieldcat TYPE slis_fieldcat_alv.
DATA : it_comp TYPE TABLE OF ty_comp.
INITIALIZATION.
  w_repid = sy-repid.
*Need to change here
wa_events-name = 'TOP_OF_PAGE'.       "Instead of TOP_OF_LIST
wa_events-form = 'TOP_OF_PAGE'.
APPEND wa_events TO t_events.
START-OF-SELECTION.
  SELECT * FROM t001 INTO TABLE it_comp up to 20 rows.
END-OF-SELECTION.
  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name         = w_repid
      i_internal_tabname     = 'IT_COMP'
      I_STRUCTURE_NAME       = 't001'
      i_inclname             = w_repid
    CHANGING
      ct_fieldcat            = it_fieldcat[]
    EXCEPTIONS
      inconsistent_interface = 1
      program_error          = 2
      OTHERS                 = 3.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program          = w_repid
      it_fieldcat                 = it_fieldcat[]
      IT_EVENTS                    = T_EVENTS
    TABLES
      t_outtab                    = it_comp
    EXCEPTIONS
      program_error               = 1
      OTHERS                      = 2.
FORM TOP_OF_PAGE.             "Form Name Changed
DATA: T_LISTHEADER   TYPE SLIS_T_LISTHEADER.
DATA: LS_LISTHEADER TYPE SLIS_LISTHEADER.
CLEAR LS_LISTHEADER.
LS_LISTHEADER-TYP  = 'S'.
LS_LISTHEADER-KEY  = 'Po Heder Details :-'.
APPEND LS_LISTHEADER  TO T_LISTHEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
  IT_LIST_COMMENTARY = T_LISTHEADER.
ENDFORM.
Regards
Sandipan

Similar Messages

  • How to capture the event in ALV grid display?

    Hi experts,
      How to capture the event in an ALV grid display which is editable. I have to capture the TAB key or ENTER key.
    regards,
    Arul Jothi.

    Hi Arul,
    Take a look at sample program BCALV_EDIT_03. (Find string "register ENTER" in the program to see how to register)
    Basically you have to Register edit events using method call REGISTER_EDIT_EVENT and then write a handler method for event DATA_CHANGED..
    If you are using a REUSE..GRID fm then first get the grid reference using function module GET_GLOBALS_FROM_SLVC_FULLSCR and then repeat the above procedure..
    Hope this helps..
    Sri
    Message was edited by: Srikanth Pinnamaneni

  • Handling Events in ALV Grid Display

    Hi,
         I need ur urgent help on how to trigger and handle the events associated with the class CL_GUI_ALV_GRID_DISPLAY .Events like
    •     ONF4
    •     ONF1
    •     DATA_CHANGED
    •     USER_COMMAND
    •     TOOLBAR
    •     HOTSPOT_CLICK
    Please help me in this matter and post some valid codes depicting these events.Ur help will be really appreciated throught points.
    Thnkx in advance.

    Hi,
    Please refer program "BCALV_TEST_GRID_EVENTS"
    Best regards,
    Prashant
    *& Report  BCALV_TEST_GRID_EVENTS                                      *
    report  bcalv_test_grid_events.
    types: g_ty_t_carrid  type standard table of alv_tab,
           g_ty_t_connid  type standard table of alv_chck,
           g_ty_t_curr    type standard table of alv_cur,
           g_ty_s_sflight type alv_t_t2,
           g_ty_s_carrid  type alv_tab,
           g_ty_s_connid  type alv_chck,
           g_ty_s_curr    type alv_cur.
    constants: con_sflight type lvc_fname value 'ALV_T_T2',
               con_scarr   type lvc_fname value 'ALV_TAB',
               con_spfli   type lvc_fname value 'ALV_CHCK'.
    * DATA                                                                 *
    class lcl_events_d0100 definition deferred.
    types: begin of g_ty_s_plane,
             carrid    type g_ty_s_sflight-carrid,
             connid    type g_ty_s_sflight-connid,
             planetype type g_ty_s_sflight-planetype,
             seatsmax  type g_ty_s_sflight-seatsmax,
           end   of g_ty_s_plane,
           g_ty_t_plane type sorted table of g_ty_s_plane
                             with unique key carrid connid,
           begin of g_ty_s_event,
             user_command                 type char1,
             before_user_command          type char1,
             after_user_command           type char1,
             double_click                 type char1,
             hotspot_click                type char1,
             button_click                 type char1,
             onf1                         type char1,
             onf4                         type char1,
             menu_button                  type char1,
             toolbar                      type char1,
             context_menu_request         type char1,
             ondrag                       type char1,
             ondrop                       type char1,
             ondropcomplete               type char1,
             ondropgetflavor              type char1,
             subtotal_text                type char1,
             data_changed                 type char1,
             data_changed_finished        type char1,
             after_refresh                type char1,
             delayed_callback             type char1,
             delayed_changed_sel_callback type char1,
             top_of_page                  type char1,
             end_of_list                  type char1,
             print_top_of_page            type char1,
             print_end_of_page            type char1,
             print_top_of_list            type char1,
             print_end_of_list            type char1,
           end   of g_ty_s_event,
           begin of g_ty_s_onf4,
             register        type char1,
             get_before      type char1,
             change_after    type char1,
             internal_format type char1,
           end   of g_ty_s_onf4,
           begin of g_ty_s_test,
             select_amount      type i,
             no_info_popup      type char1,
             info_popup_once    type char1,
             events_info_popup  type lvc_fname occurs 0,
             application_events type char1,
             event              type g_ty_s_event,
             onf4               type g_ty_s_onf4,
             button_fields      type lvc_fname occurs 0,
             hotspot_fields     type lvc_fname occurs 0,
             onf1_fields        type lvc_fname occurs 0,
             onf4_fields        type lvc_fname occurs 0,
             bypassing_buffer   type char1,
             buffer_active      type char1,
           end   of g_ty_s_test,
           begin of g_ty_s_outtab.
    include type g_ty_s_sflight.
    types:   box                  type char1,
             lights               type char1,
           end   of g_ty_s_outtab,
           g_ty_t_outtab type table of g_ty_s_outtab.
    constants: con_exit type sy-ucomm value 'EXIT',
               con_canc type sy-ucomm value 'CANC',
               con_back type sy-ucomm value 'BACK',
               con_true     type char1 value 'X'.
    data: g_okcode type sy-ucomm.
    data: gs_test type g_ty_s_test.
    data: gt_outtab type g_ty_t_outtab with header line,
          gr_container_d0100   type ref to cl_gui_custom_container,
          gr_grid_d0100        type ref to cl_gui_alv_grid,
          gr_events_d0100      type ref to lcl_events_d0100,
          gr_grid_dragdrop     type ref to cl_dragdrop.
    data: g_static_menu            type ref to cl_ctmenu,
          g_static_menu_default    type ref to cl_ctmenu.
    data: g_field type lvc_s_fcat-fieldname.
    *       CLASS lcl_dragdrop_obj_d0100 DEFINITION
    class lcl_dragdrop_obj_d0100 definition.
      public section.
        data: line  type g_ty_s_outtab,
              index type i.
    endclass.                    "lcl_dragdrop_obj_d0100 DEFINITION
    *       CLASS lcl_events_d0100 DEFINITION
    class lcl_events_d0100 definition.
      public section.
        methods:
        user_command         for event user_command
                             of cl_gui_alv_grid
                             importing e_ucomm sender,
        before_user_command  for event before_user_command
                             of cl_gui_alv_grid
                             importing e_ucomm,
        after_user_command   for event after_user_command
                             of cl_gui_alv_grid
                             importing e_ucomm
                                       e_not_processed
                                       e_saved,
        double_click         for event double_click
                             of cl_gui_alv_grid
                             importing e_row
                                       e_column
                                       es_row_no,
        hotspot_click        for event hotspot_click
                             of cl_gui_alv_grid
                             importing e_row_id
                                       e_column_id
                                       es_row_no,
        menu_button          for event menu_button
                             of cl_gui_alv_grid
                             importing e_object
                                       e_ucomm,
        toolbar              for event toolbar
                             of cl_gui_alv_grid
                             importing e_object
                                       e_interactive,
        context_menu_request for event context_menu_request
                             of cl_gui_alv_grid
                             importing e_object,
        top_of_page          for event top_of_page
                             of cl_gui_alv_grid
                             importing e_dyndoc_id,
        end_of_list          for event end_of_list
                             of cl_gui_alv_grid
                             importing e_dyndoc_id,
        print_top_of_page    for event print_top_of_page
                             of cl_gui_alv_grid,
        print_end_of_page    for event print_end_of_page
                             of cl_gui_alv_grid,
        print_top_of_list    for event print_top_of_list
                             of cl_gui_alv_grid,
        print_end_of_list    for event print_end_of_list
                             of cl_gui_alv_grid,
        after_refresh        for event after_refresh
                             of cl_gui_alv_grid,
        delayed_callback     for event delayed_callback
                             of cl_gui_alv_grid,
        delayed_changed_sel_callback
                             for event delayed_changed_sel_callback
                             of cl_gui_alv_grid,
        subtotal_text        for event subtotal_text
                             of cl_gui_alv_grid
                             importing es_subtottxt_info
                                       ep_subtot_line
                                       e_event_data,
        ondrag               for event ondrag
                             of cl_gui_alv_grid
                             importing e_row
                                       e_column
                                       es_row_no
                                       e_dragdropobj,
        ondrop               for event ondrop
                             of cl_gui_alv_grid
                             importing e_row
                                       e_column
                                       es_row_no
                                       e_dragdropobj,
        ondropcomplete       for event ondropcomplete
                             of cl_gui_alv_grid
                             importing e_row
                                       e_column
                                       es_row_no
                                       e_dragdropobj,
        ondropgetflavor      for event ondropgetflavor
                             of cl_gui_alv_grid
                             importing e_row
                                       e_column
                                       es_row_no
                                       e_dragdropobj
                                       e_flavors,
        data_changed         for event data_changed
                             of cl_gui_alv_grid
                             importing er_data_changed
                                       e_onf4
                                       e_onf4_before
                                       e_onf4_after,
        data_changed_finished
                             for event data_changed_finished
                             of cl_gui_alv_grid,
        button_click         for event button_click
                             of cl_gui_alv_grid
                             importing es_col_id
                                       es_row_no,
        onf1                 for event onf1
                             of cl_gui_alv_grid
                             importing e_fieldname
                                       es_row_no
                                       er_event_data,
        onf4                 for event onf4
                             of cl_gui_alv_grid
                             importing e_fieldname
                                       e_fieldvalue
                                       es_row_no
                                       er_event_data
                                       et_bad_cells
                                       e_display.
    endclass.                    "lcl_events_d0100 DEFINITION
    *       CLASS lcl_events_d0100 IMPLEMENTATION
    class lcl_events_d0100 implementation.
    *       METHOD user_command                                           *
      method user_command.
        perform d0100_event_ucomm using e_ucomm.
      endmethod.                    "user_command
    *       METHOD before_user_command                                    *
      method before_user_command.
        perform d0100_event_before_ucomm using e_ucomm.
      endmethod.                    "before_user_command
    *       METHOD after_user_command                                     *
      method after_user_command.
        perform d0100_event_after_ucomm using e_ucomm
                                              e_not_processed
                                              e_saved.
      endmethod.                    "after_user_command
    *       METHOD double_click                                           *
      method double_click.
        perform d0100_event_double_click using e_row
                                               e_column.
      endmethod.                    "double_click
    *       METHOD hotspot_click                                          *
      method hotspot_click.
    *    perform d0100_event_hotspot_click using e_row_id
    *                                            e_column_id.
        gr_grid_d0100->refresh_table_display( ).
      endmethod.                    "hotspot_click
    *       METHOD menu_button                                            *
      method menu_button.
        perform d0100_event_menu_button using e_object
                                              e_ucomm.
      endmethod.                    "menu_button
    *       METHOD toolbar                                                *
      method toolbar.
        perform d0100_event_toolbar using e_object
                                          e_interactive.
      endmethod.                    "toolbar
    *       METHOD context_menu_request                                   *
      method context_menu_request.
        perform d0100_event_context_menu_reqst using e_object.
      endmethod.                    "context_menu_request
    *       METHOD top_of_page                                            *
      method top_of_page.
        perform d0100_event_top_of_page using e_dyndoc_id.
      endmethod.                    "top_of_page
    *       METHOD end_of_list                                            *
      method end_of_list.
        perform d0100_event_end_of_list using e_dyndoc_id.
      endmethod.                    "end_of_list
    *       METHOD print_top_of_page                                      *
      method print_top_of_page.
        perform d0100_event_print_top_of_page.
      endmethod.                    "print_top_of_page
    *       METHOD print_end_of_page                                      *
      method print_end_of_page.
        perform d0100_event_print_end_of_page.
      endmethod.                    "print_end_of_page
    *       METHOD print_top_of_list                                      *
      method print_top_of_list.
        perform d0100_event_print_top_of_list.
      endmethod.                    "print_top_of_list
    *       METHOD print_end_of_list                                      *
      method print_end_of_list.
        perform d0100_event_print_end_of_list.
      endmethod.                    "print_end_of_list
    *       METHOD after_refresh                                          *
      method after_refresh.
        perform d0100_event_after_refresh.
      endmethod.                    "after_refresh
    *       METHOD delayed_callback                                       *
      method delayed_callback.
        perform d0100_event_delayed_callback.
      endmethod.                    "delayed_callback
    *       METHOD delayed_changed_sel_callback                           *
      method delayed_changed_sel_callback.
        perform d0100_event_changed_sel_callba.
      endmethod.                    "delayed_changed_sel_callback
    *       METHOD subtotal_text                                          *
      method subtotal_text.
        perform d0100_event_subtotal_text using es_subtottxt_info
                                                ep_subtot_line
                                                e_event_data.
      endmethod.                    "subtotal_text
    *       METHOD ondrag                                                 *
      method ondrag.
        perform d0100_event_ondrag using e_row
                                         e_column
                                         e_dragdropobj.
      endmethod.                    "ondrag
    *       METHOD ondrop                                                 *
      method ondrop.
        perform d0100_event_ondrop using e_row
                                         e_column
                                         e_dragdropobj.
      endmethod.                    "ondrop
    *       METHOD ondropcomplete                                         *
      method ondropcomplete.
        perform d0100_event_ondropcomplete using e_row
                                                 e_column
                                                 e_dragdropobj.
      endmethod.                    "ondropcomplete
    *       METHOD ondropgetflavor                                        *
      method ondropgetflavor.
        perform d0100_event_ondropgetflavor.
      endmethod.                    "ondropgetflavor
    *       METHOD data_changed                                           *
      method data_changed.
        perform d0100_event_data_changed using er_data_changed
                                               e_onf4
                                               e_onf4_before
                                               e_onf4_after.
      endmethod.                    "data_changed
    *       METHOD data_changed_finished                                  *
      method data_changed_finished.
        perform d0100_event_data_changed_finis.
      endmethod.                    "data_changed_finished
    *       METHOD button_click                                           *
      method button_click.
        perform d0100_event_button_click using es_col_id
                                               es_row_no.
      endmethod.                    "button_click
    *       METHOD onf1                                                   *
      method onf1.
        perform d0100_event_onf1 using e_fieldname
                                       es_row_no
                                       er_event_data.
      endmethod.                                                "onf1
    *       METHOD onf4                                                   *
      method onf4.
        perform d0100_event_onf4 using e_fieldname
                                       e_fieldvalue
                                       es_row_no
                                       er_event_data
                                       et_bad_cells
                                       e_display.
      endmethod.                                                "onf4
    endclass.                    "lcl_events_d0100 IMPLEMENTATION
    * SELECTION-SCREEN                                                     *
    selection-screen begin of block gen with frame.
      selection-screen begin of line.
      parameters:
        p_ext    radiobutton group db.
      selection-screen comment (29) for field p_ext.
      selection-screen comment (29) for field p_d_file.
      parameters:
        p_d_file   type char255.
      selection-screen end of line.
      selection-screen begin of line.
      parameters:
        p_db    radiobutton group db default 'X'.
      selection-screen comment (29) for field p_db.
      selection-screen comment (29) for field p_amount.
      parameters:
        p_amount type i default 30.
      selection-screen end of line.
    selection-screen end of block gen.
    selection-screen begin of block inf with frame.
    parameters:
    p_inf01 as checkbox default con_true,
    p_inf02 as checkbox.
    selection-screen end of block inf.
    selection-screen begin of block app with frame.
    parameters:
    p_appevt as checkbox.
    selection-screen end of block app.
    selection-screen begin of block evt with frame.
    parameters:
    p_evt01 as checkbox, "USER_COMMAND
    p_evt02 as checkbox, "BEFORE_USER_COMMAND
    p_evt03 as checkbox. "AFTER_USER_COMMAND
    selection-screen skip.
    parameters:
    p_evt04 as checkbox, "DOUBLE_CLICK
    p_evt05 as checkbox. "HOTSPOT_CLICK
    select-options:
    p_hotspt for g_field no intervals default 'CARRID'.
    parameters:
    p_evt06 as checkbox. "BUTTON_CLICK
    select-options:
    p_button for g_field no intervals default 'CARRID'.
    selection-screen skip.
    parameters:
    p_evt07 as checkbox.                                        "ONF1
    selection-screen begin of block of4 with frame.
    parameters:
    p_evt08 as checkbox.                                        "ONF4
    select-options:
    p_onf4 for g_field no intervals default 'CARRID'.
    selection-screen begin of line.
    selection-screen comment 5(30) text-c01 for field p_f401.
    parameters:
    p_f401 as checkbox default con_true. "REGISTER
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 5(30) text-c02 for field p_f402.
    parameters:
    p_f402 as checkbox. "GET_BEFORE
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 5(30) text-c03 for field p_f403.
    parameters:
    p_f403 as checkbox. "CHANGE_AFTER
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 5(30) text-c04 for field p_f404.
    parameters:
    p_f404 as checkbox. "INTERNAL_FORMAT
    selection-screen end of line.
    selection-screen end of block of4.
    selection-screen skip.
    parameters:
    p_evt09 as checkbox, "MENU_BUTTON
    p_evt10 as checkbox, "TOOLBAR
    p_evt11 as checkbox. "CONTEXT_MENU_REQUEST
    selection-screen skip.
    parameters:
    p_evt12 as checkbox, "ONDRAG
    p_evt13 as checkbox, "ONDROP
    p_evt14 as checkbox, "ONDROPCOMPLETE
    p_evt15 as checkbox. "ONDROPGETFLAVOR
    selection-screen skip.
    parameters:
    p_evt16 as checkbox. "SUBTOTAL_TEXT
    selection-screen skip.
    parameters:
    p_evt17 as checkbox, "DATA_CHANGED
    p_evt18 as checkbox, "DATA_CHANGED_FINISHED
    p_evt19 as checkbox. "AFTER_REFRESH
    selection-screen skip.
    parameters:
    p_evt20 as checkbox, "DELAYED_CALLBACK
    p_evt21 as checkbox. "DELAYED_CHANGED_SEL_CALLBACK
    selection-screen skip.
    parameters:
    p_evt22 as checkbox, "TOP_OF_PAGE
    p_evt23 as checkbox, "END_OF_LIST
    p_evt24 as checkbox, "PRINT_TOP_OF_PAGE
    p_evt25 as checkbox, "PRINT_END_OF_PAGE
    p_evt26 as checkbox, "PRINT_TOP_OF_LIST
    p_evt27 as checkbox. "PRINT_END_OF_LIST
    selection-screen end of block evt.
    * AT SELECTION-SCREEN ON VALUE-REQUEST                                 *
    at selection-screen on value-request for p_hotspt-low.
      perform d0100_f4_fcode changing p_hotspt-low.
    at selection-screen on value-request for p_button-low.
      perform d0100_f4_fcode changing p_button-low.
    at selection-screen on value-request for p_onf4-low.
      perform d0100_f4_fcode changing p_onf4-low.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_d_file.
      PERFORM f4_file.
    * START-OF-SELECTION                                                   *
    start-of-selection.
      gs_test-select_amount = p_amount.
      gs_test-no_info_popup   = p_inf01.
      gs_test-info_popup_once = p_inf02.
      gs_test-application_events = p_appevt.
      gs_test-event-user_command                 = p_evt01.
      gs_test-event-before_user_command          = p_evt02.
      gs_test-event-after_user_command           = p_evt03.
      gs_test-event-double_click                 = p_evt04.
      gs_test-event-hotspot_click                = p_evt05.
      gs_test-event-button_click                 = p_evt06.
      gs_test-event-onf1                         = p_evt07.
      gs_test-event-onf4                         = p_evt08.
      gs_test-event-menu_button                  = p_evt09.
      gs_test-event-toolbar                      = p_evt10.
      gs_test-event-context_menu_request         = p_evt11.
      gs_test-event-ondrag                       = p_evt12.
      gs_test-event-ondrop                       = p_evt13.
      gs_test-event-ondropcomplete               = p_evt14.
      gs_test-event-ondropgetflavor              = p_evt15.
      gs_test-event-subtotal_text                = p_evt16.
      gs_test-event-data_changed                 = p_evt17.
      gs_test-event-data_changed_finished        = p_evt18.
      gs_test-event-after_refresh                = p_evt19.
      gs_test-event-delayed_callback             = p_evt20.
      gs_test-event-delayed_changed_sel_callback = p_evt21.
      gs_test-event-top_of_page                  = p_evt22.
      gs_test-event-end_of_list                  = p_evt23.
      gs_test-event-print_top_of_page            = p_evt24.
      gs_test-event-print_end_of_page            = p_evt25.
      gs_test-event-print_top_of_list            = p_evt26.
      gs_test-event-print_end_of_list            = p_evt27.
      gs_test-onf4-register        = p_f401.
      gs_test-onf4-get_before      = p_f402.
      gs_test-onf4-change_after    = p_f403.
      gs_test-onf4-internal_format = p_f404.
      if p_evt05 ne space.
        loop at p_hotspt.
          if not p_hotspt-low is initial.
            append p_hotspt-low to gs_test-hotspot_fields.
          endif.
        endloop.
      endif.
      if p_evt06 ne space.
        loop at p_button.
          if not p_button-low is initial.
            append p_button-low to gs_test-button_fields.
          endif.
        endloop.
      endif.
      if p_evt08 ne space.
        loop at p_onf4.
          if not p_onf4-low is initial.
            append p_onf4-low to gs_test-onf4_fields.
          endif.
        endloop.
      endif.
      gs_test-bypassing_buffer = space.
      gs_test-buffer_active    = space.
    * END-OF-SELECTION                                                     *
    end-of-selection.
      call screen 100.
    *&      Module  d0100_set_status  OUTPUT
    *       text
    module d0100_set_status output.
      perform d0100_set_status.
    endmodule.                 " d0100_set_status  OUTPUT
    *&      Module  d0100_prepare_container  OUTPUT
    *       text
    module d0100_prepare_container output.
      perform d0100_prepare_container.
    endmodule.                 " d0100_prepare_container  OUTPUT
    *&      Module  d0100_exit  INPUT
    *       text
    module d0100_exit input.
      perform d0100_exit.
    endmodule.                 " d0100_exit  INPUT
    *&      Module  d0100_fcode  INPUT
    *       text
    module d0100_fcode input.
      perform d0100_fcode.
    endmodule.                 " d0100_fcode  INPUT
    *&      Form  d0100_set_status
    *       text
    form d0100_set_status .
      types: begin of l_ty_s_excl,
               func type syucomm,
             end   of l_ty_s_excl,
             l_ty_t_excl type standard table of l_ty_s_excl.
      data: lt_excl type l_ty_t_excl.
      set pf-status 'D0100' excluding lt_excl.
      set titlebar 'D0100'.
    endform.                    " d0100_set_status
    *&      Form  d0100_prepare_container
    *       text
    form d0100_prepare_container .
      data: lt_fcat             type lvc_t_fcat,
            ls_layo             type lvc_s_layo,
            ls_vari             type disvariant,
            ls_prnt             type lvc_s_prnt,
            l_consistency_check type char1.
      if gr_container_d0100 is initial.
        if cl_gui_alv_grid=>offline( ) is initial.
          create object gr_container_d0100
                        exporting container_name = 'D0100_CONTAINER'.
        endif.
        create object gr_grid_d0100
                      exporting i_parent      = gr_container_d0100
                                i_appl_events = gs_test-application_events.
        DATA: l_filename TYPE string,
              l_struct   TYPE string.
        CASE con_true.
          WHEN p_db.
            perform d0100_get_outtab.
          WHEN p_ext.
            l_struct = 'g_ty_t_outtab'.
            l_filename = p_d_file.
            CALL METHOD cl_salv_test_data=>select_data
              EXPORTING
                structname = l_struct
                SOURCE     = 2
                 filename   = l_filename
    *            AMOUNT     = 30
              CHANGING
                data       = gt_outtab[].
        ENDCASE.
        perform d0100_set_grid_vari     changing ls_vari.
        perform d0100_set_grid_layo     changing ls_layo.
        perform d0100_set_grid_fcat     changing lt_fcat.
        perform d0100_set_grid_onf4     changing lt_fcat.
        perform d0100_set_grid_buttons  changing lt_fcat.
        perform d0100_set_grid_hotspot  changing lt_fcat.
        perform d0100_set_grid_dragdrop changing ls_layo.
        perform d0100_set_grid_edit     changing ls_layo.
        perform d0100_set_grid_events.
        ls_prnt-grpchgedit = con_true.
        call method gr_grid_d0100->set_table_for_first_display
          exporting
            i_buffer_active     = gs_test-buffer_active
            i_bypassing_buffer  = gs_test-bypassing_buffer
            i_consistency_check = l_consistency_check
            is_variant          = ls_vari
            i_save              = 'A'
            i_default           = con_true
            is_layout           = ls_layo
            is_print            = ls_prnt
          changing
            it_outtab           = gt_outtab[]
            it_fieldcatalog     = lt_fcat.
      endif.
    endform.                    " d0100_prepare_container
    *&      Form  d0100_exit
    *       text
    form d0100_exit .
      data: l_okcode like sy-ucomm.
      l_okcode = g_okcode.
      clear g_okcode.
      case l_okcode.
        when con_exit or con_back or con_canc.
          call method gr_grid_d0100->free.
          call method gr_container_d0100->free.
          call method cl_gui_cfw=>flush.
          clear gr_container_d0100.
          clear gr_grid_d0100.
          clear gr_events_d0100.
          set screen 0.
          leave screen.
      endcase.
    endform.                    " d0100_exit
    *&      Form  d0100_fcode
    *       text
    form d0100_fcode .
      data: l_okcode like sy-ucomm.
      l_okcode = g_okcode.
      clear g_okcode.
      call method cl_gui_cfw=>dispatch.
      case l_okcode.
        when con_exit or con_back or con_canc.
          g_okcode = l_okcode.
          perform d0100_exit.
        when others.
      endcase.
    endform.                    " d0100_fcode
    *&      Form  d0100_set_grid_vari
    *       text
    form d0100_set_grid_vari changing cs_vari type disvariant.
      cs_vari-report      = sy-repid.
      cs_vari-handle      = space.
      cs_vari-log_group   = space.
      cs_vari-username    = space.
      cs_vari-variant     = space.
      cs_vari-text        = space.
      cs_vari-dependvars  = space.
    endform.                    " d0100_set_grid_vari
    *&      Form  d0100_set_grid_layo
    *       text
    form d0100_set_grid_layo  changing cs_layo type lvc_s_layo.
    *... ALV-Control: Allgemeine Anzeigeoptionen
      cs_layo-stylefname  = space.
      cs_layo-cwidth_opt  = con_true.
      cs_layo-zebra       = space.
      cs_layo-smalltitle  = space.
      cs_layo-graphics    = space.
      cs_layo-frontend    = space.
      cs_layo-template    = space.
    *... ALV-Control: Gridcustomizing
      cs_layo-no_colexpd  = space.
      cs_layo-no_hgridln  = space.
      cs_layo-no_vgridln  = space.
      cs_layo-no_rowmark  = space.
      cs_layo-no_headers  = space.
      cs_layo-no_merging  = space.
      cs_layo-grid_title  = space.
      cs_layo-no_toolbar  = space.
      cs_layo-sel_mode    = 'D'.
      cs_layo-box_fname   = space.
      cs_layo-sgl_clk_hd  = space.
    *... ALV-Control: Summenoptionen
      cs_layo-totals_bef  = space.
      cs_layo-no_totline  = space.
      cs_layo-numc_total  = space.
      cs_layo-no_utsplit  = space.
    *... ALV-Control: Exceptions
      cs_layo-excp_fname  = 'LIGHTS'.
      cs_layo-excp_rolln  = space.
      cs_layo-excp_conds  = space.
      cs_layo-excp_led    = space.
    *... ALV-Control: Steuerung Interaktion
      cs_layo-detailinit  = space.
      cs_layo-detailtitl  = space.
      cs_layo-keyhot      = space.
      cs_layo-no_keyfix   = space.
      cs_layo-no_author   = space.
      clear cs_layo-s_dragdrop.
    *... ALV-Control: Farben
      cs_layo-info_fname  = space.
      cs_layo-ctab_fname  = space.
    *... ALV-Control: Eingabefähigkeit
      cs_layo-edit        = space.
      cs_layo-edit_mode   = space.
      cs_layo-no_rowins   = space.
      cs_layo-no_rowmove  = space.
    *... ALV-Control: Web-Optionen
      cs_layo-weblook     = space.
      cs_layo-webstyle    = space.
      cs_layo-webrows     = space.
      cs_layo-webxwidth   = space.
      cs_layo-webxheight  = space.
    endform.                    " d0100_set_grid_layo
    *&      Form  d0100_set_grid_fcat
    *       text
    form d0100_set_grid_fcat changing ct_fcat type lvc_t_fcat.
      call function 'LVC_FIELDCATALOG_MERGE'
        exporting
          i_buffer_active        = gs_test-buffer_active
          i_structure_name       = con_sflight
          i_client_never_display = con_true
          i_bypassing_buffer     = gs_test-bypassing_buffer
        changing
          ct_fieldcat            = ct_fcat[]
        exceptions
          inconsistent_interface = 1
          program_error          = 2
          others                 = 3.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    endform.                    " d0100_set_grid_fcat
    *&      Form  d0100_set_grid_onf4
    *       text
    form d0100_set_grid_onf4 changing ct_fcat type lvc_t_fcat.
      field-symbols: <ls_fcat> type lvc_s_fcat.
      data: l_field type lvc_fname,
            lt_f4   type lvc_t_f4,
            ls_f4   type lvc_s_f4.
      if gs_test-event-onf4 eq con_true.
        loop at gs_test-onf4_fields into l_field.
          read table ct_fcat assigning <ls_fcat>
                     with key fieldname = l_field.
          if sy-subrc eq 0.
            <ls_fcat>-f4availabl = con_true.
          endif.
          ls_f4-fieldname  = l_field.
          ls_f4-register   = gs_test-onf4-register.
          ls_f4-getbefore  = gs_test-onf4-get_before.
          ls_f4-chngeafter = gs_test-onf4-change_after.
          ls_f4-internal   = gs_test-onf4-internal_format.
          insert ls_f4 into table lt_f4.
        endloop.
      endif.
      check not lt_f4 is initial.
      call method gr_grid_d0100->register_f4_for_fields
        exporting
          it_f4 = lt_f4.
    endform.                    " d0100_set_grid_onf4
    *&      Form  d0100_set_grid_buttons
    *       text
    form d0100_set_grid_buttons changing ct_fcat type lvc_t_fcat.
      field-symbols: <ls_fcat> type lvc_s_fcat.
      data: l_field type lvc_fname.
      loop at gs_test-button_fields into l_field.
    *... Spaltenebene
    *    In Feldkatalog wird Feld STYLE für Spalte auf
    *    cl_gui_alv_grid=>mc_style_button gesetzt
        read table ct_fcat assigning <ls_fcat>
                   with key fieldname = l_field.
        if sy-subrc eq 0.
          <ls_fcat>-style = cl_gui_alv_grid=>mc_style_button.
        endif.
      endloop.
    endform.                    " d0100_set_grid_buttons
    *&      Form  d0100_set_grid_hotspot
    *       text
    form d0100_set_grid_hotspot changing ct_fcat type lvc_t_fcat.
      field-symbols: <ls_fcat> type lvc_s_fcat.
      data: l_field type lvc_fname.
      loop at gs_test-hotspot_fields into l_field.
    *... Spaltenebene
    *    In Feldkatalog wird Feld STYLE für Spalte auf
    *    cl_gui_alv_grid=>mc_style_hotspot gesetzt
        read table ct_fcat assigning <ls_fcat>
                   with key fieldname = l_field.
        if sy-subrc eq 0.
          <ls_fcat>-style = cl_gui_alv_grid=>mc_style_hotspot.
        endif.
      endloop.
    endform.                    " d0100_set_grid_hotspot
    *&      Form  d0100_set_grid_edit
    *       text
    form d0100_set_grid_edit changing cs_layo type lvc_s_layo.
      if gs_test-event-data_changed eq con_true or
         gs_test-event-data_changed_finished eq con_true or
         gs_test-event-after_refresh eq con_true.
        cs_layo-edit = con_true.
        call method gr_grid_d0100->register_edit_event
          exporting
            i_event_id = cl_gui_alv_grid=>mc_evt_enter.
      endif.
    endform.                    " d0100_set_grid_edit
    *&      Form  d0100_set_grid_dragdrop
    *       text
    form d0100_set_grid_dragdrop changing cs_layo type lvc_s_layo.
      data: l_effect       type i,
            l_handle_grid  type i,
            ls_dragdrop    type lvc_s_dd01.
    *... setzen für Zeilen
      create object gr_grid_dragdrop.
      l_effect = cl_dragdrop=>move + cl_dragdrop=>copy.
      call method gr_grid_dragdrop->add
        exporting
          flavor     = 'Line'                                   "#EC NOTEXT
          dragsrc    = 'X'
          droptarget = 'X'
          effect     = l_effect.
      call method gr_grid_dragdrop->get_handle
        importing
          handle = l_handle_grid.
      ls_dragdrop-cntr_ddid = space.
      ls_dragdrop-grid_ddid = space.
      ls_dragdrop-col_ddid  = space.
      ls_dragdrop-row_ddid  = l_handle_grid.
      ls_dragdrop-fieldname = space.
      cs_layo-s_dragdrop = ls_dragdrop.
    endform.                    " d0100_set_grid_dragdrop
    *&      Form  d0100_set_grid_events
    *       text
    form d0100_set_grid_events .
      create object gr_events_d0100.
      if gs_test-event-user_command eq con_true.
        set handler gr_events_d0100->user_command
                    for gr_grid_d0100.
      endif.
      if gs_test-event-before_user_command eq con_true.
        set handler gr_events_d0100->before_user_command
                    for gr_grid_d0100.
      endif.
      if gs_test-event-after_user_command eq con_true.
        set handler gr_events_d0100->after_user_command
                    for gr_grid_d0100.
      endif.
      if gs_test-event-double_click eq con_true.
        set handler gr_events_d0100->double_click
                    for gr_grid_d0100.
      endif.
      if gs_test-event-hotspot_click eq con_true.
        set handler gr_events_d0100->hotspot_click
                    for gr_grid_d0100.
      endif.
      if gs_test-event-button_click eq con_true.
        set handler gr_events_d0100->button_click
                    for gr_grid_d0100.
      endif.
      if gs_test-event-onf1 eq con_true.
        set handler gr_events_d0100->onf1
                    for gr_grid_d0100.
      endif.
      if gs_test-event-onf4 eq con_true.
        set handler gr_events_d0100->onf4
                    for gr_grid_d0100.
      endif.
      if gs_test-event-menu_button eq con_true.
        set handler gr_events_d0100->menu_button
                    for gr_grid_d0100.
      endif.
      if gs_test-event-toolbar eq con_true.
        set handler gr_events_d0100->toolbar
                    for gr_grid_d0100.
      endif.
      if gs_test-event-context_menu_request eq con_true.
        set handler gr_events_d0100->context_menu_request
                    for gr_grid_d0100.
      endif.
      if gs_test-event-ondrag eq con_true.
        set handler gr_events_d0100->ondrag
                    for gr_grid_d0100.
      endif.
      if gs_test-event-ondrop eq con_true.
        set handler gr_events_d0100->ondrop
                    for gr_grid_d0100.
      endif.
      if gs_test-event-ondropcomplete eq con_true.
        set handler gr_events_d0100->ondropcomplete
                    for gr_grid_d0100.
      endif.
      if gs_test-event-ondropgetflavor eq con_true.
        set handler gr_events_d0100->ondropgetflavor
                    for gr_grid_d0100.
      endif.
      if gs_test-event-subtotal_text eq con_true.
        set handler gr_events_d0100->subtotal_text
                    for gr_grid_d0100.
      endif.
      if gs_test-event-data_changed eq con_true.
        set handler gr_events_d0100->data_changed
                    for gr_grid_d0100.
      endif.
      if gs_test-event-data_changed_finished eq con_true.
        set handler gr_events_d0100->data_changed_finished
                    for gr_grid_d0100.
      endif.
      if gs_test-event-after_refresh eq con_true.
        set handler gr_events_d0100->after_refresh
                    for gr_grid_d0100.
      endif.
      if gs_test-event-delayed_callback eq con_true.
        set handler gr_events_d0100->delayed_callback
                    for gr_grid_d0100.
        call method gr_grid_d0100->register_delayed_event
          exporting
            i_event_id = cl_gui_alv_grid=>mc_evt_delayed_move_curr_cell.
      endif.
      if gs_test-event-delayed_changed_sel_callback eq con_true.
        set handler gr_events_d0100->delayed_changed_sel_callback
                    for gr_grid_d0100.
        call method gr_grid_d0100->register_delayed_event
          exporting
            i_event_id = cl_gui_alv_grid=>mc_evt_delayed_change_select.
      endif.
      if gs_test-event-top_of_page eq con_true.
        set handler gr_events_d0100->top_of_page
                    for gr_grid_d0100.
      endif.
      if gs_test-event-end_of_list eq con_true.
        set handler gr_events_d0100->end_of_list
                    for gr_grid_d0100.
      endif.
      if gs_test-event-print_top_of_page eq con_true.
        set handler gr_events_d0100->print_top_of_page
                    for gr_grid_d0100.
      endif.
      if gs_test-event-print_end_of_page eq con_true.
        set handler gr_events_d0100->print_end_of_page
                    for gr_grid_d0100.
      endif.
      if gs_test-event-print_top_of_list eq con_true.
        set handler gr_events_d0100->print_top_of_list
                    for gr_grid_d0100.
      endif.
      if gs_test-event-print_end_of_list eq con_true.
        set handler gr_events_d0100->print_end_of_list
                    for gr_grid_d0100.
      endif.
    endform.                    " d0100_set_grid_events
    *&      Form  d0100_get_outtab
    *       text
    form d0100_get_outtab .
      field-symbols: <ls_outtab> type g_ty_s_outtab.
      data: l_excp_mod      type i,
            l_excp_div      type i,
            l_excp_amnt     type i value 4,
            l_excp          type i,
            lt_carrid       type g_ty_t_carrid,
            ls_carrid       type g_ty_s_carrid,
            l_carrid_amount type i,
            l_carrid_select type i,
            l_carrid_index1 type i,
            lt_connid       type g_ty_t_connid,
            ls_connid       type g_ty_s_connid,
            l_connid_amount type i,                             "#EC NEEDED
            l_connid_select type i,
            l_connid_index1 type i,
            l_connid_index2 type i,
            lt_plane        type g_ty_t_plane,
            ls_plane        type g_ty_s_plane.
      if gs_test-select_amount gt 0.
        select * from (con_sflight) into corresponding fields
                   of table gt_outtab up to gs_test-select_amount rows.
      endif.
      gs_test-select_amount = sy-dbcnt.
      perform d0100_get_carrid changing lt_carrid.
      perform d0100_get_connid changing lt_connid.
      perform d0100_get_plane  using lt_connid changing lt_plane.
      describe table lt_carrid lines l_carri

  • How to give a page break in alv grid display after 65 lines are displayed?

    hi all,
    I need to give a page break in alv grid display after 65 lines are displayed on each page...Please help me with this...

    hai
    give this command beging of the report name... u have to diclar the beging of the report ......
    <b>report</b> ( name of the report)  <b>standard page heading line-size 200 line-count 65.</b>
    ex1.:- report name is  rtpm_trl_show_flows 
    report <b>rtpm_trl_show_flows </b> no standard page heading line-size 200
                                                         line-count 65.
    ex:2
    report  <b>zlpur01</b> no standard page heading line-size 200
                                                         line-count 65.
    type-pools: slis.
    tables: bkpf.
    selection-screen begin of block sel with frame title text-001.
    select-options: s_comp for bkpf-bukrs, " Company
                    s_valut for bkpf-budat. " Invoice Date
                   S_MTART FOR MARA-MTART. " Material Type
    selection-screen end of block sel.
    parameters: p_vari like disvariant-variant. " ALV Variant
    constants: formname_top_of_page type slis_formname value 'TOP_OF_PAGE'.
    data:   i_bseg type bseg  occurs 0 with header line.
    data: vatval type p decimals 2 value '0.15'.
    data: xhkont type string value '154000'.
    data COM type c.
    data: begin of invt occurs 100,
            budat like bkpf-budat, " Inv Dat
            bukrs like bkpf-bukrs, " Material
            STCEG like bsak-STCEG, "name of the companycode
            belnr like bkpf-belnr,
            xblnr like bkpf-xblnr, " Inv Reference
            ebeln like rseg-ebeln, " PO number
            lifnr like bseg-lifnr, " Vendor No
            name1 like lfa1-name1, " Supplier Name
            matnr like bseg-matnr,
            maktx like makt-maktx,
            stcd1 like lfa1-stcd1, " Supplier VAT REG NO
            xamt like bseg-dmbtr, " TAX amt
            yamt like bseg-wrbtr,
            wrbtr like bseg-wrbtr, " Base amount
            mwskz like bseg-mwskz,
            dmbtr like bseg-dmbtr, " TAX amt
            gjahr like bkpf-gjahr,
            hkont like bseg-hkont,
            zamt like bseg-dmbtr, " TAX amt
            wamt like bseg-dmbtr,
            shkzg like bseg-shkzg,
            shkzg1 like bseg-shkzg,
          end of invt.
    regard
    nawa

  • ALV GRID DISPLAY

    Hi,
    I'm modifying a program with ALV Grid Display.There are lot of Classes and Methods which i don't understand.
    In my program, the Program is executes and displays an Output. Now in the O/P , when I dbl click a field of a row a POP up is displayed with the existing value.now i can edit this value or Update with a new value.After closing the POP up the edited valueor the new value is displayed in the field. The program works good upto here.Now if my O/P has 20 Pages and if i edit a field in the 18 page, then after closing the popup the cursor ( or display ) is displayed in the 1 page( the 1 page of the O/P is displayed). Now, again, if i want to edit a field in the 18 page i have to scroll to the 18 page. Is there any way to hold the display at the 18 page after closing the POPUP.
    I arrived at using CALL METHOD <ref.var. to CL_GUI_ALV_GRID > ->set_current_cell_via_id
    EXPORTING
    IS_ROW_ID = <structure of type LVC_S_ROW >
    IS_COLUMN_ID = <structure of type LVC_S_COL >
    IS_ROW_NO = <structure of type LVC_S_ROID >.
    can some one help me how to pass values to is_row_id and all the parameters.
    Is there any other way?Thanks in advance.
    Thanks,
    Bhaskar.

    Dear Bhaskar,
    To acheieve this follow the below steps:
    1.  On double click first get the scroll information using the method GET_SCROLL_INFO_VIA_ID of class CL_GUI_ALV_GRID.
    CALL METHOD go_alv_grid->get_scroll_info_via_id
    IMPORTING
    es_row_no   = gv_s_roid
    es_row_info  = gv_s_row
    es_col_info  = gv_s_col.
    2.  Again at the end of your double click event call the method SET_SCROLL_INFO_VIA_ID to set the scroll.
    CALL METHOD go_alv_grid->set_scroll_info_via_id
    EXPORTING
    is_row_info = gv_s_row
    is_col_info = gv_s_col
    is_row_no  = gv_s_roid.
    Regards
    Kesava

  • Push button in ALV Grid Display

    Hi all,
    I have a requirement wherin i need to place a button in the ALV Grid Display which should update all the records whatever are displayed in the specified infotype. This is to be done in a report.
    Can anybody give me any pointers or sample code for the above query.
    Regards,
    Amrita

    Simply add a button on your GUI status. Then when pushed, code your logic for update IT0008.
    AT USER-COMMAND event block will be triggered when you press your button.
    AT USER-COMMAND.
      if sy-ucomm = 'PUSHBUTTON'.    "here comes function code of your pushbutton
         "update your diplayed records
      endif.

  • How to devide the top of page in alv grid display

    hi all
    in the alv grid display am getting the page number and total number of pages in the left hand side
    but what i need is i need in the right hand side
    how to get that

    Hi,
    PLease refer to the code below:
    *& Report  ZDEMO_ALVGRID                                               *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic requirement for this demo is to display a number of       *
    *& fields from the EKKO table.                                         *
    REPORT  zdemo_alvgrid                 .
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid,
          gt_events     type slis_t_event,
          gd_prntparams type slis_print_alv.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform build_events.
    perform build_print_params.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    * There are a number of ways to create a fieldcat.
    * For the purpose of this example i will build the fieldcatalog manualy
    * by populating the internal table fields individually and then
    * appending the rows. This method can be the most time consuming but can
    * also allow you  more control of the final product.
    * Beware though, you need to ensure that all fields required are
    * populated. When using some of functionality available via ALV, such as
    * total. You may need to provide more information than if you were
    * simply displaying the result
    *               I.e. Field type may be required in-order for
    *                    the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    *  fieldcatalog-do_sum      = 'X'.
    *  fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-do_sum      = 'X'.
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    *  gd_layout-totals_only        = 'X'.
    *  gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
    *                                         "click(press f2)
    *  gd_layout-zebra             = 'X'.
    *  gd_layout-group_change_edit = 'X'.
    *  gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
    *            i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
    *            it_special_groups       = gd_tabgroup
                it_events               = gt_events
                is_print                = gd_prntparams
                i_save                  = 'X'
    *            is_variant              = z_template
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
      if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into table it_ekko.
    endform.                    " DATA_RETRIEVAL
    * Form  TOP-OF-PAGE                                                 *
    * ALV Report Header                                                 *
    Form top-of-page.
    *ALV Header declarations
    data: t_header type slis_t_listheader,
          wa_header type slis_listheader,
          t_line like wa_header-info,
          ld_lines type i,
          ld_linesc(10) type c.
    * Title
      wa_header-typ  = 'H'.
      wa_header-info = 'EKKO Table Report'.
      append wa_header to t_header.
      clear wa_header.
    * Date
      wa_header-typ  = 'S'.
      wa_header-key = 'Date: '.
      CONCATENATE  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
                   sy-datum(4) INTO wa_header-info.   "todays date
      append wa_header to t_header.
      clear: wa_header.
    * Total No. of Records Selected
      describe table it_ekko lines ld_lines.
      ld_linesc = ld_lines.
      concatenate 'Total No. of Records Selected: ' ld_linesc
                        into t_line separated by space.
      wa_header-typ  = 'A'.
      wa_header-info = t_line.
      append wa_header to t_header.
      clear: wa_header, t_line.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = t_header.
    *            i_logo             = 'Z_LOGO'.
    endform.
    *       FORM USER_COMMAND                                          *
    *       --> R_UCOMM                                                *
    *       --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    * Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
    *   Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
    *     Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    *     Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    *     Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDCASE.
    ENDFORM.
    *&      Form  BUILD_EVENTS
    *       Build events table
    form build_events.
      data: ls_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = gt_events[].
      read table gt_events with key name =  slis_ev_end_of_page
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_PAGE' to ls_event-form.
        append ls_event to gt_events.
      endif.
        read table gt_events with key name =  slis_ev_end_of_list
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_LIST' to ls_event-form.
        append ls_event to gt_events.
      endif.
    endform.                    " BUILD_EVENTS
    *&      Form  BUILD_PRINT_PARAMS
    *       Setup print parameters
    form build_print_params.
      gd_prntparams-reserve_lines = '3'.   "Lines reserved for footer
      gd_prntparams-no_coverpage = 'X'.
    endform.                    " BUILD_PRINT_PARAMS
    *&      Form  END_OF_PAGE
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    *&      Form  END_OF_LIST
    form END_OF_LIST.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    Thanks,
    Sriram Ponna.

  • Events in alv grid dispaly

    Hi,
    I have a requirement to select a row in ALV output and perform some action after a button is pressed.
    (i.e) i have a release button and after i select a line item in alv output and press on the button ,that item should be released.
    so both the events (Selection of line item and pressing of button) should happen together
    how can this be achieved.
    moreover i should be able to select multiple line items in the alv grid display.how can this be achieved.is it in fieldcatalog level or layout level.
    Any pointers to this would be of great help.
    Regards,
    S.Subasree.

    Hi,
    Check the sample code which captures multipe selcted rows
    on clicking a button.
    FORM sub_user_command USING ucomm TYPE sy-ucomm
                                  sel TYPE slis_selfield.
      DATA: ref_grid TYPE REF TO cl_gui_alv_grid.
      DATA: count             TYPE i            ,
            i_rows            TYPE lvc_t_row    .
      DATA: lf_row_index      TYPE lvc_index    ,
            i_selected_line_s TYPE lvc_s_row    ,
            l_vbeln           TYPE vbeln        .
    *then insert the following code in your USER_COMMAND routine...
      IF ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = ref_grid.
      ENDIF.
      IF NOT ref_grid IS INITIAL.
        CALL METHOD ref_grid->check_changed_data.
      ENDIF.
      CASE ucomm.
        WHEN 'PDF'.
          CALL METHOD ref_grid->get_selected_rows
            IMPORTING
              et_index_rows = i_rows.
          LOOP AT i_rows
             INTO i_selected_line_s.
            lf_row_index = i_selected_line_s-index.
            CLEAR i_selected_line_s.
            READ TABLE it_itab
                  INTO wa_itab
                 INDEX lf_row_index.
            IF sy-subrc EQ 0.
              refresh:bdcmsgcoll,
                      bdcdata.
              clear:l_vbeln.
              MOVE wa_itab-vbeln TO l_vbeln.
    ENDFORM.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program       = sy-repid
                i_callback_pf_status_set = 'Z_PF_TEST'
                i_callback_user_command  = 'SUB_USER_COMMAND'
                is_layout                = ls_layout
                it_fieldcat              = lt_fieldcat
               it_sort     = lt_sort
           TABLES
                t_outtab    = it_itab.
    Regards,
    Raj.

  • Push Button on Alv Grid display

    Hi experts,
       I strcuk in the middle of one program, i need to have push buttons on the output ALV Grid display, i have copied the standard status and used the same in the Function module for pf-status, iam able to get the output
    but my requirement is how to add the push buttons to the out put screen, as when iam clicking on status which i have copied iam unable to find where to add these push button in the application tool bar, iam unable to edit the push button can any body help me out, thanks in advance.

    Hello Madan
    I cannot help you with the FM-based ALV lists. However, for OO-based ALV grids (CL_GUI_ALV_GRID) I have a sample program that simulates radio buttons by using icons with hotspots.
    PROGRAM ZUS_SDN_BCALV_GRID_DEMO_2.
    * Based on: BCALV_GRID_DEMO.
    TYPE-POOLS: icon.
    TYPES: BEGIN OF ty_s_sflight.
    INCLUDE TYPE sflight.
    TYPES: button1    TYPE lvc_emphsz.
    TYPES: button2    TYPE lvc_emphsz.
    TYPES: button3    TYPE lvc_emphsz.
    TYPES: button4    TYPE lvc_emphsz.
    TYPES: END OF ty_s_sflight.
    DATA:
      gt_sflight    TYPE STANDARD TABLE OF ty_s_sflight,
      gt_fcat       TYPE lvc_t_fcat.
    DATA: ok_code LIKE sy-ucomm,
    *      gt_sflight TYPE TABLE OF sflight,
          g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
          grid1  TYPE REF TO cl_gui_alv_grid,
          g_custom_container TYPE REF TO cl_gui_custom_container.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-DATA:
          md_cnt    TYPE i.
        CLASS-METHODS:
          handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
            IMPORTING
              e_row_id
              e_column_id
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_hotspot_click.
    * define local data
        FIELD-SYMBOLS:
          <ls_entry>    TYPE ty_s_sflight,
          <ld_fld>      TYPE ANY.
        READ TABLE gt_sflight ASSIGNING <ls_entry> INDEX es_row_no-row_id.
        CHECK ( <ls_entry> IS ASSIGNED ).
    *   Set all radio buttons "unselected"
        <ls_entry>-button1 =  icon_wd_radio_button_empty.
        <ls_entry>-button2 =  icon_wd_radio_button_empty.
        <ls_entry>-button3 =  icon_wd_radio_button_empty.
        <ls_entry>-button4 =  icon_wd_radio_button_empty.
        ASSIGN COMPONENT e_column_id-fieldname OF STRUCTURE <ls_entry>
                                                  TO <ld_fld>.
        IF ( <ld_fld> IS ASSIGNED ).
    *     Set selected radio button "selected".
          <ld_fld> = icon_wd_radio_button.
        ENDIF.
    *   Force PAI followed by refresh of table display in PBO
        CALL METHOD cl_gui_cfw=>set_new_ok_code
          EXPORTING
            new_code = 'DUMMY'
    *      IMPORTING
    *        RC       =
      ENDMETHOD.                    "handle_hotspot_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
    *       MAIN                                                          *
      PERFORM select_data.
      CALL SCREEN 100.
    *       MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      SET PF-STATUS 'MAIN100'.
      IF g_custom_container IS INITIAL.
        CREATE OBJECT g_custom_container
               EXPORTING container_name = g_container.
        CREATE OBJECT grid1
               EXPORTING i_parent = g_custom_container.
        PERFORM build_fieldcatalog.
        CALL METHOD grid1->set_table_for_first_display
    *      EXPORTING
    *        i_structure_name = 'SFLIGHT'
          CHANGING
            it_fieldcatalog  = gt_fcat
            it_outtab        = gt_sflight.
    *   Set event handler for event TOOLBAR
        SET HANDLER:
          lcl_eventhandler=>handle_hotspot_click FOR grid1.
      else.
        CALL METHOD grid1->refresh_table_display
    *      EXPORTING
    *        IS_STABLE      =
    *        I_SOFT_REFRESH =
          EXCEPTIONS
            FINISHED       = 1
            others         = 2.
        IF sy-subrc <> 0.
    *     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    ENDMODULE.                    "PBO OUTPUT
    *       MODULE PAI INPUT                                              *
    MODULE pai INPUT.
    *   to react on oi_custom_events:
      CALL METHOD cl_gui_cfw=>dispatch.
      CASE ok_code.
        WHEN 'EXIT'.
          PERFORM exit_program.
        WHEN OTHERS.
    *     do nothing
      ENDCASE.
      CLEAR ok_code.
    ENDMODULE.                    "PAI INPUT
    *       FORM EXIT_PROGRAM                                             *
    FORM exit_program.
    *  CALL METHOD G_CUSTOM_CONTAINER->FREE.
    *  CALL METHOD CL_GUI_CFW=>FLUSH.
      LEAVE PROGRAM.
    ENDFORM.                    "EXIT_PROGRAM
    *&      Form  BUILD_FIELDCATALOG
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog .
    * define local data
      DATA:
        ls_fcat        TYPE lvc_s_fcat,
        ls_hype        TYPE lvc_s_hype.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'LVC_S_FCAT'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 2
          OTHERS                       = 3.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      DELETE gt_fcat WHERE ( fieldname <> 'EMPHASIZE' ).
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'SFLIGHT'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 2
          OTHERS                       = 3.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      READ TABLE gt_fcat INTO ls_fcat
           WITH KEY fieldname = 'EMPHASIZE'.
      IF ( syst-subrc = 0 ).
        DELETE gt_fcat INDEX syst-tabix.
      ENDIF.
      ls_fcat-fieldname = 'BUTTON4'.
      ls_fcat-icon    = 'X'.
      ls_fcat-hotspot = 'X'.
      INSERT ls_fcat INTO gt_fcat INDEX 4.
      ls_fcat-fieldname = 'BUTTON3'.
      INSERT ls_fcat INTO gt_fcat INDEX 4.
      ls_fcat-fieldname = 'BUTTON2'.
      INSERT ls_fcat INTO gt_fcat INDEX 4.
      ls_fcat-fieldname = 'BUTTON1'.
      INSERT ls_fcat INTO gt_fcat INDEX 4.
      LOOP AT gt_fcat INTO ls_fcat.
        ls_fcat-col_pos = syst-tabix.
        MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
      ENDLOOP.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  SELECT_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM select_data .
    * define local data
      DATA:
        ls_sflight    TYPE ty_s_sflight.
      SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE gt_sflight.
      ls_sflight-button1 = icon_wd_radio_button.
      ls_sflight-button2 = icon_wd_radio_button_empty.
      ls_sflight-button3 = icon_wd_radio_button_empty.
      ls_sflight-button4 = icon_wd_radio_button_empty.
      MODIFY gt_sflight FROM ls_sflight
          TRANSPORTING button1 button2 button3 button4
        WHERE ( carrid IS NOT INITIAL ).
    ENDFORM.                    " SELECT_DATA
    Regards
    Uwe

  • ALV GRID DISPLAY USING FACTORY METHODS

    Hi all
    I am using factory methods for my alv grid display.
    I have a list of functionalities, for which i am not able to find a correct method..
    1) Header of alv(with all the values of the selection-screen)
    2)How to give text to a subtotal(ed) column, i.e. if i subtotal a qty field against a sorted field, i want to display ==> Nett Wt. = 123.00 (for first header entry) and so on for each header entry.
    3)how to remove the zeroes from a quantity field?
    4) Displaying the cells as blanks where data is 0( for quantity fields if i have a cell with zero value, it should be blank.)
    5) double click on a cell to open a transaction with the cell's value.
    Any help on this would be appreciated.
    Points will be rewarded for sure...
    Thanks & Regards
    Ravish Garg

    Hello Ravish
    Regarding the display of zero values as empty cells have a look at my <i>modified </i>sample report <b>ZUS_SDN_CL_SALV_TABLE_INTERACT</b>.
    *& Report  ZUS_SDN_CL_SALV_TABLE_INTERACT
    REPORT  zus_sdn_cl_salv_table_interact.
    TYPE-POOLS: abap.
    DATA:
      gt_knb1        TYPE STANDARD TABLE OF knb1.
    DATA:
      go_table       TYPE REF TO cl_salv_table,
      go_events      TYPE REF TO cl_salv_events_table.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_double_click FOR EVENT
              if_salv_events_actions_table~double_click
              OF cl_salv_events_table
              IMPORTING
                row
                column.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_double_click.
    *   define local data
        DATA:
          lo_table   TYPE REF TO cl_salv_table,
          lt_orders  TYPE STANDARD TABLE OF bapiorders,
          ls_knb1    TYPE knb1.
        READ TABLE gt_knb1 INTO ls_knb1 INDEX row.
        IF ( syst-subrc = 0 ).
          CALL FUNCTION 'BAPI_SALESORDER_GETLIST'
            EXPORTING
              customer_number             = ls_knb1-kunnr
              sales_organization          = '1000'
    *         MATERIAL                    =
    *         DOCUMENT_DATE               =
    *         DOCUMENT_DATE_TO            =
    *         PURCHASE_ORDER              =
    *         TRANSACTION_GROUP           = 0
    *         PURCHASE_ORDER_NUMBER       =
    *       IMPORTING
    *         RETURN                      =
            TABLES
              sales_orders                = lt_orders.
    *     Create ALV grid instance
          TRY.
              CALL METHOD cl_salv_table=>factory
    *        EXPORTING
    *          LIST_DISPLAY   = IF_SALV_C_BOOL_SAP=>FALSE
    *          R_CONTAINER    =
    *          CONTAINER_NAME =
                IMPORTING
                  r_salv_table   = lo_table
                CHANGING
                  t_table        = lt_orders.
            CATCH cx_salv_msg .
          ENDTRY.
          lo_table->display( ).
    **      SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
    **      SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
    **      CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDMETHOD.                    "handle_double_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT        * FROM  knb1 INTO TABLE gt_knb1
             WHERE  bukrs  = '1000'.
    * Create ALV grid instance
      TRY.
          CALL METHOD cl_salv_table=>factory
    *    EXPORTING
    *      LIST_DISPLAY   = IF_SALV_C_BOOL_SAP=>FALSE
    *      R_CONTAINER    =
    *      CONTAINER_NAME =
            IMPORTING
              r_salv_table   = go_table
            CHANGING
              t_table        = gt_knb1.
        CATCH cx_salv_msg .
      ENDTRY.
    * Create event instance
      go_events = go_table->get_event( ).
    * Set event handler
      SET HANDLER:
        lcl_eventhandler=>handle_double_click FOR go_events.
      PERFORM modify_columns.
      go_table->display( ).
    END-OF-SELECTION.
    *&      Form  MODIFY_COLUMNS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM modify_columns .
    * define local data
      DATA:
        lt_dfies        TYPE ddfields,
        ls_dfies        TYPE dfies,
        lo_typedescr    TYPE REF TO cl_abap_typedescr,
        lo_strucdescr   TYPE REF TO cl_abap_structdescr,
        lo_tabledescr   TYPE REF TO cl_abap_tabledescr,
        lo_columns      TYPE REF TO cl_salv_columns_table,
        lo_column       TYPE REF TO cl_salv_column.
      lo_columns = go_table->get_columns( ).
      lo_typedescr = cl_abap_typedescr=>describe_by_data( gt_knb1 ).
      lo_tabledescr ?= lo_typedescr.
      lo_strucdescr ?= lo_tabledescr->get_table_line_type( ).
      lt_dfies = lo_strucdescr->get_ddic_field_list( ).
      LOOP AT lt_dfies INTO ls_dfies.
        lo_column = lo_columns->get_column( ls_dfies-fieldname ).
        IF ( ls_dfies-keyflag = abap_true ).
          CONTINUE.
        ELSEIF ( ls_dfies-fieldname = 'WEBTR' ).  " Bill of ex. limit
          lo_column->set_zero( if_salv_c_bool_sap=>true ).   " display zero
          lo_column->set_zero( if_salv_c_bool_sap=>false ).  " hide zero
        ELSE.
          lo_column->set_technical( if_salv_c_bool_sap=>true ).  " hide col
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " MODIFY_COLUMNS
    Regards
      Uwe

  • ALV GRID Display function module giving Run time error

    Hello Experts,
    I have ALV report, In which I am using ALV grid dispaly FM to display the report.
    But when my out table which I am passing to FM is empty that time ALV grid display shows blank ALV report. but when out table is not empty that time  I am getting the Run time error, which shows message "Field symbol has not yet been assigned".
    Can any one please help me out in this.
    Thanks

    TYPES: BEGIN OF type_out,
            col00    TYPE   ytlet-rzzyyproduct,
            col01    TYPE   ytlet-kslvt,
            col02    TYPE   ytlet-kslvt,
            col03    TYPE   ytlet-kslvt,
            col04    TYPE   ytlet-kslvt,
            col05    TYPE   ytlet-kslvt,
            col06    TYPE   ytlet-kslvt,
            col07    TYPE   ytlet-kslvt,
            col08    TYPE   ytlet-kslvt,
            col09    TYPE   ytlet-kslvt,
            col10    TYPE   ytlet-kslvt,
            col11    TYPE   ytlet-kslvt,
            col12    TYPE   ytlet-kslvt,
            col13    TYPE   ytlet-kslvt,
            col14    TYPE   ytlet-kslvt,
            col15    TYPE   ytlet-kslvt,
            col16    TYPE   ytlet-kslvt,
            col17    TYPE   ytlet-kslvt,
            col18    TYPE   ytlet-kslvt,
            col19    TYPE   ytlet-kslvt,
            col20    TYPE   ytlet-kslvt,
            col21    TYPE   ytlet-kslvt,
            col22    TYPE   ytlet-kslvt,
            col23    TYPE   ytlet-kslvt,
            col24    TYPE   ytlet-kslvt,
            col25    TYPE   ytlet-kslvt,
            col26    TYPE   ytlet-kslvt,
            col27    TYPE   ytlet-kslvt,
            col28    TYPE   ytlet-kslvt,
            col29    TYPE   ytlet-kslvt,
            col30    TYPE   ytlet-kslvt,
            col31    TYPE   ytlet-kslvt,
            col32    TYPE   ytlet-kslvt,
            col33    TYPE   ytlet-kslvt,
            col34    TYPE   ytlet-kslvt,
            col35    TYPE   ytlet-kslvt,
            col36    TYPE   ytlet-kslvt,
            col37    TYPE   ytlet-kslvt,
            col38    TYPE   ytlet-kslvt,
            col39    TYPE   ytlet-kslvt,
            col40    TYPE   ytlet-kslvt,
            col41    TYPE   ytlet-kslvt,
            col42    TYPE   ytlet-kslvt,
            col43    TYPE   ytlet-kslvt,
            col44    TYPE   ytlet-kslvt,
          END OF type_out.
    DATA: t_fieldcat   TYPE slis_t_fieldcat_alv,   "Field catelog table
          w_fieldcat   TYPE slis_fieldcat_alv,     "Field catelog Work area
          w_layout     TYPE slis_layout_alv,       "Layout structure
          w_event      TYPE slis_alv_event,        "Event structure
          t_event      TYPE slis_t_event,          "Event structure
          t_sort       TYPE STANDARD TABLE OF slis_sortinfo_alv,
          t_callback_main_user_command  TYPE  slis_formname,
          v_selfield TYPE slis_selfield.
    FIELD-SYMBOLS: <ksl>.
    FORM DISPLAY_REPORT .
    *Prepare Field Catlog
      PERFORM  creat_field_catlog.
    *Set layout
      PERFORM  set_layout.
    *Get Event
      PERFORM get_event.
    *Display Report
      PERFORM display_alv_report.
    ENDFORM.                    " DISPLAY_REPORT
    FORM creat_field_catlog .
      PERFORM add_fields_catlog USING:
           '01'    'RZZYYPRODUCT'     'IT_OUT'    'MPMs' ' ',
           '02'    'KSLVT'     'IT_OUT'    'License Fee' ' ',
           '03'    'KSLVT'     'IT_OUT'    'Ad Sales' ' ',
           '04'    'KSLVT'     'IT_OUT'    'Promo Fees' ' ',
           '05'    'KSLVT'     'IT_OUT'    'Total Ad Sales/Promo' ' ',
           '06'    'KSLVT'     'IT_OUT'    'Other' ' ',
           '07'    'KSLVT'     'IT_OUT'    'Total' ' ',
           '08'    'KSLVT'     'IT_OUT'    'Dom Station' ' ',
           '09'    'KSLVT'     'IT_OUT'    'Basic Cable/Free VOD' ' ',
           '10'    'KSLVT'     'IT_OUT'    'License Fee' ' ',
           '11'    'KSLVT'     'IT_OUT'    'Ad Sales (incl Internet)' ' ',
           '12'    'KSLVT'     'IT_OUT'    'Promo Fees' ' ',
           '13'    'KSLVT'     'IT_OUT'    'Ad Sales & Promo Fees' ' ',
           '14'    'KSLVT'     'IT_OUT'    'Foreign' ' ',
           '15'    'KSLVT'     'IT_OUT'    'Pay TV' ' ',
           '16'    'KSLVT'     'IT_OUT'    'Other' ' ',
           '17'    'KSLVT'     'IT_OUT'    'Total' ' ',
           '18'    'KSLVT'     'IT_OUT'    'Home Entertainment' ' ',
           '19'    'KSLVT'     'IT_OUT'    'SPTI' ' ',
           '20'    'KSLVT'     'IT_OUT'    'All Other Divisions' ' ',
           '21'    'KSLVT'     'IT_OUT'    'Total' ' ',
           '22'    'KSLVT'     'IT_OUT'    'Total Revenue' ' ',
           '23'    'KSLVT'     'IT_OUT'  'PV Net Down & Producers Share' '',
           '24'    'KSLVT'     'IT_OUT'    'Total Net Revenue' ' ',
           '25'    'KSLVT'     'IT_OUT'    'Development Expense' ' ',
           '26'    'KSLVT'     'IT_OUT'    'SOP Deficits' ' ',
           '27'    'KSLVT'     'IT_OUT'    'Amortization' ' ',
           '28'    'KSLVT'     'IT_OUT'    'Other COS ' ' ',
           '29'    'KSLVT'     'IT_OUT'    'Total COS' ' ',
           '30'    'KSLVT'     'IT_OUT'    'Profit Before Releasing' ' ',
           '31'    'KSLVT'     'IT_OUT'    'Gross Profit %' ' ',
           '32'    'KSLVT'     'IT_OUT'    'SPT' ' ',
           '33'    'KSLVT'     'IT_OUT'    'Home Entertainment' ' ',
           '34'    'KSLVT'     'IT_OUT'    'SPTI' ' ',
           '35'    'KSLVT'     'IT_OUT'    'All Other Divisions' ' ',
           '36'    'KSLVT'     'IT_OUT'    'Other' ' ',
           '37'    'KSLVT'     'IT_OUT'    'Total' ' ',
           '38'    'KSLVT'     'IT_OUT'    'Gross Profit' ' ',
           '39'    'KSLVT'     'IT_OUT'    'SPT' ' ',
           '40'    'KSLVT'     'IT_OUT'    'Home Entertainment' ' ',
           '41'    'KSLVT'     'IT_OUT'    'SPTI' ' ',
           '42'    'KSLVT'     'IT_OUT'    'All Other Divisions' ' ',
           '43'    'KSLVT'     'IT_OUT'    'Other' ' ',
           '44'    'KSLVT'     'IT_OUT'    'Total' ' ',
           '45'    'KSLVT'     'IT_OUT'    'Net Margin' ' '.
    ENDFORM.                    " CREAT_FIELD_CATLOG
    *&      Form  ADD_FIELDS_CATLOG
          Filling of field Catlog
    FORM add_fields_catlog  USING    p_colpos
                                     p_fildname
                                     p_tabname
                                     p_fildtext
                                     p_ndisplay.
      w_fieldcat-row_pos       = '1'.
      w_fieldcat-col_pos       = p_colpos.
      w_fieldcat-fieldname     = p_fildname.
      w_fieldcat-tabname       = p_tabname.
      w_fieldcat-reptext_ddic  = p_fildtext.
      w_fieldcat-no_out        = p_ndisplay.
      APPEND w_fieldcat TO t_fieldcat.
      CLEAR: w_fieldcat.
    ENDFORM.                    " ADD_FIELDS_CATLOG
    *&      Form  SET_LAYOUT
          Set Layout
    FORM set_layout .
      w_layout-colwidth_optimize = 'X'.
    ENDFORM.                    " SET_LAYOUT
    *&      Form  GET_EVENT
          text
    FORM get_event .
      w_event-name = 'TOP-OF-PAGE'.
      w_event-form = 'F_TOP-OF_PAGE'.
      APPEND w_event TO t_event.
    ENDFORM.                    " GET_EVENT
    *&      Form  TOP-OF-PAGE
          Top of Page
    FORM top-of-page.
      DATA : t_list_commentry   TYPE slis_t_listheader,
               w_header           TYPE slis_listheader,
               lv_text(90)        TYPE c,
               l_text(90)         TYPE c,
               lv_rundate(10)     TYPE c,
               lv_runtime(10)     TYPE c.
      CONSTANTS: c_space(2) TYPE c VALUE '  ',
                 c_space2(6) TYPE c VALUE '      '.
      w_header-typ  = 'S'.
      w_header-key  = 'Program:'.
      w_header-info = sy-repid.
      APPEND w_header TO t_list_commentry.
      WRITE: sy-datum TO lv_rundate MM/DD/YYYY.
      WRITE: sy-uzeit TO lv_runtime USING EDIT MASK '__:__:__'.
    CLEAR w_header.
    w_header-typ  = 'S'.
    w_header-key  = text-021.
    w_header-info = lv_rundate.
    APPEND w_header TO t_list_commentry.
      CLEAR: w_header.
      w_header-typ  = 'S'.
      w_header-key  = 'User Id'.
      w_header-info = sy-uname.
      APPEND w_header TO t_list_commentry.
      CLEAR: w_header.
      w_header-typ  = 'S'.
      w_header-key  = 'Run Date'.
      w_header-info = lv_rundate.
      APPEND w_header TO t_list_commentry.
      CLEAR: w_header.
      w_header-typ  = 'S'.
      w_header-key  = 'Run Time'.
      w_header-info = lv_runtime.
      APPEND w_header TO t_list_commentry.
      CLEAR: w_header.
      w_header-typ  = 'H'.
      w_header-key  = 'order'.
      w_header-info = 'MCR Report'.
      APPEND w_header TO t_list_commentry.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = t_list_commentry.
    ENDFORM.                    "TOP-OF-PAGE
    FORM display_alv_report .
      CONSTANTS : gc_save TYPE c VALUE 'A'. "Save Layout
    t_callback_main_user_command  = c_user_command.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = sy-repid
      I_CALLBACK_PF_STATUS_SET          = ' '
        i_callback_user_command           = t_callback_main_user_command
         i_callback_top_of_page            = 'TOP-OF-PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
         is_layout                         = w_layout
         it_fieldcat                       = t_fieldcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
         i_save                            = gc_save
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = it_out
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
       ENDIF.

  • Displaying page number in ALV grid display

    Hi,
    Is it possible to display page number in an ALV grid display?
    If yes, how?
    I tried it in top of page event, but it didnt work.
    Harmeet.

    hi,
    check out the sample code....
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program          = sy-repid
            i_callback_user_command     = 'F00007_USER_COMMAND'
            i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
            it_fieldcat                 = g_t_fieldcat[]
            it_events                   = gt_events[]
            i_save                      = 'A'
          TABLES
            t_outtab                    = g_t_final_report[]
          EXCEPTIONS
            program_error               = 1
            OTHERS                      = 2.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
          FORM TOP_OF_PAGE                                              *
    FORM top_of_page.
    write : sy-pagno.
    ENDFORM.                    "top_of_page
    Reward Appropriate points.
    Regards,
    Mansi.

  • Drill down capabilities for an alv grid display field using oops concept

    Hi All,
    could anyone help me in how to achieve the drill down capabilities for an alv grid display field using oops concept.
    Thanks & Regards,
    padmasri.

    padmasri,
    Hope your requirement is something like, when you click on a sales order number it should display that order (VA03), in a grid output displayed using set_table_for_first_display.
    you can acheive it using event double click.
    *&            L O C A L  C L A S S E S   -   D E F I N I T O N         *
    class lcl_event_receiver: local class to handle event DOUBLE_CLICK
    CLASS LCL_EVENT_RECEIVER DEFINITION.
      PUBLIC SECTION.
        METHODS:
        HANDLE_DOUBLE_CLICK
            FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                IMPORTING E_ROW E_COLUMN.
      PRIVATE SECTION.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    *&    L O C A L  C L A S S E S   -   I M P L E M E N T A T I O N       *
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
      METHOD HANDLE_DOUBLE_CLICK.
        PERFORM HANDLE_DOUBLE_CLICK USING E_ROW
                                          E_COLUMN.
      ENDMETHOD.                           "handle_double_click
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    FORM HANDLE_DOUBLE_CLICK USING E_ROW    TYPE LVC_S_ROW
                                   E_COLUMN TYPE LVC_S_COL.
      DATA: LS_DETAIL LIKE LINE OF T_OUTPUT.
          WHEN 'T_OUTPUT'.
            READ TABLE T_OUTPUT   INDEX E_ROW-INDEX INTO LS_DETAIL.
    If clicked on PO Number or PO Item, call ME23
        IF E_COLUMN-FIELDNAME = 'EBELN' OR
           E_COLUMN-FIELDNAME = 'EBELP' .
          SET PARAMETER ID 'BES' FIELD LS_DETAIL-EBELN.
          SET PARAMETER ID 'BSP' FIELD LS_DETAIL-EBELP.
          CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
    If clicked on sales order number or item, call VA03
        ELSEIF E_COLUMN-FIELDNAME = 'VBELN' OR
               E_COLUMN-FIELDNAME = 'POSNR'.
          SET PARAMETER ID 'AUN' FIELD LS_DETAIL-VBELN.
          SET PARAMETER ID 'APO' FIELD LS_DETAIL-POSNR.
          CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    Hope this helps

  • Kindly help to develop alv grid display

    Hi ,
    I have a requirement in which I need to display ALV GRID display and in its tool bar 4 butons are required. In the same view down to alv display i want to develop a tabstrip and its functionalities.I have designed classic alv using SALV_WD_TABLE component. I want a good GRID Display, not like flat field names that comes in list display, looking for bulged fields(like what comes for ALV GRID in normal abap)  display with print version etc hidden and buttons at the top of ALV.  Kindly help
    Highly rewarded
    Kindly help
    Regards,
    Lakshmi
    Edited by: Lakshmi Menon on Nov 27, 2008 4:49 PM

    Well Web Dynpro is generally output in HTML so the output formatting is never going to quite look like a desktop application (which is the case with the ALV Grid).  You have very little control over the look of the column headers.  In fact you can only manipulate what is available via the Portal Theme. 
    There is a new Tradeshow Plus theme available in NetWeaver 7.01 which uses a gradiant background for the column headers.  This gives them a little more depth:
    http://www.flickr.com/photos/tjung/3068850120/
    The other option is next year when NetWeaver Business Client version 3.0 comes out, you will be able to render Web Dynpro applications using the NWBC Smart Client Rendering.  This will render Web Dynpro applications using desktop libraries instead of HTML/Browser. This gives Web Dynpro a more SAPGUI/Desktop appears of course.
    http://www.flickr.com/photos/tjung/2685619882/in/set-72157606418550143/

  • Folder in alv grid display report

    Hi Experts,
    I have a requirement  to generate the folder in alv grid display, to display the multiple line items where ever we have.
    Actually I am displaying the material details and production order details.
    If the material is having the multiple production order details , in that case we need to place all the production order details in one folder, and if you open that folder arrow, we have to display the production order details.
    I am using REUSE_ALV_GRID_DISPLAY function module to develope this application. Here Hierseq list is recommended to use for this application, why because folder option is already available in grid display. that we can observe in CL6AN. 
    Is it possible to implement it through function modules or through OOABAP.
    Actually, I have to generate the report which we can see in CL6AN Transaction code,,
    Your valuable suggestions surely will attract the benifits.
    Thanks in advance.
    Ramesh.

    Hi ramesh,
    Hierseq list is not supported in the grid display. You could do this using an OO tree display but this could be rather complicated. What about displaying one field per material line with the number of production orders. At double-click on that field, open a second grid display (possibly as popup) to show the production order details.
    Regards,
    Clemens

Maybe you are looking for

  • Pl/sql table - row type records

    Hi, Is there any limit on the number of records that a pl/sql table (row type) can accomodate.Iam using oracle 10g

  • Weird error while booting up...

    does anyone know what this means? system failure: cpu=d; code=00000008 (unaligned stace) --update i just got another error... System failure: cpu=0; Code=00000001 (corrupt stack) Latest crash info for cpu 0: Exeption state (sv=0x1D433C80) PC=0x000ABD

  • FM import into RH project creates a separate folder for every FM chapter

    I am importing a FM book into RH 9 to create a new help project.   RH creates a separate folder for every FM chapter!  The folder contains the html and CSS.  This is messy and useless since all html will point to a single help CSS for the project.  I

  • RSTCC_ACTIVATE_ADMIN_COCKPIT ( BI Admin Cockpit ,Tech content, BI statisti)

    Hi Every One, I'm trying to install the BI technical content for 7.0.( Main Aim is for BI Statisics) I followed the steps mentioned in the note 965386 and the official manual. When I run the activation in background the job is canceled after a while

  • Error connecting to MDM over Portal

    Hi! I have some difficulities with connecting to MDM repository over Portal. I have a working Java project, which connects to the repositroy and executes a search without error. I developed a WD type DC where I want to use the previous Java program.