Pushbutton in ALV

Hi ,
   how can i add a pushbutton in the menu of ALV.
Regards
Arun

Hi Arun,
Check the following code:
CLASS lcl_events DEFINITION.
  PUBLIC SECTION.
    METHODS:
    handle_toolbar
        FOR EVENT toolbar OF cl_gui_alv_grid
            IMPORTING e_object e_interactive.
  PRIVATE SECTION.
ENDCLASS.
CLASS lcl_events IMPLEMENTATION.
  METHOD handle_toolbar.
    DATA:
      zzl_toolbar TYPE stb_button.
*---Append an icon for "Check prices"
    CLEAR:
      zzl_toolbar.
    zzl_toolbar-function  = 'CHECK_PRICE'.
    zzl_toolbar-icon      = icon_check.
    zzl_toolbar-quickinfo = text-fq6.
    zzl_toolbar-text      = text-fi6.
    APPEND zzl_toolbar
        TO e_object->mt_toolbar.
  ENDMETHOD.
ENDCLASS.
Regards,
John.

Similar Messages

  • Column as pushbutton in alv

    Hi all,
           i want to know the moethod by which we can display a coulumn as pushbutton in alv when we are usingFM Reuse_alv_list_display.. to display  ALV...
    if possible then give me some sample code
    Regards,
    Syed

    Check This example which shows button in a cell
    REPORT ZTESTALV.
    type-pools: slis.
    *Fieldcatalog
    data: it_fieldcat type lvc_t_fcat,
    it_fieldcat1 type slis_t_fieldcat_alv..
    *For Events
    data:it_events type slis_t_event.
    data: x_fieldcat type lvc_s_fcat,
    x_fieldcat1 type slis_fieldcat_alv.
    data:x_layout type lvc_s_layo.
    data: begin of it_vbap occurs 0,
    vbeln like vbap-vbeln,
    posnr like vbap-posnr,
    button(10),
    end of it_vbap.
    data: ls_outtab like line of it_vbap.
    select vbeln
    posnr
    up to 10 rows
    into corresponding fields of table it_vbap
    from vbap.
    data:l_pos type i value 1.
    clear: l_pos.
    l_pos = l_pos + 1.
    x_fieldcat-seltext = 'Button'.
    x_fieldcat-fieldname = 'BUTTON'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-icon = 'X'.
    x_fieldcat-col_pos = l_pos.
    x_fieldcat-outputlen = '10'.
    x_fieldcat-style = x_fieldcat-style bit-xor
    cl_gui_alv_grid=>mc_style_button bit-xor
    cl_gui_alv_grid=>mc_style_enabled.
    append x_fieldcat to it_fieldcat.
    clear x_fieldcat.
    l_pos = l_pos + 1.
    x_fieldcat-seltext = 'VBELN'.
    x_fieldcat-fieldname = 'VBELN'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = l_pos.
    x_fieldcat-edit = 'X'.
    x_fieldcat-outputlen = '10'.
    x_fieldcat-ref_field = 'VBELN'.
    x_fieldcat-ref_table = 'VBAK'.
    append x_fieldcat to it_fieldcat.
    clear x_fieldcat.
    l_pos = l_pos + 1.
    x_fieldcat-seltext = 'POSNR'.
    x_fieldcat-fieldname = 'POSNR'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-col_pos = l_pos.
    x_fieldcat-outputlen = '5'.
    append x_fieldcat to it_fieldcat.
    clear x_fieldcat.
    l_pos = l_pos + 1.
    call function 'REUSE_ALV_GRID_DISPLAY_LVC'
      exporting
        i_callback_program = sy-repid
        is_layout_lvc      = x_layout
        it_fieldcat_lvc    = it_fieldcat
      tables
        t_outtab           = it_vbap[]
      exceptions
        program_error      = 1
        others             = 2.
    if sy-subrc eq 0.
    endif.

  • Need pushbutton in ALV

    Hi Friends,
    I need to put a pushbutton in ALV List's every row. And then when user click this button, I will get the selected line of list. My application server is 4.6 and I want to implement this using the function call of CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY', not using object oriented programming. How can I put button in alv list and get the selected line when button is clicked?
    Thanks.

    U can not do it by 'Reuse_alv*'. You have to use class for that. Here is the example: I have created a pushbutton 'Download file'.
    report  z_82235_alv_oops_pustbutton             .
    tables: mara.
    types: begin of t_mara,
             matnr type matnr,
             mtart type mtart,
             matkl type matkl,
             meins type meins,
           end of t_mara.
    data: gt_mara type standard table of t_mara,
          gs_mara like line of gt_mara.
    class lcl_event_receiver definition deferred.
    *-- Global Data defenation for ALV
    *---Alv Grid instance referance
    data : gr_alvgrid type ref to cl_gui_alv_grid,
           event_receiver type ref to lcl_event_receiver.
    *---Name of the custom control added on the screen
    data gc_custom_control_name type scrfname value 'CC_ALV'
    *---Custom container instance referance
    data: gr_ccontainer type ref to cl_gui_custom_container.
    *---Field catalog table
    data: gt_fieldcat type lvc_t_fcat,
          gs_fieldcat type lvc_s_fcat.
    *---Layout structure
    data: gs_layout type lvc_s_layo.
    data: g_repid like sy-repid.
    select matnr
           mtart
           matkl
           meins
           from mara into table gt_mara
           up to 25 rows.
    g_repid = sy-repid.
    include <icon>.
    * Predefine a local class for event handling to allow the
    * declaration of a reference variable before the class is defined.
    * Set initial dynpro
    set screen 100.
    * LOCAL CLASSES: Definition
    *===============================================================
    * class lcl_event_receiver: local class to
    *                         define and handle own functions.
    * Definition:
    * ~~~~~~~~~~~
    class lcl_event_receiver definition.
      public section.
        methods:
        handle_toolbar
            for event toolbar of cl_gui_alv_grid
                importing e_object e_interactive,
        handle_user_command
            for event user_command of cl_gui_alv_grid
                importing e_ucomm.
      private section.
    endclass.
    * lcl_event_receiver (Definition)
    *===============================================================
    * LOCAL CLASSES: Implementation
    *===============================================================
    * class lcl_event_receiver (Implementation)
    class lcl_event_receiver 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.
    * 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... :-)
    * 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 an icon to download
        clear ls_toolbar.
        ls_toolbar-function = 'DOWN'.
        ls_toolbar-icon = 'icon_generate'.
        ls_toolbar-quickinfo = 'DOWNLOAD FILE'.
        ls_toolbar-text = 'DOWNLOAD FILE'.
    *    MOVE ' ' TO ls_toolbar-disabled.
        append ls_toolbar to e_object->mt_toolbar.
      endmethod.
      method handle_user_command.
    * § 3.In event handler method for event USER_COMMAND: Query your
    *   function codes defined in step 2 and react accordingly.
        data: lt_rows type lvc_t_row.
        case e_ucomm.
          when 'DOWN'.
          call function 'GUI_DOWNLOAD'
            exporting
    *         BIN_FILESIZE                  =
              filename                      = 'D:a.txt'
    *         FILETYPE                      = 'ASC'
    *         APPEND                        = ' '
    *         WRITE_FIELD_SEPARATOR         = ' '
    *         HEADER                        = '00'
            tables
              data_tab                      = gt_mara
           exceptions
             file_write_error              = 1
             no_batch                      = 2
             gui_refuse_filetransfer       = 3
             invalid_type                  = 4
             no_authority                  = 5
             unknown_error                 = 6
             header_not_allowed            = 7
             separator_not_allowed         = 8
             filesize_not_allowed          = 9
             header_too_long               = 10
             dp_error_create               = 11
             dp_error_send                 = 12
             dp_error_write                = 13
             unknown_dp_error              = 14
             access_denied                 = 15
             dp_out_of_memory              = 16
             disk_full                     = 17
             dp_timeout                    = 18
             file_not_found                = 19
             dataprovider_exception        = 20
             control_flush_error           = 21
             others                        = 22
          if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          endif.
       endcase.
      endmethod.                           "handle_user_command
    endclass.
    * lcl_event_receiver (Implementation)
    *===================================================================
    * S T A R T - O F - S E L E C T I O N.
    start-of-selection.
      set screen '100'.
    *&      Module  display_alv  OUTPUT
    *       text
    module display_alv output.
      if gr_alvgrid is initial.
    *---Creating custom container instance
        create object gr_ccontainer
          exporting
            container_name              = gc_custom_control_name
          exceptions
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            others                      = 6
        if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
    *---Creating ALV gris instance
        create object gr_alvgrid
          exporting
            i_parent          = gr_ccontainer
            i_appl_events     = 'X'
          exceptions
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            others            = 5
        if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
    *---Prepare field catalog
        perform prepare_field_catalog tables gt_fieldcat.
    *---Prepare layout
        perform prepare_layout changing gs_layout.
    *---Call ALV grid
        call method gr_alvgrid->set_table_for_first_display
          exporting
    *    I_BUFFER_ACTIVE               =
    *    I_BYPASSING_BUFFER            =
    *    I_CONSISTENCY_CHECK           =
    *    I_STRUCTURE_NAME              =
    *    IS_VARIANT                    =
    *    I_SAVE                        =
    *    I_DEFAULT                     = 'X'
            is_layout                     = gs_layout
    *    IS_PRINT                      =
    *    IT_SPECIAL_GROUPS             =
    *    IT_TOOLBAR_EXCLUDING          =
    *    IT_HYPERLINK                  =
    *    IT_ALV_GRAPHICS               =
    *    IT_EXCEPT_QINFO               =
          changing
            it_outtab                     = gt_mara[]
            it_fieldcatalog               = gt_fieldcat
    *    IT_SORT                       =
    *    IT_FILTER                     =
          exceptions
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            others                        = 4
        if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
    * ->Create Object to receive events and link them to handler methods.
    * When the ALV Control raises the event for the specified instance
    * the corresponding method is automatically called.
        create object event_receiver.
        set handler event_receiver->handle_user_command for gr_alvgrid.
        set handler event_receiver->handle_toolbar for gr_alvgrid.
    * § 4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
        call method gr_alvgrid->set_toolbar_interactive.
    *  endif.                               "IF grid1 IS INITIAL
    *  call method cl_gui_control=>set_focus exporting control = gr_alvgrid.
    *--- the instance is present
      else .
        call method gr_alvgrid->refresh_table_display
    *      EXPORTING
    *        IS_STABLE      =
    *        I_SOFT_REFRESH =
          exceptions
            finished       = 1
            others         = 2
        if sy-subrc <> 0.
    *     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
      endif.
    endmodule.                 " display_alv  OUTPUT
    *&      Form  prepare_field_catalog
    *       text
    *      <--P_GT_FIELDCAT  text
    form prepare_field_catalog  tables gt_fieldcat.
      clear : gs_fieldcat.
      gs_fieldcat-fieldname = 'MATNR'.
      gs_fieldcat-col_pos   = 1.
      gs_fieldcat-emphasize = 'X'.
      gs_fieldcat-outputlen = 10.
      gs_fieldcat-coltext   = 'Material No'.
      gs_fieldcat-edit      = 'X'.
      append gs_fieldcat to gt_fieldcat.
      clear : gs_fieldcat.
      gs_fieldcat-fieldname = 'MTART'.
      gs_fieldcat-col_pos   = 2.
      gs_fieldcat-outputlen = 6.
      gs_fieldcat-coltext   = 'Material Type'.
      append gs_fieldcat to gt_fieldcat.
      clear : gs_fieldcat.
      gs_fieldcat-fieldname = 'MATKL'.
      gs_fieldcat-col_pos   = 3.
      gs_fieldcat-outputlen = 5.
      gs_fieldcat-coltext   = 'Material Grp'.
      append gs_fieldcat to gt_fieldcat.
      clear : gs_fieldcat.
      gs_fieldcat-fieldname = 'MEINS'.
      gs_fieldcat-col_pos   = 4.
      gs_fieldcat-outputlen = 4.
      gs_fieldcat-coltext   = 'Unit'.
      append gs_fieldcat to gt_fieldcat.
    endform.                    " prepare_field_catalog
    *&      Form  prepare_layout
    *       text
    *      <--P_GS_LAYOUT  text
    form prepare_layout  changing p_gs_layout type lvc_s_layo.
      p_gs_layout-zebra = 'X'.
      p_gs_layout-grid_title = 'Material'.
      p_gs_layout-smalltitle = 'X'.
    endform.                    " prepare_layout
    *&      Module  STATUS_0100  OUTPUT
    *       text
    module status_0100 output.
      set pf-status 'STATUS1'.
    *  SET TITLEBAR 'xxx'.
    endmodule.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    module user_command_0100 input.
      case sy-ucomm.
        when 'BACK' or 'UP' or 'CANCEL'.
          leave program.
            when '&DETAIL'.
          leave program.
      endcase.
    endmodule.                 " USER_COMMAND_0100  INPUT

  • Pushbutton Inside ALV Grid

    How can I add a pushbutton inside ALV toolbar?

    Hi,
    This can be included into ALV by defining a GUI and setting that GUI using Set PF Status.
    Check the below code for the same,
    REPORT  ZSPRENH069 NO STANDARD PAGE HEADING.
    TYPE-POOLS : SLIS.                            "Global Type for ALV      
       T Y P E S                                                         *
    TYPES:
           BEGIN OF TY_VB_AKAP,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             KUNNR      TYPE KUNAG,                          "Sold-to party
             POSNR      TYPE POSNR_VA,                       "Item Number
             MATNR      TYPE MATNR,                          "Material Number
             PMATN      TYPE PMATN,                          "Pricing Reference Material/Newly Created Material
             KWMENG     TYPE KWMENG,                         "Cumulative Order Qty. in Sales Units
             VRKME      TYPE VRKME,                          "Sales Unit
            NETPR      TYPE NETPR,                          "Net Price
             KZWI1      TYPE KZWI1,                          "Sub Total 1 from pricing procedure for condition
             VKAUS      TYPE ABRVW,                          "Usage Indicator
           END   OF TY_VB_AKAP,
           BEGIN OF TY_MARA,
             MATNR      TYPE MATNR,                          "Material Number
             ZZTECHSPEC TYPE ZTECHSPEC,                      "Technical Specification
           END   OF TY_MARA,
           BEGIN OF TY_MVKE,
             MATNR      TYPE MATNR,                          "Material Number
             VKORG      TYPE VKORG,                          "Sales Organization
             VTWEG      TYPE VTWEG,                          "Distribution Channel
             KONDM      TYPE KONDM,                          "Material Pricing Group
           END   OF TY_MVKE,
           BEGIN OF TY_VBKD,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             POSNR      TYPE POSNR_VA,                       "Item Number
             BSTKD_E    TYPE BSTKD_E,                        "Used to capture New Material Number
           END   OF TY_VBKD,
           BEGIN OF TY_IHEADER,
             SELECT(1)  TYPE C,                              "Check Box
             VBELN      TYPE VBELN,                          "Sales Document
             KUNNR      TYPE KUNAG,                          "Sold-to Party
           END   OF TY_IHEADER,
           BEGIN OF TY_MESSAGE1,
            VKORG     TYPE VKORG,                            "Sales Organization
            VTWEG     TYPE VTWEG,                            "Distribution Channel
            KUNNR     TYPE KUNAG,                            "Customer number
            KONDM     TYPE KONDM,                            "Material pricing group
            ZCOUNT(2) TYPE N,                                "Zcount
            MSGTYP(1) TYPE C,                                "Message type
            TEXT(150) TYPE C,                                "Message text
           END OF TY_MESSAGE1,
           BEGIN OF TY_MESSAGE2,
            VKORG     TYPE VKORG,                            "Sales Organization
            VTWEG     TYPE VTWEG,                            "Distribution Channel
            KUNNR     TYPE KUNAG,                            "Customer number
            MATNR     TYPE MATNR,                            "Material Number
            MSGTYP(1) TYPE C,                                "Message type
            TEXT(150) TYPE C,                                "Message text
           END OF TY_MESSAGE2,
           BEGIN OF TY_IFINAL,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             KWMENG     TYPE KWMENG,                         "Cumulative Order Qty. in Sales Units
             POSNR      TYPE POSNR_VA,                       "Item Number
             KUNNR      TYPE KUNAG,                          "Sold-to party
             MATNR      TYPE MATNR,                          "Material Number
             VRKME      TYPE VRKME,                          "Sales Unit
             KZWI1      TYPE KZWI1,                          "Sub Total 1 from pricing procedure for condition
             VKAUS      TYPE ABRVW,                          "Usage Indicator
             ZZTECHSPEC TYPE ZTECHSPEC,                      "Technical Specification
             PMATN      TYPE PMATN,                          "Pricing Reference Material/Newly Created Material
             KONDM      TYPE KONDM,                          "Material Pricing Group
           END   OF TY_IFINAL,
           BEGIN OF TY_ACC1,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             KUNNR      TYPE KUNAG,                          "Sold-to party
             KONDM      TYPE KONDM,                          "Material Pricing Group
             ZCOUNT(2)  TYPE N,                              "ZCount indicator
             KSTBM      TYPE KSTBM,                          "Quantity
             VRKME      TYPE VRKME,                          "Sales Unit
             ZZTECHSPEC TYPE ZTECHSPEC,                      "Technical Specification
             KZWI1      TYPE KZWI1,                          "Sub Total 1 from pricing procedure for condition
             ERROR(1)   TYPE N,                              "Error Field
           END   OF TY_ACC1,
           BEGIN OF TY_ACC2,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             KUNNR      TYPE KUNAG,                          "Sold-to party
             MATNR      TYPE MATNR,                          "Material Number
             KSTBM      TYPE KSTBM,                          "Cumulative Order Qty. in Sales Units
             ZZTECHSPEC TYPE ZTECHSPEC,                      "Technical Specification
             VRKME      TYPE VRKME,                          "Sales Unit
             KZWI1      TYPE KZWI1,                          "Sub Total 1 from pricing procedure for condition
             ERROR(1)   TYPE N,                              "Error field
           END   OF TY_ACC2.
       D A T A                                                           *
    Internal Table Declarations
    DATA: T_FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV,           "Fieldcatalog IT
          T_EVENTS       TYPE SLIS_T_EVENT,                  "Event IT
          T_HEADER       TYPE SLIS_T_LISTHEADER,             "Header IT
          T_VB_AKAP      TYPE STANDARD TABLE OF TY_VB_AKAP,  "To hold records from VBAK & VBAP Table
          T_MARA         TYPE STANDARD TABLE OF TY_MARA,     "To hold records from MARA Table
          T_MVKE         TYPE STANDARD TABLE OF TY_MVKE,     "To hold records from MVKE Table
          T_VBKD         TYPE STANDARD TABLE OF TY_VBKD,     "To hold records from VBKD Table
          T_IHEADER      TYPE STANDARD TABLE OF TY_IHEADER,  "To hold records from VBAK Table
          T_IFINAL       TYPE STANDARD TABLE OF TY_IFINAL,   "To hold cumulative data for ALV
          T_BDCDATA      TYPE STANDARD TABLE OF BDCDATA,     "IT for bdcdata
          T_BDCMSGCOLL   TYPE STANDARD TABLE OF BDCMSGCOLL,  "IT for error messages
          T_MESSAGE1     TYPE STANDARD TABLE OF TY_MESSAGE1, "IT for conditions1 messages
          T_MESSAGE2     TYPE STANDARD TABLE OF TY_MESSAGE2, "IT for conditions2 messages
          T_ACC2         TYPE STANDARD TABLE OF TY_ACC2,     "IT for holding data for Second Access Sequence Processing
          T_ACC1         TYPE STANDARD TABLE OF TY_ACC1,     "IT for holding data for First Access Sequence Processing
          T_SELECT       TYPE STANDARD TABLE OF RSPARAMS,    "IT for holding data related to the selection screen
    Work area Declarations
          W_FIELDCATALOG TYPE SLIS_FIELDCAT_ALV,             "Fieldcatalog WA
          W_EVENT        TYPE SLIS_ALV_EVENT,                "Event WA
          W_HEADER       TYPE SLIS_LISTHEADER,               "Header WA
          W_LAYOUT       TYPE SLIS_LAYOUT_ALV,               "Layout WA
          W_KEYINFO      TYPE SLIS_KEYINFO_ALV,              "Key Information WA
          W_VB_AKAP      TYPE TY_VB_AKAP,                    "To hold records from T_VB_AKAP
          W_MARA         TYPE TY_MARA,                       "To hold records from T_MARA
          W_MVKE         TYPE TY_MVKE,                       "To hold records from T_MVKE
          W_VBKD         TYPE TY_VBKD,                       "To hold records from T_VBKD
          W_IHEADER      TYPE TY_IHEADER,                    "To hold records from T_IHEADER
          W_IFINAL       TYPE TY_IFINAL,                     "To hold records from T_IFINAL
          W_PARAMS       TYPE CTU_PARAMS,                    "CTU Params
          W_BDCDATA      TYPE BDCDATA,                       "Work Area for BDCDATA
          W_BDCMSGCOLL   TYPE BDCMSGCOLL,                    "Work Area to collect BDC Messages
          W_MESSAGE1     TYPE TY_MESSAGE1,                   "WA for price conditions1 messages
          W_MESSAGE2     TYPE TY_MESSAGE2,                   "WA for price conditions2 messages
          W_ACC2         TYPE TY_ACC2,                       "WA for holding records from T_ACC2
          W_ACC1         TYPE TY_ACC1,                       "WA for holding records from T_ACC1
    Variable declarations
          G_AUDAT       TYPE AUDAT,                          "Document Date (Date Received/Sent)
          G_VBELN       TYPE VBELN_VA,                       "Sales Document
          G_KUNNR       TYPE KUNAG,                          "Sold-to party
          G_MATNR       TYPE MATNR,                          "Material Number
          G_REPID       TYPE SY-REPID,                       "Program Name
          G_MESSAGE(73) TYPE C,                              "To Capture Message
          G_FLAG1(1)    TYPE C,                              "Flag
          G_ANSWER(1)   TYPE C.                              "Optional Button
    Constant declarations
    CONSTANTS:
          C_A(1)         TYPE C VALUE 'A',                    "Constant Value A
          C_S(1)         TYPE C VALUE 'S',                    "Constant Value S
          C_U(1)         TYPE C VALUE 'U',                    "Constant Value U
          C_X(1)         TYPE C VALUE 'X',                    "Constant Value X
          C_E(1)         TYPE C VALUE 'E',                    "Constant Value E
          C_I(1)         TYPE C VALUE 'I',                    "Constant Value I
          C_R(1)         TYPE C VALUE 'R',                    "Constant Value R
          C_B(1)         TYPE C VALUE 'B',                    "Document Category is Quotation
          C_HTNAME(10)   TYPE C VALUE 'T_IHEADER',            "Internal table for Header Data
          C_ITNAME(10)   TYPE C VALUE 'T_IFINAL',             "Internal Table with processed data
          C_Q2(2)        TYPE C VALUE 'Q2',                   "Constant Order Reason Q2
          C_100(3)       TYPE C VALUE '100',                  "Popup screen
         C_046(3)       TYPE C VALUE '046',                    "Value 046
         C_047(3)       TYPE C VALUE '047',                    "Value 047
          C_25(2)        TYPE C VALUE '25',                   "Popup screen
          C_5(1)         TYPE C VALUE '5',                    "Popup screen
          C_1            TYPE I VALUE  1,                     "Value 1 for Error Denotion
          C_2            TYPE I VALUE  2,                     "Value 2 for Error Denotion
          C_3            TYPE I VALUE  3,                     "Value 3 for BDC Error Denotion
          C_1000(4)      TYPE N VALUE 1000,                     "Value 1000
          C_01(2)        TYPE N VALUE '01',                   "Value 01 for Zcount
          C_VK11(4)      TYPE C VALUE 'VK11',                 "Transaction VK11
          C_DYNBEGIN(1)  TYPE C VALUE 'X',                    "Indicator
          C_UPDATE(1)    TYPE C VALUE 'S',                    "Update
          C_DISMODE(1)   TYPE C VALUE 'N',                    "Display
          C_ZBPR(4)      TYPE C VALUE 'ZBPR',                 "Condition Type ZBPR
          C_ERROR(5)     TYPE C VALUE 'ERROR'.                "Error screen title
       S E L E C T   O P T I O N S  &  P A R A M E T E R S               *
    Selection-screen Block 1
    SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
    PARAMETERS:     P_VKORG TYPE VKORG OBLIGATORY,           "Sales Organization
                    P_VTWEG TYPE VTWEG OBLIGATORY,           "Distribution Channel
                    P_SPART TYPE SPART DEFAULT '00'.         "Division
    SELECTION-SCREEN END OF BLOCK BLK1.
    SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-002.
    SELECT-OPTIONS: S_AUDAT FOR G_AUDAT,                     "Document Date (Date Received/Sent)
                    S_VBELN FOR G_VBELN,                     "Sales Document
                    S_KUNNR FOR G_KUNNR,                     "Sold-to party
                    S_MATNR FOR G_MATNR.                     "Material Number
    PARAMETERS:     P_VKAUS(2) TYPE N.                       "Usage Indicator
    SELECTION-SCREEN END OF BLOCK BLK2.
      I N I T I A L I Z A T I O N                                        *
    INITIALIZATION.
      CLEAR : G_REPID.                                       "Program Name
      G_REPID = SY-REPID.                                    "Program Name
      A T   S E L E C T I O N   S C R E E N                              *
    AT SELECTION-SCREEN.
      S T A R T   O F   S E L E C T I O N                                *
    START-OF-SELECTION.
    Data Selection
      PERFORM DATA_RETRIEVAL.
    Build Field Catalog
      PERFORM BUILD_FIELDCATALOG.
    Bulid layout
      PERFORM BUILD_LAYOUT.
    Build Events
      PERFORM BUILD_EVENTS.
    Captures the Values of Selection Screen
      PERFORM CAPTURE_SCREEN.
      E N D   O F   S E L E C T I O N                                    *
    END-OF-SELECTION.
    Display List
      PERFORM DISPLAY_ALV_REPORT.
      F O R M S                                                          *
    *&      Form  DATA_RETRIEVAL
          Retrieves Data for ALV Display
    FORM DATA_RETRIEVAL .
      DATA : L_VKAUS   TYPE VKAUS.            "Variable to hold Usage Indicator
      CLEAR L_VKAUS.
      SELECT VBELN
             KUNNR
        INTO CORRESPONDING FIELDS OF TABLE T_IHEADER
        FROM VBAK
        WHERE VBELN IN S_VBELN
          AND KUNNR IN S_KUNNR
          AND VKORG EQ P_VKORG
          AND AUDAT IN S_AUDAT
          AND VTWEG EQ P_VTWEG
          AND SPART EQ P_SPART
          AND AUGRU EQ C_Q2
          AND VBTYP EQ C_B.
      IF NOT T_IHEADER IS INITIAL.
        IF NOT P_VKAUS IS INITIAL OR P_VKAUS NE C_1.
          CONCATENATE 'C' P_VKAUS INTO L_VKAUS.
          SELECT A~VBELN
                 A~KUNNR
                 B~POSNR
                 B~MATNR
                 B~PMATN
                 B~KWMENG
                 B~VRKME
                B~NETPR
                 B~KZWI1
                 B~VKAUS
           INTO  TABLE T_VB_AKAP
           FROM  VBAK AS A
           JOIN  VBAP AS B
             ON  A~VBELN EQ B~VBELN
           FOR ALL ENTRIES IN T_IHEADER
            WHERE A~VBELN EQ T_IHEADER-VBELN
              AND B~MATNR IN S_MATNR
              AND B~VKAUS EQ L_VKAUS.
        ELSE.
          SELECT A~VBELN
                 A~KUNNR
                 B~POSNR
                 B~MATNR
                 B~PMATN
                 B~KWMENG
                 B~VRKME
                B~NETPR
                 B~KZWI1
                 B~VKAUS
           INTO  TABLE T_VB_AKAP
           FROM  VBAK AS A
           JOIN  VBAP AS B
             ON  A~VBELN EQ B~VBELN
           FOR ALL ENTRIES IN T_IHEADER
           WHERE A~VBELN EQ T_IHEADER-VBELN
             AND B~MATNR IN S_MATNR.
        ENDIF.
        IF NOT T_VB_AKAP IS INITIAL.
          SELECT  VBELN
                  POSNR
                  BSTKD_E
             INTO TABLE T_VBKD
             FROM VBKD
             FOR ALL ENTRIES IN T_VB_AKAP
             WHERE VBELN EQ T_VB_AKAP-VBELN
               AND POSNR EQ T_VB_AKAP-POSNR.
        ENDIF.
        SORT T_VBKD BY VBELN POSNR.
        CLEAR W_VB_AKAP.
      After much of coding was completed, Usage of PMATN was dropped and
      the first eighteen characters of the field BSTKD was proposed for usage
      Hence PMATN is overwritten by BSTKD value in the below loop
        LOOP AT T_VB_AKAP INTO W_VB_AKAP.
          CLEAR: W_VBKD,
                 W_VB_AKAP-PMATN.
          READ TABLE T_VBKD INTO W_VBKD
                            WITH KEY VBELN = W_VB_AKAP-VBELN
                                     POSNR = W_VB_AKAP-POSNR
                            BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_VB_AKAP-PMATN = W_VBKD-BSTKD_E+0(18).
          ENDIF.
          MODIFY T_VB_AKAP FROM W_VB_AKAP TRANSPORTING PMATN.
          CLEAR W_VB_AKAP.
        ENDLOOP.
        IF NOT T_VB_AKAP IS INITIAL.
          SELECT    MATNR
                    ZZTECHSPEC
            INTO    TABLE T_MARA
            FROM    MARA
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE   MATNR EQ T_VB_AKAP-MATNR.
          IF SY-SUBRC EQ 0.
            SORT T_MARA BY MATNR.
          ENDIF.                     "Checking SY-SUBRC for T_MARA
          SELECT    MATNR
                    ZZTECHSPEC
            APPENDING TABLE T_MARA
            FROM    MARA
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE   MATNR EQ T_VB_AKAP-PMATN.
          IF SY-SUBRC EQ 0.
            SORT T_MARA BY MATNR.
          ENDIF.                     "Checking SY-SUBRC for T_MARA
          SELECT    MATNR
                    VKORG
                    VTWEG
                    KONDM
            INTO    TABLE T_MVKE
            FROM    MVKE
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE   MATNR EQ T_VB_AKAP-PMATN.
          IF SY-SUBRC EQ 0.
            SORT T_MVKE BY MATNR VKORG VTWEG.
          ENDIF.                     "Checking SY-SUBRC for T_MVKE
          SELECT    MATNR
                    VKORG
                    VTWEG
                    KONDM
            APPENDING TABLE T_MVKE
            FROM    MVKE
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE   MATNR EQ T_VB_AKAP-MATNR.
          IF SY-SUBRC EQ 0.
            SORT T_MVKE BY MATNR VKORG VTWEG.
          ENDIF.                     "Checking SY-SUBRC for T_MVKE
        ENDIF.                    " FOR T_VB_AKAP NOT INITIAL.
      ENDIF.                    " FOR T_IHEADER NOT INITIAL.
      CLEAR: W_VB_AKAP,
             W_IFINAL.
      LOOP AT T_VB_AKAP INTO W_VB_AKAP.
        W_IFINAL-VBELN  = W_VB_AKAP-VBELN.
        W_IFINAL-KUNNR  = W_VB_AKAP-KUNNR.
        W_IFINAL-POSNR  = W_VB_AKAP-POSNR.
        W_IFINAL-MATNR  = W_VB_AKAP-MATNR.
        W_IFINAL-PMATN  = W_VB_AKAP-PMATN.
        W_IFINAL-KWMENG = W_VB_AKAP-KWMENG.
        W_IFINAL-VRKME  = W_VB_AKAP-VRKME.
       W_IFINAL-NETPR  = W_VB_AKAP-NETPR.
        W_IFINAL-KZWI1  = ( W_VB_AKAP-KZWI1 / W_VB_AKAP-KWMENG ) * 1000.
        W_IFINAL-VKAUS  = W_VB_AKAP-VKAUS.
      Populating Material Pricing Group from New Material Group, if such Group doesn't exist
      Population of Material Pricing Group from Material Number is tried.
      Similar condition does suit for Tech Spec too.
        SORT: T_MVKE BY MATNR VKORG VTWEG,
              T_MARA BY MATNR.
        IF NOT W_VB_AKAP-PMATN IS INITIAL.
          CLEAR W_MVKE.
          READ TABLE    T_MVKE
               INTO     W_MVKE
               WITH KEY MATNR = W_VB_AKAP-PMATN
                        VKORG = P_VKORG
                        VTWEG = P_VTWEG
               BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_IFINAL-KONDM = W_MVKE-KONDM.
          ENDIF.
          READ TABLE     T_MARA
               INTO      W_MARA
               WITH KEY  MATNR = W_VB_AKAP-PMATN
               BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_IFINAL-ZZTECHSPEC = W_MARA-ZZTECHSPEC.
          ENDIF.                              " SY-SUBRC FOR READ TABLE T_MARA
       IF W_MVKE-KONDM IS INITIAL.
        ELSE.
         SORT T_MVKE BY MATNR VKORG VTWEG.
          CLEAR W_MVKE.
          READ TABLE     T_MVKE
               INTO      W_MVKE
               WITH KEY  MATNR = W_VB_AKAP-MATNR
                         VKORG = P_VKORG
                         VTWEG = P_VTWEG
               BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_IFINAL-KONDM = W_MVKE-KONDM.
          ENDIF.
          READ TABLE     T_MARA
               INTO      W_MARA
               WITH KEY  MATNR = W_VB_AKAP-MATNR
               BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_IFINAL-ZZTECHSPEC = W_MARA-ZZTECHSPEC.
          ENDIF.                              " SY-SUBRC FOR READ TABLE T_MARA
       ELSE.
         W_IFINAL-KONDM  =  W_MVKE-KONDM.
        ENDIF.                              " IS INITIAL CHECK FOR W_MVKE-KONDM
        APPEND W_IFINAL TO T_IFINAL.
        CLEAR: W_VB_AKAP,
               W_IFINAL.
      ENDLOOP.
      SORT T_IFINAL BY VBELN.
    Checking whether if there are any header quotations which does not have items against them in item internal table
    if such records exist then, ensuring that such records gets deleted from header too, so that inconsitency is removed.
      CLEAR W_IHEADER.
      LOOP AT T_IHEADER INTO W_IHEADER.
        CLEAR W_IFINAL.
        READ TABLE T_IFINAL INTO W_IFINAL WITH KEY VBELN = W_IHEADER-VBELN.
        IF SY-SUBRC NE 0.
          W_IHEADER-SELECT = C_X.
          MODIFY T_IHEADER FROM W_IHEADER TRANSPORTING SELECT.
        ENDIF.
      ENDLOOP.
      DELETE T_IHEADER WHERE SELECT = C_X.
      SORT T_IFINAL BY VBELN.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  build_layout
          To build ALV Layout
    FORM BUILD_LAYOUT.
      CLEAR  : W_LAYOUT.
      W_LAYOUT-COLWIDTH_OPTIMIZE = C_X.
      W_LAYOUT-BOX_TABNAME       = C_HTNAME.      "tabname for checkbox
      W_LAYOUT-BOX_FIELDNAME     = 'SELECT'.      "fieldname for checkbox
      CLEAR  : W_KEYINFO.
      W_KEYINFO-HEADER01 = 'VBELN'.               "Header1 key information
      W_KEYINFO-ITEM01   = 'VBELN'.               "Item1 key information
    ENDFORM.                                      "build_layout
    *&      Form  build_events
          To build ALV Events
    FORM BUILD_EVENTS.
      CONSTANTS: C_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE     = 1
        IMPORTING
          ET_EVENTS       = T_EVENTS
        EXCEPTIONS
          LIST_TYPE_WRONG = 1
          OTHERS          = 2.
      IF SY-SUBRC = 0.
        READ TABLE T_EVENTS INTO W_EVENT
                            WITH KEY NAME = C_TOP_OF_PAGE.
        IF SY-SUBRC = 0.
          MOVE C_TOP_OF_PAGE TO W_EVENT-FORM.
          MODIFY T_EVENTS INDEX SY-TABIX
                          FROM  W_EVENT
                          TRANSPORTING FORM.
        ENDIF.
      ELSE.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                                      "build_events
    *&      Form  top_of_page
          To display top of page in ALV Report
    FORM TOP_OF_PAGE.                                           "#EC CALLED
      DATA :
        L_VKORG(35) TYPE C,                        "Sales Organization
        L_VTWEG(35) TYPE C,                        "Distribution Channel
        L_SPART(35) TYPE C.                        "Division
    Title
    CLEAR W_HEADER.
    W_HEADER-TYP  = C_H.
    W_HEADER-INFO = TEXT-003.
    APPEND W_HEADER TO T_HEADER.
    Sales Organization
      CLEAR W_HEADER.
      W_HEADER-TYP  = C_S.
      CONCATENATE TEXT-004 P_VKORG INTO L_VKORG.
      W_HEADER-INFO = L_VKORG.
      APPEND W_HEADER TO T_HEADER.
    Distribution Channel
      CLEAR W_HEADER.
      W_HEADER-TYP  = C_S.
      CONCATENATE TEXT-005 P_VTWEG INTO L_VTWEG.
      W_HEADER-INFO = L_VTWEG.
      APPEND W_HEADER TO T_HEADER.
    Division
      CLEAR W_HEADER.
      W_HEADER-TYP  = C_S.
      CONCATENATE TEXT-006 P_SPART INTO L_SPART.
      W_HEADER-INFO = L_SPART.
      APPEND W_HEADER TO T_HEADER.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = T_HEADER.
    ENDFORM.                                      "top_of_page
    *&      Form  pf_status
          To set PF-Status (user interface)
         -->EXTAB     The excluding table (function codes)
    FORM PF_STATUS                                              "#EC CALLED
              USING T_EXTAB TYPE SLIS_T_EXTAB.                  "#EC NEEDED
      SET PF-STATUS 'ZSTANDARD_FULLSCREEN'.
    ENDFORM.                                      "pf_status
    *&      Form  display_alv_report
          To display ALV report
    FORM DISPLAY_ALV_REPORT.
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
      I_INTERFACE_CHECK              = ' '
         I_CALLBACK_PROGRAM             = G_REPID
         I_CALLBACK_PF_STATUS_SET       = 'PF_STATUS'
         I_CALLBACK_USER_COMMAND        = 'USER_COMMAND'
         IS_LAYOUT                      = W_LAYOUT
         IT_FIELDCAT                    = T_FIELDCATALOG
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
         I_DEFAULT                      = C_X
         I_SAVE                         = C_A
      IS_VARIANT                     =
         IT_EVENTS                      = T_EVENTS[]
      IT_EVENT_EXIT                  =
         I_TABNAME_HEADER               = 'T_IHEADER'
         I_TABNAME_ITEM                 = 'T_IFINAL'
      I_STRUCTURE_NAME_HEADER        =
      I_STRUCTURE_NAME_ITEM          =
          IS_KEYINFO                     = W_KEYINFO
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                =
      IR_SALV_HIERSEQ_ADAPTER        =
      IT_EXCEPT_QINFO                =
      I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        TABLES
          T_OUTTAB_HEADER                = T_IHEADER
          T_OUTTAB_ITEM                  = T_IFINAL
       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  BUILD_FIELDCATALOG
          To build ALV Field Catalog
    FORM BUILD_FIELDCATALOG .
      DATA: L_COUNT TYPE I VALUE 0.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_HTNAME.
      W_FIELDCATALOG-FIELDNAME   = 'SELECT'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C01.
      W_FIELDCATALOG-CHECKBOX    =  C_X.
      W_FIELDCATALOG-EDIT        =  C_X.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_HTNAME.
      W_FIELDCATALOG-FIELDNAME   = 'VBELN'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C02.
      W_FIELDCATALOG-KEY         =  C_X.   "Fixes the column for no-scroll
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_HTNAME.
      W_FIELDCATALOG-FIELDNAME   = 'KUNNR'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C04.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR L_COUNT.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_ITNAME.
      W_FIELDCATALOG-FIELDNAME   = 'POSNR'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C03.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_ITNAME.
      W_FIELDCATALOG-FIELDNAME   = 'KWMENG'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C06.
      W_FIELDCATALOG-EMPHASIZE   =  'C400'.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_ITNAME.
      W_FIELDCATALOG-FIELDNAME   = 'VRKME'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C07.
      W_FIELDCATALOG-JUST        =  C_R.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_ITNAME.
    W_FIELDCATALOG-FIELDNAME   = 'NETPR'.
      W_FIELDCATALOG-FIELDNAME   = 'KZWI1'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C08.
      W_FIELDCATALOG-EMPHASIZE   =  'C400'.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_ITNAME.
      W_FIELDCATALOG-FIELDNAME   = 'VKAUS'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C12.
      W_FIELDCATALOG-JUST        =  C_R.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_ITNAME.
      W_FIELDCATALOG-FIELDNAME   = 'ZZTECHSPEC'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C09.
      W_FIELDCATALOG-EMPHASIZE   =  'C400'.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_ITNAME.
      W_FIELDCATALOG-FIELDNAME   = 'MATNR'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C05.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_ITNAME.
      W_FIELDCATALOG-FIELDNAME   = 'PMATN'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C10.
      W_FIELDCATALOG-EMPHASIZE   =  'C400'.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
      CLEAR  W_FIELDCATALOG.
      L_COUNT = L_COUNT + 1.
      W_FIELDCATALOG-COL_POS     =  L_COUNT.
      W_FIELDCATALOG-TABNAME     =  C_ITNAME.
      W_FIELDCATALOG-FIELDNAME   = 'KONDM'.
      W_FIELDCATALOG-SELTEXT_M   =  TEXT-C11.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  user_command
          EXIT routine for command handling
         -->L_UCOMM      Function code that PAI triggered
         -->W_SELFIELD   Information cursor position ALV
    FORM USER_COMMAND USING L_UCOMM    LIKE SY-UCOMM            "#EC CALLED
                            W_SELFIELD TYPE SLIS_SELFIELD.      "#EC NEEDED
    Check function code
      CASE L_UCOMM.
        WHEN 'CREATE'.
          SORT T_IHEADER BY SELECT.
          READ TABLE T_IHEADER INTO W_IHEADER
                              WITH KEY SELECT = C_X
                              BINARY SEARCH.
          IF SY-SUBRC <> 0.
            MESSAGE I000(ZS) WITH TEXT-M01.
          ELSE.
            CLEAR : G_ANSWER.
    Dialog box for save prompts
            CALL FUNCTION 'POPUP_TO_CONFIRM'
              EXPORTING
                TEXT_QUESTION         = TEXT-OP1
                DISPLAY_CANCEL_BUTTON = ''
              IMPORTING
                ANSWER                = G_ANSWER
              EXCEPTIONS
                TEXT_NOT_FOUND        = 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.
            ELSE.
              IF G_ANSWER = 1.
                SET PF-STATUS 'ZSTANDARD_SCREEN'.
                PERFORM DATA_IDENTITY_4_ACCESS_SEQ.
                PERFORM CREATE_CONDITIONS.
                PERFORM DISPLAY_RESULT.
              ENDIF.
            ENDIF.
          ENDIF.
        WHEN '&REFRESH'.
          SUBMIT ZSPRENH069 USING SELECTION-SCREEN 1000
                            WITH SELECTION-TABLE T_SELECT.
        WHEN 'BACKTO'.
          SUBMIT ZSPRENH069 USING SELECTION-SCREEN 1000
                            WITH SELECTION-TABLE T_SELECT.
      ENDCASE.
    ENDFORM.                                      "user_command
    *&      Form  DATA_IDENTITY_4_ACCESS_SEQ
    Seperates the Available Data for processing for both Access Sequences
    FORM DATA_IDENTITY_4_ACCESS_SEQ .
      CLEAR : W_IFINAL,
              W_ACC1,
              W_ACC2.
      SORT T_MVKE BY MATNR VKORG VTWEG.
      LOOP AT T_IHEADER INTO W_IHEADER WHERE SELECT = C_X.
        LOOP AT T_IFINAL INTO W

  • Adding pushbutton  in alv grid list

    hai friends,
                     i have developed an alv grid list and i place a pushbutton called 'GETEXCEL'.when i click on 'GETEXCEL' it should generate an excel sheet and it should get placed in application server.
    for the reference plz check my code also.
    the issue is when i debug, the transfer statement is getting executed then it is going to the standard program(moduel pool) and then it is not going to application server.of course excel sheet is also getting generated.can anybody find the solution for this.
    *&      Form  events_get
          text
    -->  p1        text
    <--  p2        text
    FORM events_get .
    *DATA t_event TYPE slis_t_event.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
       I_LIST_TYPE           = 0
    IMPORTING
       ET_EVENTS             = tab_events
    EXCEPTIONS
       LIST_TYPE_WRONG       = 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.
      READ TABLE tab_events INTO wa_events WITH KEY name = 'USER_COMMAND'.
      wa_events-form = 'USER_COMMAND'.
      MODIFY tab_events FROM wa_events TRANSPORTING form WHERE name =
      wa_events-name.
      READ TABLE tab_events INTO wa_events WITH KEY name = 'PF_STATUS_SET'.
      wa_events-form = 'PF_STATUS_SET'.
      MODIFY tab_events FROM wa_events TRANSPORTING form WHERE name =
      wa_events-name.
    ENDFORM.                    " events_get
    **& Form pf_status_set
    FORM pf_status_set USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'STATUS'.
    ENDFORM.                           " pf_status_set
    **& Form user_command
    FORM user_command
    USING u_comm TYPE sy-ucomm
    r_selfield TYPE slis_selfield.
    CASE u_comm.
        WHEN 'GETEXCEL'.
          PERFORM f400_column_headings.
          PERFORM f500_generate_excel_file.
          PERFORM f600_transfer_excel_file.
      ENDCASE.
    ENDFORM.                    "user_command
    then i am passing the parameters in grid fm also for user command and set pf status.

    Hi Mahesh,
    1. No need to populate the EVENTS table in your case, just pass the Subroutine names for PF status and USER_COMMAND to GRId Display
      I_CALLBACK_PFSTATUS  = 'PF_STATUS_SET'.
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    2. make sure you pass SY-REPID/SY-CPROG  to REUSE_ALV_GRID_DISPLAY  FM

  • New pushbuttons on ALV display

    Hi
    I am displaying ALV using REUSE_ALV_GRID_DISPLAY and now i want to add 2 new pushbuttons
    on menu bar and one more thing i want to do is that when user select particular records and click on one of pushbutton, new screen should appear and the selected record get displayed .
    How would i do it?
    Is there any alternative to it?
    Thanks
    Parag

    Hi
    U need to implement the form to set a your own status gui as copy of the standard one: after creating it u need to add the new two pushbutton.
    The implement the routine for the user-command where u need to manage your pushbutton.
    U need to insert a flag field for the marker and check this field in order to know which records are selected.:
    Call the alv grid:
    .* Output table
    DATA: BEGIN OF T_OUTPUT OCCURS 0,
                MARK,      "<-------- Field for selected record
    * Set the report where the routines are defined
      LT_REPORT = SY-REPID.
    * Set the name for mark
    LT_LAYOUT-BOX_FIELDNAME = 'MARK'.
      call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
         i_callback_program                           = LT_REPORT
         I_CALLBACK_PF_STATUS_SET       = 'SET_PF_STATUS'   "<--- Routine for the status
         I_CALLBACK_USER_COMMAND      = 'USER_COMMAND'  "<--- Routine for user-command 
         IS_LAYOUT                                     = LT_LAYOUT
           TABLES
                T_OUTTAB                = T_OUTPUT.
    Routine to set your status gui (the status has to be the copy of standard alv status STANDARD_FULLSCREEN of prgram SAPLKKBL)
    FORM SET_PF_STATUS USING IT_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'MY_BAR' EXCLUDING IT_EXTAB.
    ENDFORM.                               " SET_PF_STATUS
    Routine to manage user-command
    FORM user_command USING R_ucomm    LIKE sy-ucomm
                                                is_selfield TYPE slis_selfield.
        CASE R_UCOMM.
           WHEN ....
               LOOP AT T_OUTPUT WHERE MARK = 'X'
    ENDFORM.
    Max

  • Pushbutton in alv column

    Hello,
    I have to create an ALV(not using OO) with a pushbutton column.  The requirement is as follows: the grid contains a text column.  When the text contains more than 100 characters, a column with a pushbutton (named: More...) is selected by the user to view the rest of the text description.  Scrolling within the text column is not desired.
    Can someone tell me how to define the column as a pushbutton.  How about how to disable the pushbutton for the row, when the text is less than 100 characters?  I am thinking that I can handled the event in the user_command area of the ALV.
    Can this be done?
    Regards,
    Anna-Liza

    Hi
    You can  show a field as ICON (it menages it in catalog table) and assign the HOTSPOT option to it.
    In this way the field should behave itself like a push button.
    As soon as you know the row you can decide which action has to be done: to show or not to show the rest of text:
    you can do it activing the event HOTSPOT_CLICK.
    Max

  • Block certain Pushbuttons from ALV display

    Hi Experts,
    I want to block a few of the pushbuttons(PB) in my ALV report such as the Graph PB or the ABC analysis PB.
    I have used REUSE_ALV_GRID_DISPLAY. Can any one tell me the fcodes i need to pass to IT_EXCLUDING to exclude them.

    Hi,
    Look at the below links
    http://www.howforge.com/taxonomy/term/4?page=1
    Re: Error when pressing the buttons in ALV
    http://www.howforge.com/abap-4-example-code-alv-list-by-fm-reuse-alv-list-display
    Regards
    Sudheer

  • PUSHBUTTON  IN ALV TREE

    Hi all,
    When I create a ALV  TREE output with cl_gui_alv_tree, during output display I want a pushbutton to be displayed BEFORE each row.The row should not be editable.When I select the button, the whole row should be selected.
    What extra code should I add in my program?
    Thanks a lot in advance .
    Regards,
    Tarak

    put a field CHK type CHAR01 in internal table whihch is being used for ALV grid.. then in layout pass this field name as
    ls_lay-box_fname    = 'CHK' .
    Edited by: Pawan Kesari on Oct 6, 2008 6:33 PM

  • Adding a Pushbutton on ALV toolbar

    Hi ,
    I wanna add a pushbutton to my ALV report toolbar, I have tried by screen painter(se51) but its not working. That is when you open the screen painter its showing the  push button, but when you run the screen as transaction its not showing that button. 
    Any help is greatly appreciated.
    Regards
    Moderator Message: Please search before posting your question. Thread locked.
    Edited by: Suhas Saha on Oct 18, 2011 3:40 PM

    Hi Harsh,
    To add button in the ALV toolbar, follow the below steps :
    1. Open Functional group SALV in se80 and copy the GUI status 'STANDARD' in customer namespace ( for e.g. ZSTANDARD'  to your ALV report program.
    2. Once you copy the GUI status, open your ALV report program in se80 and modify it's GUI status 'ZSTANDARD' according to your requirement.
    3. Code accordingly in your ALV report program.
    Here is the below code for your reference.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = g_repid
          i_callback_pf_status_set = alv_status_set
          i_callback_user_command  = *alv_user_comm*
          i_grid_title             = grid_title
          i_save                   = g_save
          is_variant               = gs_variant
          is_layout                = alv_layout
          it_fieldcat              = alv_fieldcat[]
          it_events                = gt_events[]
          it_sort                  = alv_sort[]
        IMPORTING
          e_exit_caused_by_caller  = g_exit_caused_by_caller
          es_exit_caused_by_user   = gs_exit_caused_by_user
        TABLES
          t_outtab                 = it_final[].
      PERFORM *alv_user_comm* USING r_ucomm
                                  rs_selfield.
    FORM *alv_user_comm*  USING    r_ucomm     LIKE sy-ucomm
                                 rs_selfield TYPE slis_selfield.
    r_ucomm = sy-ucomm.
      CASE r_ucomm.
      ENDCASE.
    ENDFORM.
    Let us know if you still having some issues.
    Cheers
    VJ

  • How to add a pushbutton in ALV

    Hi,
    Can anybody tell me the step-by-step procedure to add a pushbutton in a ALV Report?

    Hi Sudheer,
    Add Button to ALV Toolbar with REUSE_ALV_LIST_DISPLAY
    How to add button to ALV toolbar using REUSE_ALV_LIST_DISPLAY?
    In the program which calls ALV using REUSE_ALV_LIST_DISPLAY,
    I have to add a new button.
    I saw the demo program BCALV_GRID_08, which is written using ABAP-Controls.
    In that example, the button is added using TOOLBAR event of cl_gui_alv_grid.
    Could you help me to implement the same logic using REUSE_ALV_LIST_DISPLAY parameters.
    you should copy the 'STANDARD' GUI status from program SAPLKKBL using transaction SE90 >Programming SubObjects> Gui Status.
    Execute this transaction to get to next screen. select status using checkbox. click on GUI Status --> Copy.
    Enter your Z program name and the name you what for this status - you can keep it as 'STANDARD' to be simple.
    Then you can edit the new status to add or delete buttons. This will also bring in the standard SAP ALV functionality such as sorting/subtotaling etc...
    When you call 'REUSE_ALV_GRID_DISPLAY' make sure you pass it the new status name.
    an example of one of mine:
    call function 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = 'ZSDBOLST_REPORT'
    i_callback_pf_status_set = 'STANDARD' <----
    i_callback_user_command = 'USER_COMMAND'
    i_structure_name = 'I_BOLACT'
    i_grid_title = 'BOL Action Report'(031)
    is_layout = gs_layout
    it_fieldcat = gt_fieldcat[]
    i_save = 'A'
    is_variant = v_variant
    TABLES
    t_outtab = i_bolact
    EXCEPTIONS
    program_error = 1
    others = 2.
    I just tried the same procedure ,but my entire application toolbar disappeared and a lock icon appears next to the application toolbar in my copied pf-status.
    Could you advice what might have gone wrong ?
    As identified with the FM's help you can do the following.
    1). Using SE80 (I think) you can copy a GUI status from one program to another. It mentions which one in the FM's help.
    2). Create a form named like so:
    Code:
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZSTANDARD'.
    ENDFORM. "Set_pf_status
    In the above case the GUI status copied was named ZSTANDARD and adjusted accordingly, adding and removing the desired buttons. A button was added called '%DELETE'.
    3). Create the following report:
    Code:
    Form User_command
    Notes: Called by FM REUSE_ALV_GRID_DISPLAY
           Detects whether the icon/button for
           'Return Tag Deletion' has been pressed. If it has then
           detect whether any rows have been highlighted and then
           set the delete flag.
    FORM user_command USING r_ucomm     LIKE sy-ucomm
                            rs_selfield TYPE slis_selfield.
    DATA: li_count TYPE I.
    IF r_ucomm EQ '%DELETE'.
      LOOP AT %g00 WHERE mark EQ 'X'.
        ADD 1 TO li_count.
      ENDLOOP.
      IF li_count GT 0.
        gc_delete_flag = 'X'.
        r_ucomm = '&F03'. "Back arraow
      ELSE.
        MESSAGE W000 WITH 'Please highlight the rows to be deleted!'.
      ENDIF.
    ENDIF.
    ENDFORM.  "User_command
    As I've added an extra button to indicate which records should be deleted I need to identify a form to be called to process when this button is chosen.
    Then when you call the ALV function you to specify the following extra details:
    Code:
        call function 'REUSE_ALV_GRID_DISPLAY'
             exporting  i_callback_program = gc_repid
                        I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
                        I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
                        i_grid_title       = lc_grid_title
                        is_layout          = lc_layout
                        it_fieldcat        = gt_fieldcat
                        it_sort            = sort
                        i_save             = l_save
                        is_reprep_id       = l_bbs_id
                        is_variant         = l_variant
             tables     t_outtab           = %g00
             exceptions program_error      = 1
                        others             = 2.
    The parameters in capitals are the extra ones that need to be added.
    That should be it!
    Make you sure that you also read the help against the ALV function.
    Please chk the below link which is in PDF format
    http://www.erpgenie.com/abaptips/index2.php?option=com_content&do_pdf=1&id=141
    And also please chk the link
    http://abapprogramming.blogspot.com/2007/07/alv-documentation-complete.html
    https://www.sdn.sap.com/irj/sdn/advancedsearch?query=alv%20grid&cat=sdn_all&start=111
    Reward if useful.
    Regards,
    Chandru

  • Pushbuttons in ALV

    hi Im working on an alv report,in the output list i have to get pushbutton for every row as a separate column.please help me out with some code,i had gone trough sap sample ALV programs but i did not find this type of programs.Thank you.
    Regards
    Anil

    Hi Babita,
    ok no need to worry, you can do that with the help of FM  <b>REUSE_ALV_GRID_DISPLAY_LVC</b>, but New FM , i am not sure if you have this or not. if it is there you can very well do it. just check this code...
    REPORT ZTESTALV.
    TYPE-POOLS: SLIS.
    *- Fieldcatalog
    DATA: IT_FIELDCAT  TYPE LVC_T_FCAT,
          IT_FIELDCAT1  TYPE SLIS_T_FIELDCAT_ALV..
    *- For Events
    DATA:IT_EVENTS TYPE SLIS_T_EVENT.
    DATA:  X_FIELDCAT  TYPE LVC_S_FCAT,
            X_FIELDCAT1  TYPE SLIS_FIELDCAT_ALV.
    DATA:X_LAYOUT TYPE LVC_S_LAYO.
    DATA: BEGIN OF IT_VBAP OCCURS 0,
          VBELN LIKE VBAP-VBELN,
          POSNR LIKE VBAP-POSNR,
          BUTTON(10),
         END OF IT_VBAP.
    DATA: LS_OUTTAB LIKE LINE OF IT_VBAP.
    SELECT VBELN
           POSNR
           UP TO 10 ROWS
          INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
          FROM VBAP.
    DATA:L_POS TYPE I VALUE 1.
    CLEAR: L_POS.
    L_POS = L_POS + 1.
    X_FIELDCAT-SELTEXT = 'Button'.
    x_fieldcat-fieldname = 'BUTTON'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-OUTPUTLEN = '10'.
    X_FIELDCAT-style = X_FIELDCAT-style bit-xor
                      cl_gui_alv_grid=>MC_STYLE_BUTTON bit-xor
                      cl_gui_alv_grid=>MC_STYLE_ENABLEd.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    X_FIELDCAT-SELTEXT = 'VBELN'.
    X_FIELDCAT-FIELDNAME = 'VBELN'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-EDIT = 'X'.
    X_FIELDCAT-OUTPUTLEN = '10'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    X_FIELDCAT-SELTEXT = 'POSNR'.
    X_FIELDCAT-FIELDNAME = 'POSNR'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-OUTPUTLEN = '5'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
      EXPORTING
        I_CALLBACK_PROGRAM = SY-REPID
        IS_LAYOUT_LVC      = X_LAYOUT
        IT_FIELDCAT_LVC    = IT_FIELDCAT
      TABLES
        T_OUTTAB           = IT_VBAP[]
      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.
    Regards
    vijay

  • Tooltip on pushbutton on alv report selection screen

    Hi Experts,
    I have a selection screen with two pushbuttons i want to provide tooltip on this button when user takes his cursor on it .. some part of my code
    Selection screen:
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) text-t02 FOR FIELD p_info.
    PARAMETERS: p_info TYPE string.
    SELECTION-SCREEN: PUSHBUTTON 68(10) but1 USER-COMMAND cli1.
    SELECTION-SCREEN : END OF LINE.
    PARAMETERS:      r_exe_im  RADIOBUTTON GROUP rb1.
    PARAMETERS:      r_st  RADIOBUTTON GROUP rb1.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN: PUSHBUTTON /1(20) exec1 USER-COMMAND cli2.
    SELECTION-SCREEN: FUNCTION KEY 1.
    SELECTION-SCREEN END OF BLOCK b1.
    please tell me on these selection fields how to display tool tip.
    Thanks and regards,
    Roshan.

    Hi,
    After completing your executable program in SE38, activate it and goto SE51(Screen painter).
    Here give the name of your program and screen number as 1000.
    Click on Change.
    Goto Element List Tab.
    Here you will find all your elements from your program.
    Select the required element and click on Properties.
    Here you will find a Tooltip Text property. Click on the button 'Text' of this property.
    You will be given 2 options 1) Text from Text element 2) Text from Variable
    Enter as per requirement
    Save and Activate.
    Hope this will be useful
    Regards
    Bhupal

  • Pushbutton on ALV grid.

    hi to all,
    I have created a push button on ALV grid. The ALV is not created in OO.
    Can anybody tell me how to select a row or multiple row and relate it to fuction attached to that push button. I have followed all links in forum but that all are for ALV created in OO.
    The row should be selected on basis of grid available on left hand of grid or I have also putted checkbox in grid.
    plz do the needful.
    thanks
    regards,
    sachin d.

    Hi,
    if you want multiple selection all lines. then
    case r_ucomm.
    when 'BUTTONCODE'.
    loop at itab.
    itab-check = 'X'. "Check is checkbox field
    modify itab index sy-tabix.
    endloop.
    selfield-refresh = 'X'.
    endcase.
    Regards
    vijay

  • Exclude buttons from ALV

    Hi All,
      I want to exclude pushbuttons from ALV. Can any body suggest me how to do this. I am using classes to display ALV.
    Regards,
    Venkat.

    in the pbo of your screen, before displaying your alv grid write in the following way:-
    data: g_alv_grid          type ref to cl_gui_alv_grid,
             g_exclude          type ui_func,
             g_t_tlbr_excl       type ui_functions.
    *PBO if used container or screen ,
    start of selection - if working with selection screen but before displaying alv.
    Exclude ICONS
        perform form_exculde_icons.
        call method g_alv_grid->set_table_for_first_display
          EXPORTING
            is_variant           = VARIANT
            is_layout            = LAYOUT
            is_print             =  PRINT
            it_toolbar_excluding = g_t_tlbr_excl
          CHANGING
            it_outtab            = ITAB
            it_fieldcatalog      = FIELDCATALOG[]
        if sy-subrc <> 0.
          write: 'Method call ''Set_table_for_first_display'' failed.'.
          exit.
        endif.
    form form_exculde_icons .
    Exclude alv sum button
      g_exclude = cl_gui_alv_grid=>mc_fc_sum.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv count button
      g_exclude = cl_gui_alv_grid=>mc_fc_count.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv average button
      g_exclude = cl_gui_alv_grid=>mc_fc_average.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv maximum button
      g_exclude = cl_gui_alv_grid=>mc_fc_maximum.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv manimum button
      g_exclude = cl_gui_alv_grid=>mc_fc_minimum.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv subtotal button
      g_exclude = cl_gui_alv_grid=>mc_fc_subtot.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv auf button
      g_exclude = cl_gui_alv_grid=>mc_fc_auf.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv locpaste button
      g_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv new_row button
      g_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv mb_view button
      g_exclude = cl_gui_alv_grid=>mc_mb_view.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv fc_view button
      g_exclude = cl_gui_alv_grid=>mc_fc_views.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv print_prev button
      g_exclude = cl_gui_alv_grid=>mc_fc_print_prev.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv viewgrid button
      g_exclude = cl_gui_alv_grid=>mc_fc_view_grid.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv view_excel button
      g_exclude = cl_gui_alv_grid=>mc_fc_view_excel.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv view_crystal button
      g_exclude = cl_gui_alv_grid=>mc_fc_view_crystal.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv view_lotus button
      g_exclude = cl_gui_alv_grid=>mc_fc_view_lotus.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv send button
      g_exclude = cl_gui_alv_grid=>mc_fc_send.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv call_abc button
      g_exclude = cl_gui_alv_grid=>mc_fc_call_abc.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv call_xint button
      g_exclude = cl_gui_alv_grid=>mc_fc_call_xint.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv fc_expcrdesig button
      g_exclude = cl_gui_alv_grid=>mc_fc_expcrdesig.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv fc_expcrtempl button
      g_exclude = cl_gui_alv_grid=>mc_fc_expcrtempl.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv mb_paste button
      g_exclude = cl_gui_alv_grid=>mc_mb_paste.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv load_variant button
      g_exclude = cl_gui_alv_grid=>mc_fc_load_variant.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv current_variant button
      g_exclude = cl_gui_alv_grid=>mc_fc_current_variant.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv maintain_variant button
      g_exclude = cl_gui_alv_grid=>mc_fc_maintain_variant.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv save_variant button
      g_exclude = cl_gui_alv_grid=>mc_fc_save_variant.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv select_all button
      g_exclude = cl_gui_alv_grid=>mc_fc_select_all.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv deselect_all button
      g_exclude = cl_gui_alv_grid=>mc_fc_deselect_all.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv graph button
      g_exclude = cl_gui_alv_grid=>mc_fc_graph.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv info button
      g_exclude = cl_gui_alv_grid=>mc_fc_info.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv f4 button
      g_exclude = cl_gui_alv_grid=>mc_fc_f4.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv call_report button
      g_exclude = cl_gui_alv_grid=>mc_fc_call_report.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv fc_check button
      g_exclude = cl_gui_alv_grid=>mc_fc_check.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv fc_refresh button
      g_exclude = cl_gui_alv_grid=>mc_fc_refresh.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv loc_cut button
      g_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv loc_copy button
      g_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv loc_undo button
      g_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv append_row button
      g_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv insert_row button
      g_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv delete_row button
      g_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv copy_row button
      g_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv reprep button
      g_exclude = cl_gui_alv_grid=>mc_fc_reprep.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv call_chain button
      g_exclude = cl_gui_alv_grid=>mc_fc_call_chain.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv call_more button
      g_exclude = cl_gui_alv_grid=>mc_fc_call_more.
      append g_exclude to g_t_tlbr_excl.
    Exclude alv call_master_data button
      g_exclude = cl_gui_alv_grid=>mc_fc_call_master_data.
      append g_exclude to g_t_tlbr_excl.
    endform.

Maybe you are looking for

  • E66 - "Maximum number of connections in use. Clos...

    When I try to use the web or Google Maps I get an error message: "Maximum number of connections in use. Close an active connection first." I suspect it's related to having a connection going for automatic email but I did not have this message on my N

  • User Defined Fields are read-only for a specific user

    I have a user that has lost her ability to edit user defined fields.  They are all grayed-out for all UDFs, all document types.  Other users have access to these fields.  I've even copied the authorizations from a user not experiencing the problem, b

  • Setting prompt colour and weight

    Hi guys, Im having an issue I would very much appreciate your help with. I have the code below which I want to change the prompt font to bold and red on a post query trigger hence have coded the code below. However it doesnt seem to be setting the pr

  • Can't import mpeg video - not supported

    Production Premium user. The whole purpose of multitracking against video is useless as I've just found out Audition does not support MPEG MPEG-2. I went to the Apple site where I was led to believe that buying the QuickTime MPEG-2 Playback Component

  • Validation Asset Posting

    Hi All, I have a situation. I have created a validation in the asset posting area. The logic is to validate the AUCs before full settlement is run( cj88/ko88 -> full settlement). Activated the validation as well. Am i missing something. Or do i need