Overriding standard functions in alv

Hi all,
I want to over ride " append row funtionality in alv grid.
I am calling the grid in a custom container.
I used the following code
  METHODS HANDLE_BEFORE_USER_COMMAND
    FOR EVENT BEFORE_USER_COMMAND OF CL_GUI_ALV_GRID
    IMPORTING E_UCOMM.
  METHOD HANDLE_BEFORE_USER_COMMAND.
  PERFORM HANDLE_BEFORE_USER_COMMAND USING E_UCOMM.
  ENDMETHOD.
WHEN CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
call screen 200.
CALL METHOD GO_GRID->SET_USER_COMMAND
  EXPORTING
    I_UCOMM = SPACE
Instead of CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW,
i tried using &local&append also.
But it is not overriding.
But when i do the same codingto overide DETAIL functionality, it is working.
please can any body suggest me what should i do to override "append row".
Thanks in advance
Regards
Hyma

FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
* Only allow to change data not to create new entries (exclude
* generic functions).
  DATA LS_EXCLUDE TYPE UI_FUNC.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
<b>  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.</b>
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
remove the append from alv tool bar and add your own append(icon) to tool bar and handle that..
*       CLASS lcl_event_handler DEFINITION for second screen
CLASS LCL_EVENT_HANDLER1 DEFINITION .
  PUBLIC SECTION .
    METHODS:
**User Command Handler
    HANDLE_USER_COMMAND FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
                                 IMPORTING E_UCOMM,
    HANDLE_TOOLBAR
        FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
            IMPORTING E_OBJECT E_INTERACTIVE.
ENDCLASS.                    "lcl_event_handler1 DEFINITION
*       CLASS lcl_event_handler1 IMPLEMENTATION
CLASS LCL_EVENT_HANDLER1 IMPLEMENTATION.
*Handle User Command
  METHOD HANDLE_USER_COMMAND.
    PERFORM EVENT_UCOMM1 USING E_UCOMM.
  ENDMETHOD.                    "user_command
  METHOD HANDLE_TOOLBAR.
    DATA: LS_TOOLBAR  TYPE STB_BUTTON.
* append a separator to normal toolbar
    CLEAR LS_TOOLBAR.
    MOVE 3 TO LS_TOOLBAR-BUTN_TYPE.
    APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
* append SAVE icon
    CLEAR LS_TOOLBAR.
    MOVE 'APPEND' TO LS_TOOLBAR-FUNCTION.
    MOVE ICON_SYSTEM_APPEND TO LS_TOOLBAR-ICON.
    MOVE 'APPEND' TO LS_TOOLBAR-QUICKINFO.
    MOVE ' APPEND  '  TO LS_TOOLBAR-TEXT.
    MOVE ' '  TO LS_TOOLBAR-DISABLED.
    APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
    CLEAR LS_TOOLBAR.
  ENDMETHOD.                    "handle_toolbar
ENDCLASS.                    "lcl_event_handler1 IMPLEMENTATION
then handle the sy-ucomm of appen row...
hope this is what you want
vijay
Message was edited by: Vijay Babu Dudla

