Pushbutton creation in alv

Hi All,
I got a question while working with ALV interactive report.
What are possibilities to create a push button on basic list.
Thanks in advance.
regards,
deepthi

hi,
   Can you please elaborate your requirement...
Regards,
Arun

Similar Messages

  • Regarding pushbutton operation in alv report

    hi,
    I have a requiement in which i will get list display which contains certain no of records(let us say 10  records)...now the issue is *if i selet one record and if it is correct record* and if i hit the insert pushbutton it should go and insert into z-table which i hav created.....and if the record which i hav selected is error record.....it should throw an error message saying that it is the error record....as error record stops further process i hav used it as information message and i used 'display like 'E''....so that it wont affect further proceedings.....
    and if i select the 2nd record and if i hit the pushbutton it is taking to the sap initial screen which i dont want .....
    how to solve this issue?
    can anyone plz help me in this issue....

    Hi Needy ,
      M giving you a sample code where you can set your pf-status and how to handle the check box etc .
    This code shows you hoe to select and deselect the check boxes ..
    All that you have to do is apply your logic...
    set pf-status 'SELECT' .
    at user-command .
      describe table t_lpr lines w_lines .
      case sy-ucomm .
        when 'SELECTALL' .
          set pf-status 'SELECT' excluding 'SELECTALL' immediately.
          do w_lines times .
            read line w_line field value w_check . " INTO W_CHECK .
            if w_check = space .
              w_check = 'X' .
              modify line w_line field value w_check.    "INTO W_CHECK .
              add 1 to w_line .
            endif .                        " IF W_CHECK = ' '
          enddo .                          " DO W_LINES TIMES
          clear w_line .
        when 'DESELECT' .
          set pf-status 'SELECT' excluding 'DESELECT' immediately.
          do w_lines times .
            read line w_line field value w_check .
            if w_check = 'X' .
              w_check = space .
              modify line w_line field value w_check .
              add 1 to w_line .
            endif .                        " IF W_CHECK = 'X' .
          enddo .                          " DO W_LINES TIMES
          clear w_line .
         Here w_line : Line that is being read
                 w_lines : Total number of lines in your table(or list if you use 'list number of lines w_lines)
                w_check is my checkbox .
    Hope your need will be done!!
    Much Regards ,
    Amuktha .

  • Directly creation of ALV Variant in Production - Whether possible

    Hi Friends,
    I have a requirement to display few more fields for the standard dunning report . The server version is 4.6C .
    All the required fields are available in field catalogue. I  have to create a new variant to access the new fields also.
    I am totally new to ALV Programs related activities.
    My question is  -
       Can I create the variant directly in Production , or I have to create the variant in Dev and move to TST and Production.
    Please advice.
    Thanks in advance,
    Vengal Rao.

    Hello Vengal,
    Check this thread: ALV layout name for details.
    BR,
    Suhas

  • Button creation in ALV GRID

    hi experts,
    i have a requirement to create a alv grid report and in the output one column should be editable.(till here every thing is correct what i did)
    i have to create a 'update' button to the tool bar of alv output screen so that if i enter my own data in the editable screen,and press 'update' button then my database table should be updated..
    can anyone tell me how to create 'update' button and write code for that.
    my code is as below:
    TABLES: vbak,vbap.
    TYPE-POOLS: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_final,
         vbeln LIKE vbak-vbeln,
         erdat LIKE vbak-erdat,
         matnr LIKE vbap-matnr,
         posnr LIKE vbap-posnr,
         END OF t_final.
    DATA: i_final TYPE STANDARD TABLE OF t_final INITIAL SIZE 0,
          wa_final TYPE t_final.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE slis_layout_alv,
          gd_repid     LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      fieldcatalog-fieldname   = 'VBELN'.
      fieldcatalog-seltext_m   = 'sales order'.
      fieldcatalog-col_pos     = 0.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'ERDAT'.
      fieldcatalog-seltext_m   = 'date'.
      fieldcatalog-col_pos     = 1.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'material no.'.
      fieldcatalog-col_pos     = 2.
      fieldcatalog-edit        = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'POSNR'.
      fieldcatalog-seltext_m   = 'line item no.'.
      fieldcatalog-col_pos     = 3.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    FORM build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    gd_layout-totals_only        = 'X'.
    gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
                                            "click(press f2)
    gd_layout-zebra             = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text       = 'helllllo'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    FORM display_alv_report.
      gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program      = gd_repid
               i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
               i_callback_user_command = 'USER_COMMAND'
               i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_special_groups       = gd_tabgroup
               IT_EVENTS                = GT_XEVENTS
                i_save                  = 'X'
               is_variant              = z_template
           TABLES
                t_outtab                = I_FINAL
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT avbeln aerdat bmatnr bposnr FROM vbak AS a
      INNER JOIN vbap AS b ON avbeln = bvbeln
      INTO TABLE i_final WHERE avbeln = bvbeln.
    ENDFORM.                    " DATA_RETRIEVAL
    points will be rewarded.

    Hi Nani
    TO add a button on alv tool bar and to handle it
    u have to use object oriented approach
    for this u have to define class and implement class in which u will write code inside the method to hadle particlur event
    here is the code for it.
    *& Class z_cl_9_u_EVENT_RECEIVER this class contains the definition
    of methods for handling events
    CLASS  z_cl_9_u_event_receiver DEFINITION DEFERRED.
    DATA : event_receiver TYPE REF TO  z_cl_9_u_event_receiver.
    *data: create object e1 type ref to cl_alv_event_toolbar_set.
    *& Class z_cl_9_u_EVENT_RECEIVER this class contains the definition
    of methods for handling events
    CLASS z_cl_9_u_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.
    ENDCLASS.               "z_cl_9_u_EVENT_RECEIVER
    CLASSES
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    *&       Class (Implementation)   z_cl_9_u_EVENT_RECEIVER
          Add a Update Button On ALV-Toolbar and put the logic
          for handing that button
    *& Class z_cl_9_u_EVENT_RECEIVER this class contains the implementation
    of methods for handling events.
    CLASS  z_cl_9_u_event_receiver IMPLEMENTATION.
    *& Method HANDLE_TOOLBAR is to handle toolbar.
    In event handler method for event TOOLBAR: Append own functions
    by using event parameter E_OBJECT.
      METHOD handle_toolbar.
    In event handler method for event TOOLBAR: Append own functions
      by using event parameter E_OBJECT.
        DATA: L_T_toolbar  TYPE stb_button.
    Append an icon to update tables if country is otherthan NZ.
        IF g_flag = c_x AND g_back NE c_x.
          CLEAR L_T_toolbar.
          MOVE 0 TO L_T_toolbar-butn_type.
          MOVE 'UPDATE' TO L_T_toolbar-function.
          MOVE  icon_modify  TO L_T_toolbar-icon.
          MOVE text-062 TO L_T_toolbar-quickinfo.
          MOVE '' TO L_T_toolbar-text.
          MOVE ' ' TO L_T_toolbar-disabled.
          APPEND L_T_toolbar TO e_object->mt_toolbar.
    In a self defined button, you can disable the button with option DISABLED = 'X'
        ELSEIF g_back = c_x.
          CLEAR L_T_toolbar.
          L_T_toolbar-function = 'UPDATE'.
          L_T_toolbar-butn_type = 0.
          L_T_toolbar-icon = icon_modify.
          L_T_toolbar-quickinfo = text-015.
          L_T_toolbar-disabled = 'X'.
          APPEND L_T_toolbar TO e_object->mt_toolbar.
          CLEAR ok_code.
        ENDIF.
      ENDMETHOD.                    "handle_toolbar
    *& Method HANDLE_USER_COMMAND does processing based on user inputs.
    E_UCOMM has the user command.
      METHOD handle_user_command.
    In event handler method for event USER_COMMAND:
        DATA: L_T_Rows TYPE lvc_t_row,
              L_Size TYPE sy-tabix.
        CASE e_ucomm.
          WHEN 'UPDATE'.
            REFRESH L_T_Rows.
            CALL METHOD alv_grid->get_selected_rows
              IMPORTING
                et_index_rows = L_T_Rows.
            CALL METHOD cl_gui_cfw=>flush.
            DESCRIBE TABLE L_T_Rows LINES L_Size.
            IF L_Size IS INITIAL.
              MESSAGE i071.
            ELSE.
           Execute this subroutines to capture the changed data
          in ALV and pass it to Ztables,
              PERFORM f4700_update_table  TABLES L_T_Rows.
              PERFORM f4800_get_changed_data.
              PERFORM f0500_get_analysis_details USING g_socnr g_matnr.
              CALL METHOD alv_grid->refresh_table_display.
            ENDIF.
        ENDCASE.
      ENDMETHOD.                           "handle_user_command
    ENDCLASS.
    now call these methods wher eever u r calling the alv like in PBO of screen.
    IF g_custom_container IS INITIAL.
        g_t_lvc_s_layo-info_fname = c_l_line_colour.
        g_t_lvc_s_layo-no_keyfix = '1'.   "
        CREATE OBJECT g_custom_container
               EXPORTING container_name = 'CONTAINER_DETAIL'.
        CREATE OBJECT alv_grid
               EXPORTING i_parent = g_custom_container.
        CALL METHOD alv_grid->set_table_for_first_display
          EXPORTING
            i_structure_name = 'structre of table'
            is_layout        = g_t_lvc_s_layo
          CHANGING
            it_outtab        = g_t_outtab[]
            it_fieldcatalog  = g_t_fieldcat.
    *OLY EN01434 BEGIN
    ->Create Object to receive events and link them to handler methods.
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_user_command FOR alv_grid.
        SET HANDLER event_receiver->handle_toolbar FOR alv_grid.
      ELSE. "SUBSEQUENT ITERATIONS:
    F g_custom_container IS INITIAL.
      Layout field 'info-fname' points to the field/column in the
      OUTTAB that controls the colour attribute. (OUTTAB is
      maintained in function Y_DIP_METER_REC_CALCULATION).
        g_t_lvc_s_layo-info_fname = c_l_line_colour.
        g_t_lvc_s_layo-no_keyfix = '1'.   "RSC18Sep02 - allow hor scroll
        CREATE OBJECT g_custom_container
               EXPORTING container_name = 'CONTAINER_DETAIL'.
        CREATE OBJECT alv_grid
               EXPORTING i_parent = g_custom_container.
        CALL METHOD alv_grid->set_table_for_first_display
          EXPORTING
            i_structure_name = 'ZV9NDMRA'
            is_layout        = g_t_lvc_s_layo
          CHANGING
            it_outtab        = g_t_outtab[]
            it_fieldcatalog  = g_t_fieldcat.
    *OLY EN01434 BEGIN
    ->Create Object to receive events and link them to handler methods.
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_user_command FOR alv_grid.
        SET HANDLER event_receiver->handle_toolbar FOR alv_grid.
      ELSE. "SUBSEQUENT ITERATIONS:
    *********SAVE IMPORT PARMAETER IS ADDED BY NEEC
        PERFORM f4900_set_excluding_buttons." USING sy-dynnr.
        CALL METHOD alv_grid->set_table_for_first_display
          EXPORTING
            i_structure_name     = 'ZV9NDMRA'
            is_layout            = g_t_lvc_s_layo
            it_toolbar_excluding = g_t_toolbar_excl
          CHANGING
            it_outtab            = g_t_outtab[]
            it_fieldcatalog      = g_t_fieldcat.
        CALL METHOD alv_grid->set_toolbar_interactive.
        CALL METHOD alv_grid->refresh_table_display.
    I hope it will help to sme extent
    Rewards if helpful and if any help required reply back.....
        CALL METHOD alv_grid->set_table_for_first_display
          EXPORTING
            i_structure_name     = 'ZV9NDMRA'
            is_layout            = g_t_lvc_s_layo
            it_toolbar_excluding = g_t_toolbar_excl
          CHANGING
            it_outtab            = g_t_outtab[]
            it_fieldcatalog      = g_t_fieldcat.
        CALL METHOD alv_grid->set_toolbar_interactive.
        CALL METHOD alv_grid->refresh_table_display.

  • Mulitiple Line Header creation in ALV

    Hi ALV Folks,
       I am trying to display mulitple lines in the ALV column headings like below .Can any one help how can i do this using ALV .
    i need to show like
    Header-A  -
    Header-B------
    hedA1
    HedA2
    HedA3
    HedB1
    HedB2
    HedB3
    dataA1
    dataA2
    dataA3
    dataB1
    dataB2
    dataB3
    dataA1
    dataA2
    dataA3
    dataB1
    dataB2
    dataB3
    dataA1
    dataA2
    dataA3
    dataB1
    dataB2
    dataB3
    dataA1
    dataA2
    dataA3
    dataB1
    dataB2
    dataB3
    dataA1
    dataA2
    dataA3
    dataB1
    dataB2
    dataB3
    dataA1
    dataA2
    dataA3
    dataB1
    dataB2
    dataB3
    Early response will be appriciated .
    Thanks in advance .
    Thanks & Regards,
      Ramesh babu .P

    Hi Ramesh,
    Sad to say that its not possible. you will have to code using the non-ALV approach e.g. WRITE command.
    Cheers,
    Kelvin

  • Header creation in ALV - 3lines - How can ?

    I have created ALV Report already.
    But I am strugling with Header to create like Below : (Could any body help me in coding how to code this below header )
    <Report>                             <Company name>                        <Date>
    <Page>                           ZGXXXX Transmission Report            <Time: >
    <Pd/Yr: >                                                          <System name> 
    Countless Thanks,

    How can I get header ?
    What is the wrong in this coding ?
    REPORT  zgr2245
           NO STANDARD PAGE HEADING
           LINE-SIZE 255
           LINE-COUNT 60
           MESSAGE-ID zg.
                           DATA DECLARATIONS                             *
    INCLUDE zgr2245_top_include.
    *Variant Capture - Data Declaration Include
    INCLUDE zzez410a.
                           SELECTION-SCREEN                              *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS : p_period LIKE bkpf-monat DEFAULT sy-datum+4(2),
                 p_year   LIKE bkpf-gjahr DEFAULT sy-datum(4).
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 .
    SELECT-OPTIONS : s_bukrs  FOR zccod-sp_cocode, " Company code
                     s_reploc FOR zccod-rpt_loc, " Reporting Location Number
                     s_procen FOR zccod-lg_locnum. " Profit center
    SELECTION-SCREEN SKIP 1.
    *PARAMETERS :
    *p_alv LIKE rlgrap-filename DEFAULT '/DEFAULT'.
    For variant
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) text-lay.
    PARAMETERS: p_vari LIKE disvariant-variant DEFAULT '/DEFAULT'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN END OF BLOCK b1.
    Initialization - For ALV variant
    INITIALIZATION.
    PERFORM  read_default_layout.
    &--F4 HELP - FOR ALV VARIANT GET--
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
          EXPORTING
            is_variant = g_variant
            i_save     = g_save
          IMPORTING
            e_exit     = g_exit
            es_variant = gx_variant
          EXCEPTIONS
            not_found  = 2.
        IF sy-subrc = 2.
          MESSAGE ID sy-msgid TYPE 'S'      NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ELSE.
          IF g_exit = space.
            p_vari = gx_variant-variant.
          ENDIF.
       ENDIF.
    &--AT SELECTION-SCREEN.- For ALV Variant--
    AT SELECTION-SCREEN.
    *Getting variant Existence
      PERFORM get_exist_variant.
    START-OF-SELECTION.
    Variant Capture - Start-of-Selection Include
      INCLUDE zzez410b.
      PERFORM read_zccod.
      PERFORM z_gl_get_zgxmit.
      PERFORM alv_display.
    END-OF-SELECTION.
    Variant Capture -  End of Processing Include
       INCLUDE zzez410c.
       INCLUDE zgr2245_routines.
    *&      Form  z_gl_get_zgxmit
    This routine gathers various information for each entry of loop      *
    by calling function module z_gl_get_zgxmit three times               *
    FORM z_gl_get_zgxmit .
    DATA :
          prior_period(2) TYPE c,
          prior_year(4)   TYPE c,
           wa_ktext      LIKE cepct-ktext.
    DATA : wa_lg_locnum  LIKE zgxmit-zprctr,
           wa_year       LIKE zgxmit-zgjahr,
           wa_period     LIKE zgxmit-zmonat.
           wa_year = p_year.
           wa_period = p_period.
      LOOP AT gt_zccod INTO wa_zccod.
       wa_lg_locnum =  wa_zccod-lg_locnum.
      First time Calling FUNCTION 'Z_GL_GET_ZGXMIT'
        CALL FUNCTION 'Z_GL_GET_ZGXMIT'
          EXPORTING
           i_prctr              = wa_lg_locnum
           i_gjahr              = wa_year
           i_monat              = wa_period
         IMPORTING
           e_zgxmit             = wa_zgxmit
         EXCEPTIONS
           no_entry_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.
        ENDIF.
      Second time Calling FUNCTION 'Z_GL_GET_ZGXMIT'
      Before call FM, calculating prior year and prior period.
        p_period =  p_period - 1.
        IF  p_period = 0.
          p_period = '12'.
          p_year   = p_year - 1.
        ENDIF.
        CALL FUNCTION 'Z_GL_GET_ZGXMIT'
          EXPORTING
            i_prctr              = wa_zccod-lg_locnum
            i_gjahr              = p_year
            i_monat              = p_period
          IMPORTING
            e_zgxmit             = wa_zgxmit_p
          EXCEPTIONS
            no_entry_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.
        ENDIF.
      Fill ZCCOD n ZGXMIT values into wa_zgxmit_l.
        wa_zgxmit_l-lg_locnum     = wa_zccod-lg_locnum.
        wa_zgxmit_l-sp_cocode     = wa_zccod-sp_cocode.
        wa_zgxmit_l-corp_pc       = wa_zccod-corp_pc.
        wa_zgxmit_l-cost_ctr      = wa_zccod-cost_ctr.
        wa_zgxmit_l-zgroup        = wa_zccod-zgroup.
        wa_zgxmit_l-disc_ctr      = wa_zccod-disc_ctr.
        wa_zgxmit_l-subsidiary    = wa_zccod-subsidiary.
        wa_zgxmit_l-plant_req     = wa_zccod-plant_req.
        wa_zgxmit_l-blocked_pc    = wa_zccod-blocked_pc.
        wa_zgxmit_l-user_auth     = wa_zccod-user_auth.
        wa_zgxmit_l-p_cocode      = wa_zccod-p_cocode.
        wa_zgxmit_l-indic         = wa_zccod-indic.
        wa_zgxmit_l-rpt_loc       = wa_zgxmit-rpt_loc.
        wa_zgxmit_l-post_to_p01   = wa_zccod-post_to_p01.
        wa_zgxmit_l-late_year_end = wa_zccod-late_year_end.
        wa_zgxmit_l-xmit          = wa_zccod-xmit.
        wa_zgxmit_l-bal_xmit      = wa_zgxmit-bal_xmit.
        wa_zgxmit_l-inc_xmit      = wa_zgxmit-inc_xmit.
        wa_zgxmit_l-z500_xmit     = wa_zgxmit-z500_xmit.
      For prior period fields( RPT_LOC, Z500_XMIT, BAL_XMIT and INC_XMIT )
        wa_zgxmit_l-rpt_loc_p     = wa_zgxmit_p-rpt_loc.
        wa_zgxmit_l-z500_xmit_p   = wa_zgxmit_p-z500_xmit.
        wa_zgxmit_l-bal_xmit_p    = wa_zgxmit_p-bal_xmit.
        wa_zgxmit_l-inc_xmit_p    = wa_zgxmit_p-inc_xmit.
    Compare selected period with the Prior Period
    and assign difference value accordingly.
       IF wa_zgxmit-rpt_loc  <> wa_zgxmit_p-rpt_loc
       OR wa_zgxmit-bal_xmit <> wa_zgxmit_p-bal_xmit
       OR wa_zgxmit-inc_xmit <> wa_zgxmit_p-inc_xmit
       OR wa_zgxmit-z500_xmit <> wa_zgxmit_p-z500_xmit.
         wa_zgxmit_l-difference = '*'.
       ELSE.
         wa_zgxmit_l-difference = ' '.
       ENDIF.
       APPEND wa_zgxmit TO gt_zgxmit.
       CLEAR : wa_zgxmit.
    Third time Calling FUNCTION 'Z_GL_GET_ZGXMIT'
    Concatenate field ZGJAHR, a space and ZMONAT to come up with the
    Period/Year of the Latest Entry.
        CALL FUNCTION 'Z_GL_GET_ZGXMIT'
          EXPORTING
            i_prctr              = wa_zccod-lg_locnum
          I_GJAHR              =
          I_MONAT              =
         IMPORTING
            e_zgxmit             = wa_zgxmit_3
         EXCEPTIONS
            no_entry_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.
        ENDIF.
        CONCATENATE wa_zgxmit_3-zmonat  wa_zgxmit_3-zgjahr
                    INTO wa_zgxmit_l-period_year
                    SEPARATED BY SPACE.
    Gather text information for each location from CEPCT table
        SELECT ktext FROM cepct
                     UP TO 1 ROWS
                     INTO wa_ktext
                     WHERE prctr = wa_zccod-lg_locnum
                     AND   spras = sy-langu.
        ENDSELECT.
        IF sy-subrc <> 0.
          SELECT ktext FROM cepct
                       UP TO 1 ROWS
                       INTO wa_ktext
                       WHERE prctr = wa_zccod-lg_locnum
                       AND   spras = 'E'.
          ENDSELECT.
        ENDIF.
        wa_zgxmit_l-ktext = wa_ktext.
        APPEND wa_zgxmit_l TO gt_zgxmit_l.
        CLEAR : wa_zgxmit, wa_zgxmit_l.
        CLEAR : wa_zccod, wa_ktext.
      ENDLOOP.  " LOOP AT gt_zccod INTO wa_zccod.
    ENDFORM.                    " z_gl_get_zgxmit
    *&      Form  alv_display                                              *
    This subroutine is to display the out put in ALV.                    *
    FORM alv_display .
    Local data
      DATA: y_x          LIKE boole  VALUE 'X'.
      DATA: lh_index     LIKE lf_fieldcat-col_pos.
    For variant
      DATA: ws_repid LIKE sy-repid,
            g_save TYPE c VALUE 'A',     "#EC *)
            g_exit TYPE c.               "#EC *)
      For 1st field.( LG_LOCNUM )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'LG_LOCNUM'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZCCOD'.
        lf_fieldcat-ref_fieldname = 'LG_LOCNUM'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-key = y_x.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
      For ( SP_COCODE )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'SP_COCODE'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZCCOD'.
        lf_fieldcat-ref_fieldname = 'SP_COCODE'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
      For ( CORP_PC )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'CORP_PC'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZCCOD'.
        lf_fieldcat-ref_fieldname = 'CORP_PC'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
      For ( COST_CTR )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'COST_CTR'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZCCOD'.
        lf_fieldcat-ref_fieldname = 'COST_CTR'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
      For ( ZGROUP )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'ZGROUP'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZCCOD'.
        lf_fieldcat-ref_fieldname = 'ZGROUP'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
      For ( DISC_CTR )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'DISC_CTR'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZCCOD'.
        lf_fieldcat-ref_fieldname = 'DISC_CTR'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
      For ( SUBSIDIARY )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'SUBSIDIARY'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZCCOD'.
        lf_fieldcat-ref_fieldname = 'SUBSIDIARY'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
      For ( PLANT_REQ )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'PLANT_REQ'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZCCOD'.
        lf_fieldcat-ref_fieldname = 'PLANT_REQ'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
      For ( BLOCKED_PC )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'BLOCKED_PC'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZCCOD'.
        lf_fieldcat-ref_fieldname = 'BLOCKED_PC'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
      For ( USER_AUTH )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'USER_AUTH'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZCCOD'.
        lf_fieldcat-ref_fieldname = 'USER_AUTH'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
      For ( P_COCODE )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'P_COCODE'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZCCOD'.
        lf_fieldcat-ref_fieldname = 'P_COCODE'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
      For ( INDIC )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'INDIC'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZCCOD'.
        lf_fieldcat-ref_fieldname = 'INDIC'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
      For ( RPT_LOC )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'RPT_LOC'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZCCOD'.
        lf_fieldcat-ref_fieldname = 'RPT_LOC'.
        lf_fieldcat-reptext_ddic  = text-002.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
      For ( POST_TO_P01 )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'POST_TO_P01'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZCCOD'.
        lf_fieldcat-ref_fieldname = 'POST_TO_P01'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
      For ( LATE_YEAR_END )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'LATE_YEAR_END'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZCCOD'.
        lf_fieldcat-ref_fieldname = 'LATE_YEAR_END'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
      For ( XMIT )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'XMIT'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZCCOD'.
        lf_fieldcat-ref_fieldname = 'XMIT'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
    For ( Z500_XMIT )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'Z500_XMIT'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZGXMIT'.
        lf_fieldcat-ref_fieldname = 'Z500_XMIT'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
    For field.( BAL_XMIT )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'BAL_XMIT'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZGXMIT'.
        lf_fieldcat-ref_fieldname = 'BAL_XMIT'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
    For field.( INC_XMIT )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'INC_XMIT'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'ZGXMIT'.
        lf_fieldcat-ref_fieldname = 'INC_XMIT'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
       The prior period information.
    For prior period ( RPT_LOC )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'RPT_LOC_P'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
       lf_fieldcat-ref_tabname = 'ZCCOD'.
       lf_fieldcat-ref_fieldname = 'RPT_LOC'.
        lf_fieldcat-reptext_ddic  = text-004.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
    For prior period ( Z500_XMIT )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'Z500_XMIT_P'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
       lf_fieldcat-ref_tabname = 'ZGXMIT'.
       lf_fieldcat-ref_fieldname = 'Z500_XMIT'.
        lf_fieldcat-reptext_ddic  = text-005.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
    For prior period .( BAL_XMIT )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'BAL_XMIT_P'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
       lf_fieldcat-ref_tabname = 'ZGXMIT'.
       lf_fieldcat-ref_fieldname = 'BAL_XMIT'.
        lf_fieldcat-reptext_ddic  = text-006.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
    For  prior period .( INC_XMIT )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'INC_XMIT_P'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
       lf_fieldcat-ref_tabname = 'ZGXMIT'.
       lf_fieldcat-ref_fieldname = 'INC_XMIT'.
        lf_fieldcat-reptext_ddic  = text-007.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
    For field.( Difference )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'DIFFERENCE'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
       lf_fieldcat-ref_tabname = 'ZGXMIT'.
       lf_fieldcat-ref_fieldname = ''.
        lf_fieldcat-reptext_ddic  = text-003.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
    For field.( period_year )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'PERIOD_YEAR'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
       lf_fieldcat-ref_tabname = 'ZGXMIT'.
       lf_fieldcat-ref_fieldname = ''.
        lf_fieldcat-reptext_ddic  = 'Latest Period/Year'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
    For field.( Z500_XMIT )
        CLEAR lf_fieldcat.
        lf_fieldcat-fieldname = 'KTEXT'.
        lf_fieldcat-tabname = 'GT_ZGXMIT_L'.
        lf_fieldcat-ref_tabname = 'CEPCT'.
        lf_fieldcat-ref_fieldname = 'KTEXT'.
       lf_fieldcat-reptext_ddic  = '0500 Transmit'.
        lh_index = lh_index + 1.
        lf_fieldcat-col_pos = lh_index.
        lf_fieldcat-no_sum = y_x.
        lf_fieldcat-outputlen = '20'.
        APPEND lf_fieldcat TO lt_fieldcat.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'   "#EC *)
          EXPORTING
            i_callback_program                = ws_repid
          I_CALLBACK_PF_STATUS_SET          = ' '
           i_callback_user_command           = 'USER_COMMAND'
          I_CALLBACK_TOP_OF_PAGE            = ' '
          I_STRUCTURE_NAME                  =
          I_BACKGROUND_ID                   = ' '
          I_GRID_TITLE                      =
          I_GRID_SETTINGS                   =
           is_layout                         = v_alv_layout "gx_variant "
           it_fieldcat                       = lt_fieldcat
           IT_SORT                           = sortcat[]
          IT_FILTER                         =
          IS_SEL_HIDE                       =
          I_DEFAULT                         = 'X'
           i_save                            = 'A'
          is_variant                         = g_variant
           it_events                         = it_events[]
          IT_EVENT_EXIT                     =
          IS_PRINT                          =
          IS_REPREP_ID                      =
           TABLES
                t_outtab                 = gt_zgxmit_l
           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.                    " alv_display
    *&      Form  define_event
          text
    -->  p1        text
    <--  p2        text
    FORM define_event .  "#EC CALLED)
    v_prog = sy-repid.
      v_alv_layout-colwidth_optimize = c_x.
      v_alv_layout-zebra = c_x.
      v_alv_layout-detail_popup = 'X'.
      v_alv_layout-info_fieldname = 'COL'.
    Events table
      it_events-name = 'TOP_OF_PAGE'.
      it_events-form = 'TOP_OF_PAGE'.
      APPEND it_events.
    ENDFORM.                                      " define_event
    *&      Form  top_of_page
          Process IP standard page header
    To display TOP_OF_PAGE.
    FORM top_of_page.
    data : v_concate(50) type c.
    data : v_space(10) type c.
    wa_comment-typ = 'S'.
    wa_comment-key = 'Field Name'.
    wa_comment-info = sy-repid.
    append wa_comment to it_comment.
    wa_comment-typ = 'S'.
    wa_comment-key = 'DATE:'.
    wa_comment-info = sy-datum.
    append wa_comment to it_comment.
    wa_comment-typ = 'S'.
    wa_comment-key = 'TIME:'.
    wa_comment-info = sy-timlo.
    append wa_comment to it_comment.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = it_comment.
    clear it_comment.
    ENDFORM.                    "TOP_OF_PAGE

  • Set default focus on pushbutton (dynpro not ALV)

    Dear all
    I created a popup showing a table control and 2 buttons (confirm / abort).
    The user simply wants to push the confirm button to proceed by pressing enter but unfortunatly I see no way to set the focus on that element by default.
    Any help is appreciated.
    Thank's in advance and best regards
    Benno

    Use this in PBO:
    * BUT_CONF is the button for the Confirm
    SET CURSOR FIELD 'BUT_CONF'
    Regards,
    Naimesh Patel

  • 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

  • New Page in ALV GRID display.

    HI Experts,
    I have a requirement of displaying top of page and corresponding detailed records for specific combination of top of page(say plant,material,batch etc). Again for the next combination I need repeated header and detail list.
    I guess I have to use NEW PAGE to get this.
    However, I am using the REUSE ALV GRID DISPLAY for which the sort table does not display as required.
    Could you please help me  on this?
    In addition could you please suggest how to use NEW page in report without using OOPS concept.
    Please reply.
    Thanks,
    Suchi.

    Hi,
    1.Put a pushbutton  on the ALV o/p say 'Next'.
    2. Now in the user comand routine you have to change the  table contents u supply to reuse_alv_commentary write, also fill the o/p internal table with data corresponding to ur specific combination and supply to reuse_alv_grid_display.
    3.In the user comand routine u have  slis_selfield.
    4.It contains a component refresh, mark it as 'X'.( slis_selfield-refresh = 'X'.)
    5.No need of new page or calling reus_alv_grid_display number of times.
    Regards,
    Phani.

  • For all classes used in the alv reports.

    we need the list of required classes used in alv reports this urgent .
    please help me.

    Hi Navid,
    Check <b>SLIS Package/Dev.Class for node Classes</b>,
    here u will find all required <b>classes for ALV including ALV Hierarchical,AVL Tree, ALV HTML.</b>
    Classes.
    CL_ALVHT_HTMLINPUT-> ALV: HTML Input (Control Proxy)
    CL_ALVHT_HTML_PAGE-> ALV HTML Page
    CL_ALVHT_HTML_TEMPLATE-> ALV: HTML Templates
    CL_ALVHT_TAGSTREAM-> ALV
    CL_ALVHT_UI_ELEMENT-> ALV: HTML User Input Element
    CL_ALV_BDS-> BDS Access and Data Retention
    CL_ALV_CHANGED_DATA_PROTOCOL-> Message Log for Data Entry
    CL_ALV_DD_DOUBLE_LISTBOX-> Management Class for two D&D List Boxes
    CL_ALV_DD_LISTBOX-> D&D List Box
    CL_ALV_EVENT_DATA-> Changing Data Container for Events
    CL_ALV_EVENT_TOOLBAR_SET-> ALV Context Menu
    CL_ALV_GRAPHICS-> ALV Graphic (Integration with GFW)
    CL_ALV_GRAPHICS_CU-> Customizing of ALV Graphics
    CL_ALV_LISTBOX_DRAGOBJ->
    CL_ALV_OI BDS-> Access and Data Retention
    CL_ALV_TABLE_CREATE-> Dynamic Creation of ALV Data Table
    CL_ALV_TREE_BASE-> Basis Class ALV Tree Control
    CL_ALV_VARIANT-> ALV Variant Management
    CL_GUI_ALV_GRID-> ALV List Viewer
    CL_GUI_ALV_GRID_BASE-> Basis Class for ALV Grid
    CL_GUI_ALV_TREE-> ALV Tree Control
    Regards,
    Raghav
    Message was edited by:
            Raghavendra  L

  • Configurin alv in web dynpro

    Hi experts ,
           i want to create alv in web dynpro , the structure of table which i want to display in alv is not fixed ,
    so i want to set number of columns ,names of columns  at runtime , Please tell me how i can do this ?

    Hi,
    Please refer to the dynamic creation of ALV using the dynamic structure/fieldcatalog
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4c70444a-0801-0010-7688-9e4bd844b783
    Regards,
    Lekha.

  • Variant in  alv report

    I created one alv report zdisplay_serial  ...the program  gives output as par requirement..my problem is with variant..my requirement is to display all the  variants with that alv  output...plz guide  for this problem...

    Hi
    The variants are managed by the ALV, the system sets the pushbuttons in the ALV status gui to manage them; it makes sure to transfer all main elements to ALV: report and user name.
    TABLES DISVARIANT.
    DISVARIANT-REPORT   = SY-REPID.
    DISVARIANT-USERNAME = SY-UNAME.
    So it needs to transfer it to ALV fm (or OO ALV)
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
              I_CALLBACK_PROGRAM       = GT_REPID
              I_SAVE                   = 'A'
             IS_VARIANT               = DISVARIANT
    But I still don't undesrtand what u need
    Max

  • What are main events in that are used in ALV reports

    hi gurus
    what are main events in that are used in ALV reports....
    regards
    baskar

    hi
    i think this will help u.
    Events in alv and their FM    The main events in alv and their FM and why we use these: 
    1. SLIS_PRINT_ALV. 
    2. SLIS_T_LISTHEADER. 
    3. SLIS_T_EVENT. 
    4. SLIS_T_SORTINFO_ALV. 
    5. SLIS_T_LAYOUT_ALV. 
    6. SLIS_T_FIELDCAT_ALV. 
    and in classic reports what is the sequence of events:   === Events are 
    At selection-screen output. 
    Initialization. 
    At selection-screen on field 
    At selection-screen on end of field 
    At selection-screen on Radiobutton Group R1. (If you have any radio buttons) 
    At selection-screen on block b1. (If you have any blocks) 
    Start-of-selection. 
    Get node. (if the data is retreived from a logical database) 
    Get node late. (if the data is retreived from a logical database) 
    Top-of-page. (if the write statement is in the end-of-selection event or we can say that before the first write statement) 
    end-of-selection. 
    and fuction modules are 
    LISTHEADER - Is used to print the header information in the ALV List. Name, Date, Time, ALV Name and other details are called as Header information.   EVENT - Basically this is the FM to handle Event's. When the user needs to do some event operation like when double clicking the a particular field we need to perform some operation.   These events are captured by this FM.   LAYOUT - This FM is used to define the layout of the List. There are many options available in this FM to define the Layout style.   FIELDCAT - These are used to populate the List header. We can change them according to our req. 
    User-defined Text Output Event
        Application
          print_end_of_list
        Define output text to be printed at the end of the entire list
          print_top_of_list
        Define output text to be printed at the beginning of the entire list
          print_end_of_page
        Define output text to be printed at the end of each page
          print_top_of_page
        Define output text to be printed at the beginning of each page
          subtotal_text
        Define self-defined subtotals texts
    Mouse-controlled Actions in the Grid Control Event
        Application
          button_click
        Query a click on a pushbutton in the ALV Grid Control
          double_click
        Query a double-click on a cell of the ALV Grid control 
          hotspot_click
        Query a hotspot click on columns defined for this purpose in advance
          onDrag
        Collect information when elements of the ALV Grid Control are dragged 
          onDrop
        Process information when elements of the ALV Grid Control are dropped 
          onDropComplete
        Perform final actions after successful Drag&Drop 
          onDropGetFlavor
        Distinguish between options for Drag&Drop behavior
    Processing of Self-defined and Standard Functions Event
        Application
          before_user_command
        Query self-defined and standard function codes
          user_command
        Query self-defined function codes
          after_user_command
        Query self-defined and standard function codes
    Definition of Self-defined Functions Event
        Application
          toolbar
        Change, delete or add GUI elements in the toolbar
          menu_button
        Define menus for menu buttons in the toolbar
          context_menu_request
        Change context menu
          onf1
        Define self-defined F1 help
    All of these can be found under type group SLIS.
    Events
    SLIS_EV_ITEM_DATA_EXPAND        TYPE SLIS_FORMNAME VALUE 'ITEM_DATA_EXPAND',
    SLIS_EV_REPREP_SEL_MODIFY       TYPE SLIS_FORMNAME VALUE 'REPREP_SEL_MODIFY', SLIS_EV_CALLER_EXIT_AT_START TYPE SLIS_FORMNAME VALUE 'CALLER_EXIT',
    SLIS_EV_USER_COMMAND              TYPE SLIS_FORMNAME VALUE 'USER_COMMAND',
    SLIS_EV_TOP_OF_PAGE                     TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
    SLIS_EV_DATA_CHANGED                TYPE SLIS_FORMNAME VALUE 'DATA_CHANGED',
    SLIS_EV_TOP_OF_COVERPAGE       TYPE SLIS_FORMNAME VALUE 'TOP_OF_COVERPAGE',
    SLIS_EV_END_OF_COVERPAGE       TYPE SLIS_FORMNAME VALUE 'END_OF_COVERPAGE',
    SLIS_EV_FOREIGN_TOP_OF_PAGE TYPE SLIS_FORMNAME
    VALUE 'FOREIGN_TOP_OF_PAGE', SLIS_EV_FOREIGN_END_OF_PAGE TYPE SLIS_FORMNAME
    VALUE 'FOREIGN_END_OF_PAGE',
    SLIS_EV_PF_STATUS_SET                  TYPE SLIS_FORMNAME VALUE 'PF_STATUS_SET',
    SLIS_EV_LIST_MODIFY                      TYPE SLIS_FORMNAME VALUE 'LIST_MODIFY',
    SLIS_EV_TOP_OF_LIST                       TYPE SLIS_FORMNAME VALUE 'TOP_OF_LIST',
    SLIS_EV_END_OF_PAGE                    TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE',
    SLIS_EV_END_OF_LIST                      TYPE SLIS_FORMNAME VALUE 'END_OF_LIST',
    SLIS_EV_AFTER_LINE_OUTPUT       TYPE SLIS_FORMNAME VALUE 'AFTER_LINE_OUTPUT', SLIS_EV_BEFORE_LINE_OUTPUT     TYPE SLIS_FORMNAME VALUE 'BEFORE_LINE_OUTPUT',
    SLIS_EV_SUBTOTAL_TEXT                TYPE SLIS_FORMNAME VALUE 'SUBTOTAL_TEXT'.
    with regards
    sravani
    award points if found useful.

  • AlV display in container

    hi abaprs,
    i have displayed my alv in container using cl_gui_alv_grid->set_table_for_first_display, now i have 'edit' button on my screen, i want to make certaion fields of a raw selected by user to editable mode when user
    push that button, i have got few refrences but i cant get the solution, i m looking for some subroutine where i can catch the index of the row selected and switch it to editable mode.
    sample code will be a bonus, and useful answer will be rewarded.
    thanks
    devender.

    Hi,
    Here are a few classes used in ALV, just read through their documentation or look at how they've been implemented in your system and you'll get a good idea on how to use them:
    CL_ALV_EVENT_DATA (Changing Data Container for Events)
    CL_ALV_EVENT_TOOLBAR_SET (ALV Context menu)
    CL_ALV_TABLE_CREATE (Dynamic Creation of ALV Data Table)
    CL_ALV_TREE_BASE (Basis Class ALV Tree Control)
    CL_CK_ALVTREE_NKEY_2_OBJECT (Converter Node Key Object)
    CL_COST_COSTINGVERSION_ALV (Display Costing Versions)
    CL_GUI_ALV_GRID (List Viewer)
    CL_GUI_ALV_GRID_BASE (Basis Class for ALV grid)
    CL_GUI_ALV_TREE (ALV Tree Control)
    CL_GUI_ALV_TREE_SIMPLE (Simple ALV Tree)
    check the below links lot of info and examples r there for OOPS
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    these links
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    1) http://www.erpgenie.com/sap/abap/OO/index.htm
    2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    Check these sample code
    data : begin of it_mara occurs 0,
    mark type flag,
    matnr type matnr,
    mtart type mtart,
    meins type meins,
    end of it_mara.
    data : begin of it_mara1 occurs 0,
    mark type flag,
    matnr type matnr,
    mtart type mtart,
    meins type meins,
    end of it_mara1.
    data : begin of it_mara2 occurs 0,
    mark type flag,
    matnr type matnr,
    mtart type mtart,
    meins type meins,
    end of it_mara2.
    data : t_fieldcat type lvc_t_fcat,
    t_fieldcat1 type lvc_t_fcat,
    s_fieldcat like line of t_fieldcat.
    data : s_layout type lvc_s_layo.
    data : control type ref to cl_gui_custom_container,
    grid type ref to cl_gui_alv_grid.
    data: begin of wa ,
    mark type flag,
    matnr type matnr,
    mtart type mtart,
    meins type meins,
    end of wa.
    class lcl_events_box definition.
    public section.
    methods :
    *Handler_Data_Changed for event Data_Changed of cl_gui_alv_grid
    *imporTing er_data_changed,
    Handler_User_Command for event User_Command of cl_gui_alv_grid
    imporTing e_ucomm,
    Handler_ToolBar for event ToolBar of cl_gui_alv_grid
    importing E_object E_interactive.
    endclass.
    class lcl_events_box implementation.
    method Handler_user_command.
    PERFORM FORM_USERCOMMAND CHANGING E_UCOMM.
    endmethod.
    method Handler_ToolBar.
    PERFORM FORM_TOOLBAR CHANGING E_OBJECT E_INTERACTIVE
    E_OBJECT->MT_TOOLBAR.
    endmethod.
    ENDCLASS.
    start-of-selection.
    data : w_events type ref to lcl_events_box.
    select matnr mtart meins from mara into corresponding fields of table
    it_mara.
    call screen 100.
    *& Module pbo_module OUTPUT
    text
    MODULE pbo_module OUTPUT.
    if GRID is initial.
    CREATE OBJECT CONTROL
    EXPORTING
    CONTAINER_NAME = 'CUST_CTRL'.
    CREATE OBJECT GRID
    EXPORTING
    I_PARENT = CONTROL.
    PERFORM BUILD_CATALOG.
    PERFORM BUILD_CATALOG1.
    PERFORM BUILD_LAYOUT.
    CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    IS_LAYOUT = s_layout
    CHANGING
    IT_OUTTAB = it_mara[]
    IT_FIELDCATALOG = t_fieldcat.
    CREATE OBJECT W_EVENTS.
    SET HANDLER : W_EVENTS->HANDLER_TOOLBAR FOR GRID,
    W_EVENTS->HANDLER_USER_COMMAND FOR GRID.
    CALL METHOD GRID->SET_TOOLBAR_INTERACTIVE.
    ELSE.
    call method grid->refresh_table_display.
    ENDIF.
    ENDMODULE. " pbo_module OUTPUT
    *& Form BUILD_CATALOG
    FORM BUILD_CATALOG .
    S_FIELDCAT-COL_POS = '1'.
    S_FIELDCAT-FIELDNAME = 'MARK'.
    S_FIELDCAT-CHECKBOX = 'X'.
    S_FIELDCAT-eDIT = 'X'.
    APPEND S_FIELDCAT TO T_FIELDCAT.
    CLEAR S_FIELDCAT.
    S_FIELDCAT-COL_POS = '2'.
    S_FIELDCAT-FIELDNAME = 'MATNR'.
    S_FIELDCAT-SCRTEXT_M = 'MATERIAL'.
    APPEND S_FIELDCAT TO T_FIELDCAT.
    S_FIELDCAT-COL_POS = '3'.
    S_FIELDCAT-FIELDNAME = 'MTART'.
    S_FIELDCAT-SCRTEXT_M = 'MATERL TYPE'.
    APPEND S_FIELDCAT TO T_FIELDCAT.
    S_FIELDCAT-COL_POS = '4'.
    S_FIELDCAT-FIELDNAME = 'MEINS'.
    S_FIELDCAT-SCRTEXT_M = 'UOM'.
    APPEND S_FIELDCAT TO T_FIELDCAT.
    ENDFORM. " BUILD_CATALOG
    *& Form BUILD_LAYOUT
    text
    --> p1 text
    <-- p2 text
    FORM BUILD_LAYOUT .
    S_LAYOUT-ZEBRA = 'X'.
    S_LAYOUT-CWIDTH_OPT = 'X'.
    S_LAYOUT-GRID_TITLE = 'Material Details'.
    ENDFORM.
    " BUILD_LAYOUT////////////////////////////////////
    " USER_COMMAND_0100 INPUT
    *& Form FORM_USERCOMMAND
    text
    <--P_E_UCOMM text
    form FORM_USERCOMMAND changing p_e_ucomm.
    CASE P_E_UCOMM.
    WHEN 'INT1'.
    DO.
    READ TABLE IT_MARA INDEX SY-INDEX TRANSPORTING MARK MATNR.
    IF SY-SUBRC 0.
    EXIT.
    ENDIF.
    IF IT_MARA-MARK = 'X'.
    read table it_mara into wa TRANSPORTING MATNR MTART MEINS .
    MOVE-CORRESPONDING WA TO IT_MARA1.
    READ TABLE IT_MARA1 TRANSPORTING MATNR MTART MEINS .
    MOVE-CORRESPONDING IT_MARA1 TO IT_MARA2.
    APPEND IT_MARA2.
    CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    IS_LAYOUT = s_layout
    CHANGING
    IT_OUTTAB = it_mara2[]
    IT_FIELDCATALOG = t_fieldcat1.
    SET PARAMETER ID 'MAT' FIELD IT_MARA-MATNR.
    CALL TRANSACTION 'MM02'.
    . ENDIF.
    ENDIF.
    ENDDO.
    ENDCASE.
    endform. " FORM_USERCOMMAND
    *& Form FORM_TOOLBAR
    text
    <--P_E_OBJECT text
    <--P_E_INTERACTIVE text
    <--P_E_OBJECT_>MT_TOOLBAR text
    FORM FORM_TOOLBAR CHANGING P_E_OBJECT TYPE REF TO
    CL_ALV_EVENT_TOOLBAR_SET
    P_E_INTERACTIVE
    MT_TOOLBAR TYPE TTB_BUTTON.
    DATA WAL_BUTTON TYPE STB_BUTTON.
    *WAL_BUTTON-ICON = ICON_status_reverse.
    WAL_BUTTON-TEXT = 'GO'.
    WAL_BUTTON-QUICKINFO = 'PROCEED'.
    waL_button-FUNCTION = 'INT1'.
    WAL_BUTTON-BUTN_TYPE = 0.
    WAL_BUTTON-DISABLED = SPACE.
    insert WAL_BUTTON INTO P_E_OBJECT->MT_TOOLBAR index 1.
    endform. " FORM_TOOLBAR
    *& Module PF-STATUS OUTPUT
    text
    module PF-STATUS output.
    set pf-status 'Z7PSTAT'.
    endmodule. " PF-STATUS OUTPUT
    *& Module USER_COMMAND_0100 INPUT
    text
    module USER_COMMAND_0100 input.
    CASE SY-UCOMM.
    WHEN 'BACK'.
    LEAVE PROGRAM.
    WHEN 'CANCEL'.
    LEAVE PROGRAM.
    ENDCASE.
    endmodule. " USER_COMMAND_0100 INPUT
    *& Form BUILD_CATALOG1
    text
    --> p1 text
    <-- p2 text
    form BUILD_CATALOG1 .
    S_FIELDCAT-COL_POS = '1'.
    S_FIELDCAT-FIELDNAME = 'MATNR'.
    S_FIELDCAT-SCRTEXT_M = 'MATERIAL'.
    APPEND S_FIELDCAT TO T_FIELDCAT1.
    S_FIELDCAT-COL_POS = '2'.
    S_FIELDCAT-FIELDNAME = 'MTART'.
    S_FIELDCAT-SCRTEXT_M = 'MATERL TYPE'.
    APPEND S_FIELDCAT TO T_FIELDCAT1.
    S_FIELDCAT-COL_POS = '3'.
    S_FIELDCAT-FIELDNAME = 'MEINS'.
    S_FIELDCAT-SCRTEXT_M = 'UOM'.
    APPEND S_FIELDCAT TO T_FIELDCAT1.
    endform. " BUILD_CATALOG1
    check the below link may be useful for you
    http://www.sapdevelopment.co.uk/reporting/alvhome.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
    Simple ALV report
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Go thru these programs they may help u to try on some hands on
    ALV Demo program
    BCALV_DEMO_HTML
    BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
    BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
    BCALV_GRID_DEMO Simple ALV Control Call Demo Program
    BCALV_TREE_DEMO Demo for ALV tree control
    BCALV_TREE_SIMPLE_DEMO
    BC_ALV_DEMO_HTML_D0100
    Regards,
    Shiva

Maybe you are looking for