Similar Messages

  • Override Existing functionality in OO ALV

    Hi
    Can any one give me the procedure to override the standard functionality associcate with the buttons in ALV Toolbar.
    I am not able debug the when the user perfroms action on the Standard ALV toolbar. Can you help me
    Thanks all.

    Check sample program BCALV_EDIT_05. You need to create a local class to handle user actions. By this way you can assign different functionality to an existing key or ad new keys with required functionality.

  • Alv status standard function codes

    Hello,
    I have developed an not OO ALV.
    I want to put the sort standard button. Does anybody know the function code i have to put in the status?
    Thanks

    Hi,
    Goto SE41, create a pf-status for your alv report program.
    On the next screen, click menu EXTRAS --> click option ADJUST TEMPLATES and select radiobutton LIST VIEWER --> you will get all standard buttons of alv in the pf-status.
    Delete the unwanted buttons and also you can add new buttons if reqd.
    Activate pf-status --> and apply in alv program.
    Hope this helps you.
    Regards,
    Tarun

  • "Control + F5"  standard filter functionality for ALV Grids

    Hi all,
    After an ALV Grid is displayed on screen there is a standard functionality to filter a selected column.
    You can select a column (click on the head) of the ALV, then "Control + F5" and a pop-up appears to insert a value or a range by which the filtration is going to be done.
    But a I have problem with a concrete field. It doesn`t seem different on comparison with other fields (CHAR30), but I don`t know why it doesn`t work correctly as others.
    Have you had any situation like this ??
    Thanks & sorry for my bad english,
    Rubè

    Hi Frank,
    When you are entering  89012  and pressing enter the additional zeros are adding up because of the data type of VBELN We have standard conversion routine attached with this .So when ever u wrtie any text that routine will works.
    Can you please check what data type are you using in the internal table that you are binding  to the node?
    Thanks and Regards,
    NSingh
    Edited by: Nsingh on Feb 17, 2012 4:52 AM

  • ALV: Context Menu: Standard Functions: Copy to clipboard: How to throw?

    How can I throw the standard function "copy to clipboard"
    CL_GUI_ALV_GRID=>MC_FC_LOC_COPY <&LOCAL&COPY>
    If I try to throw it with the method
    <ref to cl_gui_alv_grid>->set_user_command(
    EXPORTING i_ucomm = cl_gui_alv_grid=>mc_fc_loc_copy )
    , it doesn't work.
    This standard function is a feature of every context menu of an ALV grid control.
    It is possible to inactivate it via the method
    <ref to cl_gui_alv_grid>->disable_functions
    , so it must be the right function code.
    I visited that the "application server is working"-logo
    (the blue waving-water-picture in the upper right corner of
    every SAP GUI window) doesn't move if I use this function via
    context menu.
    So possibly there is no server-turn-around between the
    presentation server an the application server when using this
    function. The application server only catches an event
    cl_gui_alv_grid_base=>evt_copy_clipboard_failed <34>
    on copy malfunction.

    Hi,
    there is a simple method to put something to the clipboad. I have done it a couple of times and it works fine.
    Data Definitions:
    DATA: BEGIN OF clippboard OCCURS 0,
            line(172) TYPE c,
          END OF clippboard.
    cnt1 type i.
    ABAP Example:
              refresh clippboard.
              append xx_outtab_pos-prodh to clippboard.
              CALL METHOD cl_gui_frontend_services=>clipboard_export
                IMPORTING
                  data = clippboard[]
                CHANGING
                  rc   = cnt1.
    In this example the content of the field xx_outtab_pos-prodh has been put to the clipborad and can be inserted anywhere by pressing Ctrl/V.
    If you want to restore it from the clipboard, there is a m
    ethod called cl_gui_frontend_services=>clipboard_import. It works the same as the clipboard_export.
    Best regards
    Peter

  • In Standard Report Of ALV How Can Set PF Status.

    In Standard Report Of ALV How Can Set PF Status.
    Thanking in anticipation.

    in the call function module, you pass the PF status parameter.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program       = pgm
       <i> <u>  i_callback_pf_status_set = 'SET_PF_STATUS'</u></i>
          it_fieldcat              = fieldcat
          is_variant               = disvariant
          is_layout                = layout
          is_print                 = print
          i_save                   = 'A'
          it_events                = eventcat
          it_sort                  = sortcat
          i_callback_user_command  = 'USER_COMMAND'
        TABLES
          t_outtab                 = a_output
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
    ENDFORM.                    "LIST_DISPLAY
    FORM SET_PF_STATUS *
    FORM set_pf_status USING extab TYPE slis_t_extab.
      SET PF-STATUS 'ZZSTD'.
    ENDFORM.                    "set_pf_status
    Here double Click on ZZSTD. IT will take you to a different screen and you have to set it.
    Ster.

  • How to use Standard Text in ALV

    How to use Standard Text in ALV header part? Can you please help me by giving the answer?

    Hi ,
           You can read the Standard text using read_text function module and then print in LV header part.

  • Hotspot-clicking (Insert function) plus ALV Sorting

    Hi,
    I have a requirement where the ALV display has to be SORTED based on values entered/changed on a certain column. The sort works ok when used with a custom APPEND button for new records (always inserted at the bottom of the list).
    However, it does not work correctly when used with the Hotspot-click (INSERT functionality). It looks like if you CLICK on a particular record onscreen, you are actually addressing the original record in that position before the SORT was effected. 
    Is the Hotspot-clicking (Insert functionality) possible with ALV sorting? The ideal solution would be to have the ALV sorted at PBO and also at PAI so that the user can change existing records and add new ones with the sorting being updated everytime ON_DATA_CHANGED is triggered.
    Will appreciate any help on this.
    Thanks!
    Michael

    Hello Michael
    Thanks for further specifying your requirements. I have created the sample variant ZUS_SDN_ALVGRID_HOTSPOT_SORT_1 which contains two differences as compared to its template:
    Replace table VBAK with VBAP (so we have two levels of sorting: VBELN, POSNR)
    Move SET_TABLE_FOR_FIRST_DISPLAY method call into PBO
    When I click on the hotspot (VBELN) a new row entry for the order number is created. The sorting (VBELN, POSNR) is kept even though the new row has been appended to the itab.
    *& Report  ZUS_SDN_ALVGRID_HOTSPOT_SORT
    *& Thread: Hotspot-clicking (Insert function) plus ALV Sorting
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1159431"></a>
    REPORT  zus_sdn_alvgrid_hotspot_sort.
    TYPES: BEGIN OF ty_s_outtab.
    INCLUDE TYPE vbap.
    TYPES: END OF ty_s_outtab.
    TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                          WITH DEFAULT KEY.
    DATA: gt_outtab    TYPE ty_t_outtab.
    DATA:
      gd_okcode        TYPE ui_func,
      gd_repid         TYPE syrepid,
      gt_sort          TYPE lvc_t_sort,
      gt_fcat          TYPE lvc_t_fcat,
      gs_layout        TYPE lvc_s_layo,
      gs_variant       TYPE disvariant,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_grid          TYPE REF TO cl_gui_alv_grid.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-DATA:
          ms_sel_row    TYPE lvc_s_row. " selected row
        CLASS-METHODS:
          handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
            IMPORTING
              er_data_changed
              e_onf4
              e_onf4_before
              e_onf4_after
              sender,
          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_data_changed.
        FIELD-SYMBOLS: <lt_outtab>  TYPE ty_t_outtab.
        BREAK-POINT.
      ENDMETHOD.                    "handle_data_changed
      METHOD handle_hotspot_click.
        " define local data
        DATA: ls_outtab    TYPE ty_s_outtab,
              ld_msg        TYPE bapi_msg.
        BREAK-POINT.
        CLEAR: lcl_eventhandler=>ms_sel_row.
        ms_sel_row = e_row_id.
        READ TABLE gt_outtab INTO ls_outtab INDEX e_row_id-index.
        CONCATENATE 'Selected Sales Order = ' ls_outtab-vbeln ' / '
                                              ls_outtab-posnr
          INTO ld_msg.
          message i398(00) with ld_msg.
        " Trigger PAI
        CALL METHOD cl_gui_cfw=>set_new_ok_code
          EXPORTING
            new_code = 'INSERT'
    *      IMPORTING
    *        rc       =
      ENDMETHOD.                    "handle_hotspot_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    PARAMETERS:
      p_vkorg      TYPE vkorg  DEFAULT '0001'  OBLIGATORY.
    START-OF-SELECTION.
    **  SELECT  * FROM  vbak INTO CORRESPONDING FIELDS OF TABLE gt_outtab
    **    UP TO 200 ROWS
    **         WHERE  vkorg = p_vkorg.
      SELECT * FROM vbap INTO CORRESPONDING FIELDS OF TABLE gt_outtab
        UP TO 100 ROWS.
      PERFORM init_controls.
    * Build fieldcatalog and set hotspot for field KUNNR
      PERFORM build_fieldcatalog.
      PERFORM set_layout_and_variant.
      PERFORM set_sorting.
      " Register EDIT event
      CALL METHOD go_grid->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>mc_evt_enter
        EXCEPTIONS
          error      = 1
          OTHERS     = 2.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      SET HANDLER:
        lcl_eventhandler=>handle_data_changed  FOR go_grid,
        lcl_eventhandler=>handle_hotspot_click FOR go_grid.
    * Link the docking container to the target dynpro
      gd_repid = syst-repid.
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = gd_repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * ok-code field = GD_OKCODE
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    * Display data
      CALL METHOD go_grid->set_table_for_first_display
        EXPORTING
          i_bypassing_buffer            = abap_true
          is_variant                    = gs_variant
          i_save                        = 'A'
    *      i_default                     = 'X'
          is_layout                     = gs_layout
    *      is_print                      =
    *      it_special_groups             =
    *      it_toolbar_excluding          =
    *      it_hyperlink                  =
    *      it_alv_graphics               =
    *      it_except_qinfo               =
    *      ir_salv_adapter               =
        CHANGING
          it_outtab                     = gt_outtab
          it_fieldcatalog               = gt_fcat
          it_sort                       = gt_sort
    *      it_filter                     =
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    **  CALL METHOD go_grid->refresh_table_display
    ***        EXPORTING
    ***          IS_STABLE      =
    ***          I_SOFT_REFRESH =
    **    EXCEPTIONS
    **      finished       = 1
    **      OTHERS         = 2.
    **  IF sy-subrc ne 0.
    ***       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    ***                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    **  ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'EXIT'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN 'INSERT'.
          PERFORM insert_row.
        WHEN OTHERS.
          " Check for changed data at the frontend (= grid control)
          CALL METHOD go_grid->check_changed_data( ).
      ENDCASE.
      CALL METHOD go_grid->refresh_table_display
    *    EXPORTING
    *      IS_STABLE      =
    *      I_SOFT_REFRESH =
        EXCEPTIONS
          finished       = 1
          OTHERS         = 2.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  INIT_CONTROLS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM init_controls .
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent = cl_gui_container=>screen0
          ratio  = 90
        EXCEPTIONS
          others = 6.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL METHOD go_docking->set_extension
        EXPORTING
          extension  = 99999
        EXCEPTIONS
          cntl_error = 1
          OTHERS     = 2.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Create ALV grid
      CREATE OBJECT go_grid
        EXPORTING
          i_parent = go_docking
        EXCEPTIONS
          others   = 5.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " INIT_CONTROLS
    *&      Form  BUILD_FIELDCATALOG
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog.
    * define local data
      DATA:
        ls_fcat        TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'VBAP'  " 'VBAK'
    *     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 NE 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    **  LOOP AT gt_fcat INTO ls_fcat.
    **    CASE ls_fcat-fieldname.
    **      WHEN 'VBELN'  OR
    **           'ERDAT'  OR
    **           'ERZET'  OR
    **           'ERNAM'  OR
    **           'AUART'  OR
    **           'NETWR'  OR
    **           'WAERK'.
    **        CONTINUE.
    **      WHEN OTHERS.
    **        ls_fcat-no_out = abap_true.
    **    ENDCASE.
    **    MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
    **  ENDLOOP.
    * Only non-key fields are editable
    **  ls_fcat-edit = 'X'.
    **  MODIFY gt_fcat FROM ls_fcat
    **    TRANSPORTING edit
    **    WHERE ( fieldname NE space ).
      ls_fcat-hotspot = abap_true.
      MODIFY gt_fcat FROM ls_fcat
        TRANSPORTING hotspot
        WHERE ( fieldname = 'AUART'   OR
                fieldname = 'VBELN' ).
    **  DELETE gt_fcat FROM 15 TO 99.
    ENDFORM.                    " BUILD_FIELDCATALOG_KNB1
    *&      Form  SET_LAYOUT_AND_VARIANT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM set_layout_and_variant .
      CLEAR: gs_layout,
             gs_variant.
      gs_layout-cwidth_opt = abap_true.
      gs_variant-report = syst-repid.
      gs_variant-handle = 'GRID'.
    ENDFORM.                    " SET_LAYOUT_AND_VARIANT
    *&      Form  SET_SORTING
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM set_sorting .
    * define local data
      DATA: ls_sort   TYPE lvc_s_sort.
      REFRESH: gt_sort.
      CLEAR: ls_sort.
      ls_sort-spos = 1.
      ls_sort-fieldname = 'VBELN'.
      ls_sort-up = abap_true.
      APPEND ls_sort TO gt_sort.
      CLEAR: ls_sort.
      ls_sort-spos = 1.
      ls_sort-fieldname = 'POSNR'.
      ls_sort-up = abap_true.
      APPEND ls_sort TO gt_sort.
    ENDFORM.                    " SET_SORTING
    *&      Form  INSERT_ROW
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM insert_row .
    * define local data
      DATA: ls_outtab   TYPE ty_s_outtab,
            ld_order    TYPE vbeln.
      READ TABLE gt_outtab INTO ls_outtab
                           INDEX lcl_eventhandler=>ms_sel_row-index.
      ld_order = ls_outtab-vbeln.
      " Find last item of sales order
      LOOP AT gt_outtab INTO ls_outtab
                        WHERE ( vbeln = ld_order ).
      ENDLOOP.
      " Create next item:
      add 10 to ls_outtab-posnr.
      " NOTE: added at the end of the list
      APPEND ls_outtab TO gt_outtab.
      " NOTE: insert new row AFTER selected row => works, too
    **  INSERT ls_outtab INTO gt_outtab
    **                   INDEX lcl_eventhandler=>ms_sel_row-index.
    ENDFORM.                    " INSERT_ROW

  • ADD_CHOICE to standard BUTTON_CHOICE in ALV Toolbar

    Hello Experts,
    I want to add additional choice to a standard Button_Choice in the ALV Toolbar.
    I was able to get reference of the standard function (of type cl_salv_wd_function_std). However, to solve my purpose I would need the reference of the UI Element Button_Choice (perhaps of type CL_SALV_WD_FE_A_BUTTON_CHOICE) so that I can ADD_CHOICE.
    Thanks and best regards,
    Abir

    Hi Abir,
    For button choice help please refer this..
    About cl_salv_wd_fe_button_choice........
    Re: Help on Button Choice of alv tool bar
    Cheers..
    Kris.
    Edited by: kissnas on Feb 23, 2011 2:03 PM

  • Disable some standard buttons from ALV display

    Hello All,
    I am creating an ALV display using object oriented approach. I know how to exclude some of the standard function buttons from the list.
    But suppose instead of deleting, the requirement is to disable (I mean grayed out)
    some standard buttons from ALV. Could anyone please comment on how to do this.
    Many thanks in advance.
    Regards
    Indrajit

    Hello Indrajit
    The following sample reports shows how to disable toolbar functions. Run the report and the push the ENTER button repeatedly.
    *& Report  ZUS_SDN_ALV_EVT_TOOLBAR
    *& This sample report explains the handling of event TOOLBAR in order
    *% to activate or inactive buttons of the ALV toolbar.
    *& Based on: BCALV_GRID_DEMO
    *& Procedure: Copy BCALV_GRID_DEMO and replace entire coding  OR
                copy screen '0100' and GUI status 'MAIN100' from
                BCALV_GRID_DEMO to this report.
    REPORT  zus_sdn_alv_evt_toolbar.
    TYPE-POOLS: abap, cntb, icon.
    DATA:
      ok_code                TYPE ui_func,
      gt_sflight             TYPE TABLE OF sflight,
      g_container        TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
      g_grid1               TYPE REF TO cl_gui_alv_grid,
      g_custom_container    TYPE REF TO cl_gui_custom_container.
    PARAMETERS:
      p_inact    RADIOBUTTON GROUP grp1  DEFAULT 'X',  " delete buttons
      p_dele     RADIOBUTTON GROUP grp1.               " inactivate buttons
    PARAMETERS:
      p_newbut   AS CHECKBOX  DEFAULT ' ',  " add new button
      p_newddm   AS CHECKBOX  DEFAULT 'X'.  " add dropdown menu
          CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-DATA:
          md_cnt    TYPE i.
        CLASS-METHODS:
          handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
            IMPORTING
              e_object
              e_interactive
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
          CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_toolbar.
    § 2.In event handler method for event TOOLBAR: Append own functions
      by using event parameter E_OBJECT.
        DATA:
          ls_toolbar  TYPE stb_button,
          ls_menu     type STB_BTNMNU.
    E_OBJECT of event TOOLBAR is of type REF TO CL_ALV_EVENT_TOOLBAR_SET.
    This class has got one attribute, namly MT_TOOLBAR, which
    is a table of type TTB_BUTTON. One line of this table is
    defined by the Structure STB_BUTTON (see data deklaration above).
    A remark to the flag E_INTERACTIVE:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            'e_interactive' is set, if this event is raised due to
            the call of 'set_toolbar_interactive' by the user.
            You can distinguish this way if the event was raised
            by yourself or by ALV
            (e.g. in method 'refresh_table_display').
            An application of this feature is still unknown...
        ADD 1 TO md_cnt. " a simple counter
      (1.a) Inactivate toolbar buttons
        IF ( p_inact = abap_true ).
          LOOP AT e_object->mt_toolbar INTO ls_toolbar FROM 1 TO md_cnt.
            ls_toolbar-disabled = 'X'.
            MODIFY e_object->mt_toolbar FROM ls_toolbar.
          ENDLOOP.
      (1.b) Delete toolbar buttons
        ELSE.
          DO md_cnt TIMES.
            DELETE e_object->mt_toolbar INDEX 1.
          ENDDO.
        ENDIF.
      (2) Add new button
        IF ( p_newbut = abap_true ).
        Add separator to separate default and new buttons
          CLEAR: ls_toolbar.
          ls_toolbar-butn_type = cntb_btype_sep.  " separator
          APPEND ls_toolbar TO e_object->mt_toolbar.
        Add new button "DETAIL"
          CLEAR: ls_toolbar.
          ls_toolbar-function  = 'DETAIL'.
          ls_toolbar-icon      = icon_detail.
          ls_toolbar-quickinfo = 'QuickInfo'.
          ls_toolbar-butn_type = cntb_btype_button.
          ls_toolbar-disabled  = abap_false.
          ls_toolbar-text      = 'Details'.
         ls_toolbar-checked = ' '.
          APPEND ls_toolbar TO e_object->mt_toolbar.
        ENDIF.
      (3) Add new dropdown menu
        IF ( p_newddm = abap_true ).
        Add separator to separate default and new buttons
          CLEAR: ls_toolbar.
          ls_toolbar-butn_type = cntb_btype_sep.  " separator
          APPEND ls_toolbar TO e_object->mt_toolbar.
        Add new dropdown menu "DETAIL"
          CLEAR: ls_toolbar.
          ls_toolbar-function  = 'DDMENU'.
          ls_toolbar-icon      = icon_detail.
          ls_toolbar-quickinfo = 'QuickInfo'.
          ls_toolbar-butn_type = cntb_btype_dropdown.
          ls_toolbar-disabled  = abap_false.
          ls_toolbar-text      = 'DD-Menu'.
         ls_toolbar-checked = ' '.
          APPEND ls_toolbar TO e_object->mt_toolbar.
        ENDIF.
      ENDMETHOD.                    "handle_toolbar
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
          MAIN                                                          *
      SELECT * FROM sflight INTO TABLE gt_sflight.
      CALL SCREEN 100.
    END-OF-SELECTION.
          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.
      Instantiate ALV grid control
        CREATE OBJECT g_grid1
               EXPORTING i_parent = g_custom_container.
        CALL METHOD g_grid1->set_table_for_first_display
          EXPORTING
            i_structure_name = 'SFLIGHT'
          CHANGING
            it_outtab        = gt_sflight.
      Set event handler for event TOOLBAR
        SET HANDLER:
          lcl_eventhandler=>handle_toolbar FOR g_grid1.
      ENDIF.
    $Comment: Toolbar can be modified on-the-fly
      g_grid1->set_toolbar_interactive( ).
    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[/code]
    Regards
      Uwe

  • How can I call functionality of ALV Grid by event of button outside grid?

    Hello,
    How can I call functionality of ALV Grid by event of button located outside ALV Grid? For example how to fire printing of this ALV Grid by button click elsewhere on the screen (not in toolbar of ALV Grid).
    Best regards,
    Josef Motl

    hi Motl,
    these are steps to create a button in ALV and trigger an event from it..
    1.Use the parameter i_callback_pf_status_set in the function module REUSE_ALV_GRID_DISPLAY
    i_callback_program = gd_repid
    i_callback_pf_status_set = 'SET_PF_STATUS'
    form set_pf_status using rt_extab type slis_t_extab.
    set pf-status 'NEWALVSTATUS'.
    endform.
    You have to copy the standard ALV pf stauts to 'NEWALVSTATUS' and add your button.
    2.You have to do the following to process the new button click.
    i_callback_user_command = 'USER_COMMAND'
    form user_command using i_ucomm like sy-ucomm
    is_selfield type slis_selfield.
    case i_ucomm.
    3. to copy the standard pf status to a new one.go to the ALV screen and take the menu System -> Status.  Then look for the standard pf status. Copy this to Z range and then add your new button.
    reward points if helpful
    regards
    satesh

  • IF statement in Standard function module PRICING

    Hi,
    In standard function module PRICING
    I found one if statement like this.
    if  xkomv-kntyp na '1$' .
    Plz tell me the meaning of thai '1$' value.
    Regards,
    Upender Verma.

    Hi,
         NA means Contains Not Any ..
         if xkomv-kntyp na '1$'  means .. xkomv-kntyp does not contain '1' or '$'.
         Read help on comparision operator 'NA'
    Regards,
    Srini.

  • Implicit enhancement to a standard function module.

    Hi everybody.
    I used an Implicit Enhancement to a Standard function module Customized_Message, at the starting of function module.
    Code:
    ENHANCEMENT 1  ZFK01_ENHANCEMENT4.    "active version
    If sy-tcode = 'FK01' and sy-CPROG = 'SAPMF02K' AND I_MSGNR = '230' AND i_arbgb = 'F2' AND I_DTYPE = 'I'.
      EXIT.
    ENDIF.
    ENDENHANCEMENT.
    The above is working fine, to the condition what i had given above code.
    But my question is, can i use a implicit enchancement to a Standard function module(Customized_message).

    Yes, but you should also be aware that 'F2' is a configurable message class in the IMG.  You should attempt to solve your issue in that manner first.

  • Currency Translation at the Web Template level (standard functionality)

    Hi Experts ,
    We are currently working in BI 7.0 env. with source system ECC 5.0.
    We are working for a task where we need to make the BEx  queries enabled for currency translation .
    The requirement is :-
    The user should be enable to give/opt/choose for the follwoing options:-
    Currency type (target currency in which the translation is aimed)
    Exchange Rate ( Standard(M) or other(P) or something else) and
    Key date: The translation will be performed taking the exchange rate on that particular date.
    We do have 2 option to perform the task...
    1:- Either we do it thru currency translation type definition(RSCUR) and then attaching this currency translation for every amount key figure values at each query level. OR
    2:- If we can go and find something at the Web Template level and add/modify the template in such a way so that it gives us the functionality to translate a source currency into a desired one with desired exchange rate type (currently either M or P) and for a specific date.
    At this point of time when we do have numerous sub-areas holding hundreds of queries, we want something which should be available as the modification/addition to standard functionality at the web template level and not at the query level as changing each and every one of them and testing would be a cumbersome process and would be costly and risky at the same time. So we are just wondering if we can find something with option no. 2 and add/modify something in the standard functionality.
    Please ask for any more information required.
    Thanks very much.
    regds.

    Hi Amit,
    You would still need to define the Currency Translation using RSCUR where you would specify
    -the exchange rate type (either fixed or variable)
    -the target currency (either fixed or variable)
    -the reference date
    You don't need to modify any of your queries. You can instead use 'Translate Currency'/[SET_CURRENCY_TRANSLATION] command in WAD & specify the Currency Translation as defined in RSCUR. If you want the target currency & exchange rate type to be driven by user input, you can define these as variables in RSCUR & invoke the variable screen using 'OPEN_VARIABLE_DIALOG' in WAD for user input just before calling 'SET_CURRENCY_TRANSLATION' command.
    --Priya

  • How to call the 'DETAIL' function in ALV for a program?

    Dear Friends,
    I have a prf_tree (TYPE REF TO cl_gui_alv_tree), and I added below codes to add an new button for displaying the detail record, it works fine:
    CALL METHOD prf_toolbar->add_button
        EXPORTING
          fcode     = prf_tree->mc_fc_detail
          icon      = icon_detail
          butn_type = cntb_btype_button
          text      = ''
          quickinfo = 'Show Details'.
    Everytime I click this new button, a window will popup and display the record details.
    My question is: how to call this standard function  ('DETAIL' function) in a program? for example:
    CASE ldf_ok_code.
        WHEN gcf_okcode_save.
          PERFORM okcode_save.
        WHEN 'SHOW_DETAIL'.
          CHECK  gdf_nodkey_9003 IS NOT INITIAL.
          PERFORM SHOW_DETAIL.(How to write this code to display the detail data of the selected record?)
      Thanks a lot!

    Hi,
    Go for Interactive Reporting
    like When u click on the output then it will show the Detail report u want .
    for that purpose Pls
    Use Hide command .
    And call another report
    by using SUBMITT Program

Maybe you are looking for