End of list in alv help

hello experts,
i want to display the following format in the end of the list of the ALV. the report actually has a grid structure and a list header , and now i want to add the following to the end of the list.
                                         bed                   pecess                      she cess
opening balance
credit from manufacturer
credit from dealer
credit from import
total credit available
debit
closing balance
The major problem here is the alignment.
pls kindly help me if there are key words that can used for the aligning in the end-of-the-list.
so far i have used the ***-typ and ***-info to display but i am not able to achieve what was required.
And i want to know how to add the variables for eg: in the table above i have three variables to fill each row , but how do i achieve it. plz kindly help me if possible with some sample codes.
Thanks in Advance.
Edited by: Arun Pandian on Nov 26, 2008 7:33 AM

Refer this link:
http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm
Regards,
Ravi

Similar Messages

  • End of List

    Hi
    How can i print after end of list in alv.
    I have a list with columns like
    empcode(100),name(abc),gender(male),share(1)
    empcode(101),name(bcd),gender(male),share(1)
    empcode(102),name(eef),gender(female),share(1)
    empcode(102),name(ghi),gender(female),share(1)
    Total share = 4.
    I want to display male share 2 and female share 2
    Plz tell me on this.

    Hi,
    use end-of-list event to call a form in your program dynamically:
    <pre>
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       I_CALLBACK_PROGRAM             = '<your programs name'
       IT_EVENTS                      = <event table>
    </pre>
    Use
    type-pools:
      slis.
    declare an event table type slis_t_event
    append a record with
    <event>-name =  'END_OF_LIST'.
    <event>-form = 'ALV_END_OF_LIST'.
    Then you have a FORM ALV_END_OF_LIST in your program. It is calle after list output. Here you can write whatever you want - i.a. gender share.
    Regards,
    Clemens

  • END OF PAGE IN ALV LIST

    Hi All,
    I am generating the report output in ALV list and downloading in the PDF format. It is working fine.
    But I am not able to print last line(AS SOME TEXT) on each page of the report. I think the output of report in ALV LIST does not show the END OF PAGE, But It should show once we take print out.
    Please let me know.
    Waiting for reply.
    Thanks,
    Rakesh Singh

    Rakesh,
    END OF PAGE can be found in ALV Printout, you can't see it in Display. So if you download as PDF without printing, it is normal not to display END-OF-PAGE.
    You can print your report and you can see the END-OF-PAGE in spool and maybe you can convert this spool as PDF. Otherwise you won't use END-OF-PAGE.
    Look at these links, same topic:
    End of page in ALV reports
    ALV - END_OF_PAGE event
    http://help.sap.com/saphelp_webas630/helpdata/en/ee/c8e071d52611d2b468006094192fe3/content.htm
    End of Page event not triggering in ALV report

  • End of page in alv list output.

    Hi All,
    Can any body help me out for how to show end of page in alv list output.
    Thanks,
    Rakesh Singh

    Refer this link:
    http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm
    Regards,
    Ravi

  • How to handle interactive list in alv reports

    hi experts.
    how to handle interactive list in alv reports.
    regards.
    subhasis

    HI Subhasis,
    below is the sample code for handling an interactive ALV report, hope this helps you ..
    REPORT  ZTEST_ALV123.                           
    TYPE-POOLS:SLIS.
    DATA :   IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
              IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV.
    DATA: BEGIN OF ITAB OCCURS 0,
           VBELN LIKE VBAK-VBELN,
           POSNR LIKE VBAP-POSNR,
           END OF ITAB.
    DATA: BEGIN OF ITAB1 OCCURS 0,
           VBELN LIKE LIKP-VBELN,
           POSNR LIKE LIPS-POSNR,
           VGBEL LIKE LIPS-VGBEL,
           VGPOS LIKE LIPS-VGPOS,
           END OF ITAB1.
    DATA: IT_LIPS LIKE ITAB1 OCCURS 0 WITH HEADER LINE.
    SELECT  VBELN
            POSNR
            FROM VBAP
            INTO TABLE ITAB.
    IF SY-SUBRC = 0.
      SORT ITAB BY VBELN .
      SELECT VBELN
       POSNR
       VGBEL
       VGPOS
       INTO TABLE ITAB1
       FROM LIPS
       FOR ALL ENTRIES IN ITAB
       WHERE VGBEL = ITAB-VBELN
         AND    VGPOS = ITAB-POSNR.
    ENDIF.
    DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    X_FIELDCAT-FIELDNAME = 'VBELN'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS  = 1.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    X_FIELDCAT-FIELDNAME = 'POSNR'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS  = 1.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        I_CALLBACK_PROGRAM       = SY-REPID
        I_CALLBACK_PF_STATUS_SET = 'PFSTATUS'
        I_CALLBACK_USER_COMMAND  = 'HANDLE_USER_COMMAND'
        IT_FIELDCAT              = IT_FIELDCAT
      TABLES
        T_OUTTAB                 = ITAB
      EXCEPTIONS
        PROGRAM_ERROR            = 1
        OTHERS                   = 2.
    IF SY-SUBRC  = 0.
    ENDIF.
    *&      Form  POPUP
          text
         -->P_EXTAB    text
    FORM POPUP USING P_EXTAB TYPE SLIS_T_EXTAB.
    "here double click on PFSTATUS and create the status, "activate, before that set PICK for choose(F2).
    *- Pf status
      SET PF-STATUS 'PFSTATUS'.
    ENDFORM.                 " POPUP
    *&      Form  HANDLE_USER_COMMAND
          text
         -->R_UCOMM      text
         -->RS_SELFIELD  text
    FORM HANDLE_USER_COMMAND USING R_UCOMM     LIKE SY-UCOMM
                                   RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN '&IC1'.
          IF RS_SELFIELD-FIELDNAME = 'VBELN'.
            READ TABLE ITAB INDEX RS_SELFIELD-TABINDEX.
            LOOP AT ITAB1 WHERE VGBEL = ITAB-VBELN
                              AND VGPOS = ITAB-POSNR.
              MOVE-CORRESPONDING ITAB1 TO IT_LIPS.
              APPEND IT_LIPS.
            ENDLOOP.
            PERFORM INTERACTIVE_REPORT.
          ENDIF.
      ENDCASE.
    ENDFORM.                    "HANDLE_USER_COMMAND
    *&      Form  interactive_report
          text
    FORM INTERACTIVE_REPORT .
      X_FIELDCAT-FIELDNAME = 'VBELN'.
      X_FIELDCAT-SELTEXT_L = 'VBELN'.
      X_FIELDCAT-TABNAME = 'IT_LIPS'.
      X_FIELDCAT-COL_POS  = 1.
      APPEND X_FIELDCAT TO IT_FIELDCAT1.
      CLEAR X_FIELDCAT.
      X_FIELDCAT-FIELDNAME = 'POSNR'.
      X_FIELDCAT-SELTEXT_L = 'ITEM'.
      X_FIELDCAT-TABNAME = 'IT_LIPS'.
      X_FIELDCAT-COL_POS  = 2.
      APPEND X_FIELDCAT TO IT_FIELDCAT1.
      CLEAR X_FIELDCAT.
      X_FIELDCAT-FIELDNAME = 'VGBEL'.
      X_FIELDCAT-SELTEXT_M = 'SO #'.
      X_FIELDCAT-TABNAME = 'IT_LIPS'.
      X_FIELDCAT-COL_POS  = 3.
      APPEND X_FIELDCAT TO IT_FIELDCAT1.
      CLEAR X_FIELDCAT.
      X_FIELDCAT-FIELDNAME = 'VGPOS'.
      X_FIELDCAT-SELTEXT_M = 'SO ITEM'.
      X_FIELDCAT-TABNAME = 'IT_LIPS'.
      X_FIELDCAT-COL_POS  = 4.
      APPEND X_FIELDCAT TO IT_FIELDCAT1.
      CLEAR X_FIELDCAT.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = SY-REPID
          IT_FIELDCAT        = IT_FIELDCAT1
        TABLES
          T_OUTTAB           = IT_LIPS
        EXCEPTIONS
          PROGRAM_ERROR      = 1
          OTHERS             = 2.
      IF SY-SUBRC  = 0.
      ENDIF.
    ENDFORM.                    " interactive_report
    Regards,
    Ranjita
    null

  • Drop down list in alv tree

    Hi,
    I am developing an ALV TREE. I need help Its really urgent. In the output screen there will be 2 level nodes. in the item line 1 field should be input enabled using which the database table is to be modified.when user left clicks on this field a drop down list will appear from which he selects his choice.
    I looked into BCALV_TREE_SIMPLE_DEMO reports available in SAP.
    I would also like to know what is register_events, what is an handler.
    help me.
    Edited by: Sudipa Das on Oct 4, 2008 11:53 AM
    Edited by: Sudipa Das on Oct 4, 2008 11:53 AM
    Edited by: Sudipa Das on Oct 4, 2008 11:54 AM

    Hello Sudipa
    I do not think you can have editable fields other than checkboxes in ALV trees. In sample report ZUS_SDN_ALV_TREE_DEMO_1 I have set the fieldcatalog property LS_FCAT-EDIT = 'X' for all fields yet only LOEVM is editable because it is defined as checkbox, too.
    However, you may use the LINK_CLICK of the ALV tree (set LS_FCAT-HOTSPOT = 'X' in fieldcatalog) to trigger e.g. a seach help for input.
    *& Report  ZUS_SDN_ALV_TREE_DEMO
    *& Thread: drop down list in alv tree
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1074082"></a>
    *& Thread: alv tree checbox problem when attempt to get the selected checjboxes
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1050473"></a>
    *& Thread: alv tree checkbox problem
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1046535"></a>
    *& Thread: double click in ALV tree output????
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="742412"></a>
    *& Flow logic of screen '0100' (contains no screen elements):
    **  PROCESS BEFORE OUTPUT.
    **    MODULE STATUS_0100.
    **  PROCESS AFTER INPUT.
    **    MODULE USER_COMMAND_0100.
    *& user-command (for command window): DISPLAY, SELECTED_NODES
    REPORT  zus_sdn_alv_tree_demo_1.
    CLASS cl_gui_column_tree DEFINITION LOAD.
    CLASS cl_gui_cfw DEFINITION LOAD.
    TYPE-POOLS: abap, shlp.
    TYPES: BEGIN OF ty_s_key.
    TYPES: nkey       TYPE lvc_nkey.
    TYPES: parent_key TYPE lvc_nkey.
    TYPES: END OF ty_s_key.
    TYPES: BEGIN OF ty_s_outtab.
    INCLUDE TYPE knvv AS data.
    INCLUDE TYPE ty_s_key AS key.
    TYPES: END OF ty_s_outtab.
    TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                          WITH DEFAULT KEY.
    DATA: gt_outtab    TYPE ty_t_outtab.
    DATA:
      gd_okcode        TYPE ui_func,
      gd_repid         TYPE syst-repid,
      gt_fcat          TYPE lvc_t_fcat,
      gs_layout        TYPE lvc_s_layo,
      gs_variant       TYPE disvariant,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_tree          TYPE REF TO cl_gui_alv_tree.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
        handle_node_double_click
          FOR EVENT node_double_click OF cl_gui_alv_tree
          IMPORTING node_key,
        handle_item_double_click
          FOR EVENT item_double_click OF cl_gui_alv_tree
          IMPORTING node_key
                    fieldname,
        handle_checkbox_change
          FOR EVENT checkbox_change OF cl_gui_alv_tree
          IMPORTING checked
                    fieldname
                    node_key,
        handle_link_click
          FOR EVENT link_click OF cl_gui_alv_tree
          IMPORTING fieldname
                    node_key.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_node_double_click.
        MESSAGE 'Event=Double-Click on Node' TYPE 'I'.
        CALL TRANSACTION 'XD03'.
      ENDMETHOD.                    "handle_node_double_click
      METHOD handle_item_double_click.
        MESSAGE 'Event=Double-Click on Item' TYPE 'I'.
        CALL TRANSACTION 'VA03'.
      ENDMETHOD.                    "handle_item_double_click
      METHOD handle_checkbox_change.
        DATA: ls_outtab     TYPE ty_s_outtab.
        BREAK-POINT.
        IF ( fieldname = 'LOEVM' ).
          CALL METHOD go_tree->get_outtab_line
            EXPORTING
              i_node_key     = node_key
            IMPORTING
              e_outtab_line  = ls_outtab
    *          e_node_text    =
    *          et_item_layout =
    *          es_node_layout =
            EXCEPTIONS
              node_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.
          ENDIF.
          ls_outtab-loevm = checked.
          MODIFY gt_outtab FROM ls_outtab
            TRANSPORTING loevm
            WHERE ( nkey = node_key ).
        ENDIF.
        " Trigger PAI
        CALL METHOD cl_gui_cfw=>set_new_ok_code
          EXPORTING
            new_code = 'REFRESH'
    *        IMPORTING
    *          rc       =
      ENDMETHOD.                    "handle_checkbox_change
      METHOD handle_link_click.
        data: ls_shlp         type SHLP_DESCR,
              lt_retvalues    type STANDARD TABLE OF DDSHRETVAL.
        BREAK-POINT.
        CALL FUNCTION 'F4IF_GET_SHLP_DESCR'
          EXPORTING
            shlpname       = 'USER_COMP'
    *       SHLPTYPE       = 'SH'
          IMPORTING
            SHLP           = ls_shlp.
        CALL FUNCTION 'F4IF_START_VALUE_REQUEST'
          EXPORTING
            shlp                = ls_shlp
    *       DISPONLY            = ' '
    *       MAXRECORDS          = 500
    *       MULTISEL            = ' '
    *       CUCOL               = SY-CUCOL
    *       CUROW               = SY-CUROW
    *     IMPORTING
    *       RC                  =
          tables
            return_values       = lt_retvalues.
      ENDMETHOD.                    "handle_link_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      PERFORM init_controls.
      gd_repid = syst-repid.
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = gd_repid
          dynnr                       = '0100'
    *      container                   =
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          lifetime_dynpro_dynpro_link = 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.
      CALL SCREEN '0100'.
    ** NOTE: no elements on screen
    **  PROCESS BEFORE OUTPUT.
    **    MODULE STATUS_0100.
    **  PROCESS AFTER INPUT.
    **    MODULE USER_COMMAND_0100.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      TRANSLATE gd_okcode TO UPPER CASE.
      CASE gd_okcode.
        WHEN 'BACK'  OR
             'EXIT'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN 'REFRESH'.
          CALL METHOD go_tree->update_calculations
    *        EXPORTING
    *          no_frontend_update =
        WHEN 'SELECTED_NODES'.
          PERFORM get_selected_nodes.
        WHEN 'DISPLAY'.
          PERFORM display.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  init_controls
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM init_controls .
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent = cl_gui_container=>screen0
          ratio  = 90
        EXCEPTIONS
          OTHERS = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * create tree control
      CREATE OBJECT go_tree
        EXPORTING
          parent                      = go_docking
          node_selection_mode         = cl_gui_column_tree=>node_sel_mode_multiple
          item_selection              = 'X'  " required for double-click event on item
          no_html_header              = ''
          no_toolbar                  = ''
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          illegal_node_selection_mode = 5
          failed                      = 6
          illegal_column_name         = 7.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
      ENDIF.
    * create Hierarchy-header
      DATA ls_hierarchy_header TYPE treev_hhdr.
      PERFORM build_hierarchy_header CHANGING ls_hierarchy_header.
      PERFORM build_fieldcatalog.
      PERFORM set_layout_and_variant.
    * create emty tree-control
      CALL METHOD go_tree->set_table_for_first_display
        EXPORTING
    **      i_structure_name     = 'KNVV'
          is_variant           = gs_variant
          i_save               = 'A'
    *      i_default            = 'X'
          is_hierarchy_header  = ls_hierarchy_header
    *      is_exception_field   =
    *      it_special_groups    =
    *      it_list_commentary   =
    *      i_logo               =
    *      i_background_id      =
    *      it_toolbar_excluding =
    *      it_except_qinfo      =
        CHANGING
          it_outtab            = gt_outtab
    *      it_filter            =
          it_fieldcatalog      = gt_fcat.
    * create hierarchy
      PERFORM create_hierarchy.
    * register events
      PERFORM register_events.
    * adjust column_width
      CALL METHOD go_tree->column_optimize.
    ENDFORM.                    " init_controls
    *&      Form  build_hierarchy_header
    *       build hierarchy-header-information
    *      -->P_L_HIERARCHY_HEADER  strucxture for hierarchy-header
    FORM build_hierarchy_header CHANGING
                                   p_hierarchy_header TYPE treev_hhdr.
      p_hierarchy_header-heading = 'Hierarchy Header'.          "#EC NOTEXT
      p_hierarchy_header-tooltip =
                             'This is the Hierarchy Header !'.  "#EC NOTEXT
      p_hierarchy_header-width = 30.
      p_hierarchy_header-width_pix = ''.
    ENDFORM.                               " build_hierarchy_header
    *&      Form  BUILD_FIELDCATALOG
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog .
      DATA: ls_fcat   TYPE lvc_s_fcat.
      REFRESH: gt_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'KNVV'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
          i_bypassing_buffer           = 'X'
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 2
          OTHERS                       = 3.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      DELETE gt_fcat FROM 10.
      ls_fcat-tech = 'X'.
      MODIFY gt_fcat FROM ls_fcat
        TRANSPORTING tech
        WHERE ( key = 'X' ).
      ls_fcat-edit = 'X'.
      MODIFY gt_fcat FROM ls_fcat
        TRANSPORTING edit
        WHERE ( key NE 'X' ).
      READ TABLE gt_fcat INTO ls_fcat
           WITH KEY fieldname = 'LOEVM'.
      IF ( syst-subrc = 0 ).
        ls_fcat-checkbox = 'X'.
        ls_fcat-edit     = 'X'.
    **    ls_fcat-hotspot  = 'X'.
        MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
      ENDIF.
      READ TABLE gt_fcat INTO ls_fcat
           WITH KEY fieldname = 'ERNAM'.
      IF ( syst-subrc = 0 ).
        ls_fcat-hotspot  = 'X'.
        MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
      ENDIF.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  SET_LAYOUT_AND_VARIANT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM set_layout_and_variant .
      CLEAR: gs_layout,
             gs_variant.
      gs_variant-report = syst-repid.
      gs_variant-handle = 'TREE'.
    ENDFORM.                    " SET_LAYOUT_AND_VARIANT
    *&      Form  create_hierarchy
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM create_hierarchy .
      DATA: ls_knvv     TYPE sflight,
            ld_idx      TYPE i,
            ls_outtab   TYPE ty_s_outtab,
            lt_outtab   TYPE ty_t_outtab.
    * get data
      SELECT * FROM knvv INTO CORRESPONDING FIELDS OF TABLE lt_outtab
                            UP TO 20 ROWS .                 "#EC CI_NOWHERE
      SORT lt_outtab BY kunnr vkorg.
    * add data to tree
      DATA: ld_root_key  TYPE lvc_nkey,
            ld_kunnr_key TYPE lvc_nkey,
            ld_vkorg_key TYPE lvc_nkey,
            ld_last_key  TYPE lvc_nkey.
      ld_idx = 0.
      LOOP AT lt_outtab INTO ls_outtab.
        AT FIRST.
          PERFORM add_root_line USING    ls_outtab-data
                                  CHANGING ld_root_key.
          ADD 1 TO ld_idx.
          ls_outtab-nkey       = ld_root_key.
          ls_outtab-parent_key = space.
          MODIFY gt_outtab FROM ls_outtab INDEX ld_idx
            TRANSPORTING key.
        ENDAT.
        ON CHANGE OF ls_outtab-kunnr.
          PERFORM add_customer_line USING    ls_outtab-data
                                             ld_root_key
                                  CHANGING ld_kunnr_key.
          ADD 1 TO ld_idx.
          ls_outtab-nkey       = ld_kunnr_key.
          ls_outtab-parent_key = ld_root_key.
          MODIFY gt_outtab FROM ls_outtab INDEX ld_idx
            TRANSPORTING key.
        ENDON.
        ON CHANGE OF ls_outtab-vkorg.
          PERFORM add_salesorg_line USING    ls_outtab-data
                                             ld_kunnr_key
                                  CHANGING ld_vkorg_key.
          ADD 1 TO ld_idx.
          ls_outtab-nkey       = ld_vkorg_key.
          ls_outtab-parent_key = ld_kunnr_key.
          MODIFY gt_outtab FROM ls_outtab INDEX ld_idx
            TRANSPORTING key.
        ENDON.
        PERFORM add_complete_line USING  ls_outtab-data
                                         ld_vkorg_key
                                CHANGING ld_last_key.
        ADD 1 TO ld_idx.
        ls_outtab-nkey       = ld_last_key.
        ls_outtab-parent_key = ld_vkorg_key.
        MODIFY gt_outtab FROM ls_outtab INDEX ld_idx
          TRANSPORTING key.
      ENDLOOP.
    * calculate totals
      CALL METHOD go_tree->update_calculations.
    * this method must be called to send the data to the frontend
      CALL METHOD go_tree->frontend_update.
    ENDFORM.                    " create_hierarchy
    *&      Form  add_customer_line
    *       add hierarchy-level 1 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    FORM add_root_line USING     us_data TYPE ty_s_outtab-data
                                 ud_relat_key TYPE lvc_nkey
                         CHANGING  cd_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value,
            ls_data TYPE ty_s_outtab-data.
    * set item-layout
      DATA: lt_item_layout TYPE lvc_t_layi,
            ls_item_layout TYPE lvc_s_layi.
      ls_item_layout-t_image = '@3Q@'.  " icon_overview
      ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
      ls_item_layout-style   =
                            cl_gui_column_tree=>style_intensifd_critical.
      APPEND ls_item_layout TO lt_item_layout.
    * add node
      l_node_text =  'Overview: Sales Areas'.
      DATA: ls_node TYPE lvc_s_layn.
      ls_node-n_image   = space.
      ls_node-exp_image = space.
      CALL METHOD go_tree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = l_node_text
          is_outtab_line   = ls_data
          is_node_layout   = ls_node
          it_item_layout   = lt_item_layout
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                               " add_root_line
    *&      Form  add_customer_line
    *       add hierarchy-level 1 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    FORM add_customer_line USING     us_data TYPE ty_s_outtab-data
                                     ud_relat_key TYPE lvc_nkey
                         CHANGING  cd_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value,
            ls_data TYPE ty_s_outtab-data.
    * set item-layout
      DATA: lt_item_layout TYPE lvc_t_layi,
            ls_item_layout TYPE lvc_s_layi.
      ls_item_layout-t_image = '@A0@'.  " icon_customer.
      ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
      ls_item_layout-style   =
                            cl_gui_column_tree=>style_intensifd_critical.
      APPEND ls_item_layout TO lt_item_layout.
    * add node
      l_node_text =  us_data-kunnr.
      DATA: ls_node TYPE lvc_s_layn.
      ls_node-n_image   = space.
      ls_node-exp_image = space.
      CALL METHOD go_tree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = l_node_text
          is_outtab_line   = ls_data
          is_node_layout   = ls_node
          it_item_layout   = lt_item_layout
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                               " add_customer_line
    *&      Form  add_salesorg_line
    *       add hierarchy-level 1 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    FORM add_salesorg_line USING     us_data TYPE ty_s_outtab-data
                                     ud_relat_key TYPE lvc_nkey
                         CHANGING  cd_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value,
            ls_data TYPE ty_s_outtab-data.
    * set item-layout
      DATA: lt_item_layout TYPE lvc_t_layi,
            ls_item_layout TYPE lvc_s_layi.
      ls_item_layout-t_image = '@DS@'.  " ICON_PARTNER_SALES_ACTIVITY
      ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
      ls_item_layout-style   =
                            cl_gui_column_tree=>style_intensifd_critical.
      APPEND ls_item_layout TO lt_item_layout.
    * add node
      l_node_text =  us_data-vkorg.
      DATA: ls_node TYPE lvc_s_layn.
      ls_node-n_image   = space.
      ls_node-exp_image = space.
      CALL METHOD go_tree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = l_node_text
          is_outtab_line   = ls_data
          is_node_layout   = ls_node
          it_item_layout   = lt_item_layout
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                               " add_salesorg_line
    *&      Form  add_cmplete_line
    *       add hierarchy-level 3 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    FORM add_complete_line USING     us_data TYPE ty_s_outtab-data
                                     ud_relat_key TYPE lvc_nkey
                         CHANGING  cd_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value.
    * set item-layout
      DATA: lt_item_layout TYPE lvc_t_layi,
            ls_item_layout TYPE lvc_s_layi.
      ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
      ls_item_layout-class   = cl_gui_column_tree=>item_class_checkbox.
      ls_item_layout-editable = 'X'.
      APPEND ls_item_layout TO lt_item_layout.
    **  clear: ls_item_layout.
    **  ls_item_layout-fieldname = 'BEGRU'.
    **  ls_item_layout-class   = cl_gui_column_tree=>ITEM_CLASS_CHECKBOX.
    **  ls_item_layout-editable = 'X'.
    **  APPEND ls_item_layout TO lt_item_layout.
    **  CLEAR ls_item_layout.
    **  ls_item_layout-fieldname = 'PLANETYPE'.
    **  ls_item_layout-alignment = cl_gui_column_tree=>align_right.
    **  APPEND ls_item_layout TO lt_item_layout.
      l_node_text =  us_data-vtweg.
      DATA: ls_node TYPE lvc_s_layn.
      ls_node-n_image   = space.
      ls_node-exp_image = space.
      CALL METHOD go_tree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          is_outtab_line   = us_data
          i_node_text      = l_node_text
          is_node_layout   = ls_node
          it_item_layout   = lt_item_layout
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                               " add_complete_line
    *&      Form  register_events
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM register_events.
    * define the events which will be passed to the backend
      DATA: lt_events TYPE cntl_simple_events,
            l_event TYPE cntl_simple_event.
    * define the events which will be passed to the backend
      l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
      APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
    **  APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
    **  APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
    **  APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_header_click.
    **  APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
    **  APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_link_click.
      APPEND l_event TO lt_events.
      CALL METHOD go_tree->set_registered_events
        EXPORTING
          events                    = lt_events
        EXCEPTIONS
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
      ENDIF.
    * set Handler
      SET HANDLER:
        lcl_eventhandler=>handle_node_double_click FOR go_tree,
        lcl_eventhandler=>handle_item_double_click FOR go_tree,
        lcl_eventhandler=>handle_checkbox_change   FOR go_tree,
        lcl_eventhandler=>handle_link_click        FOR go_tree.
    **  DATA: l_event_receiver TYPE REF TO lcl_tree_event_receiver.
    **  CREATE OBJECT l_event_receiver.
    **  SET HANDLER l_event_receiver->handle_node_ctmenu_request
    **                                                        FOR tree1.
    **  SET HANDLER l_event_receiver->handle_node_ctmenu_selected
    **                                                        FOR tree1.
    **  SET HANDLER l_event_receiver->handle_item_ctmenu_request
    **                                                        FOR tree1.
    **  SET HANDLER l_event_receiver->handle_item_ctmenu_selected
    **                                                        FOR tree1.
    **  SET HANDLER l_event_receiver->handle_checkbox_change FOR tree1.
    ENDFORM.                               " register_events
    *&      Form  DISPLAY
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM display .
      DATA: ls_outtab   TYPE ty_s_outtab,
            ls_line     TYPE ty_s_outtab,
            ld_msg      TYPE bapi_msg.
      BREAK-POINT.
      LOOP AT gt_outtab INTO ls_outtab
              WHERE ( loevm = 'X' ).
        CONCATENATE 'Checkbox:'
                    ls_outtab-kunnr
                    ls_outtab-vkorg
                    ls_outtab-vtweg
                    ls_outtab-spart
                    ls_outtab-loevm
          INTO ld_msg SEPARATED BY space.
        MESSAGE ld_msg TYPE 'I'.
      ENDLOOP.
      IF ( syst-subrc NE 0 ).
        MESSAGE 'No marked checkboxes found' TYPE 'I'.
      ENDIF.
      PERFORM get_selected_nodes.
    ENDFORM.                    " DISPLAY
    *&      Form  GET_SELECTED_NODES
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM get_selected_nodes.
    * define local data
      DATA: ld_msg        TYPE bapi_msg,
            lt_nodes      TYPE lvc_t_nkey,
            ls_outtab     TYPE ty_s_outtab,
            ld_nkey       TYPE lvc_nkey,
            lt_items      TYPE lvc_t_layi,
            ls_item       TYPE lvc_s_layi.
      CALL METHOD go_tree->get_selected_nodes
        CHANGING
          ct_selected_nodes = lt_nodes
        EXCEPTIONS
          cntl_system_error = 1
          dp_error          = 2
          failed            = 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.
      CHECK ( lt_nodes IS NOT INITIAL ).
      BREAK-POINT.
      LOOP AT lt_nodes INTO ld_nkey.
        CALL METHOD go_tree->get_outtab_line
          EXPORTING
            i_node_key     = ld_nkey
          IMPORTING
            e_outtab_line  = ls_outtab-data
    *        e_node_text    =
            et_item_layout = lt_items
    *        es_node_layout =
          EXCEPTIONS
            node_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.
        ENDIF.
        LOOP AT lt_items INTO ls_item
                         WHERE ( chosen = 'X' ).
          CONCATENATE 'Item:'
                      ls_outtab-kunnr
                      ls_outtab-vkorg
                      ls_outtab-vtweg
                      ls_outtab-spart
                      ls_outtab-loevm
            INTO ld_msg SEPARATED BY space.
          MESSAGE ld_msg TYPE 'I'.
        ENDLOOP.
      ENDLOOP.
    ENDFORM.                    " GET_SELECTED_NODES
    Regards
      Uwe

  • Interactive lists from ALV

    Hi experts,
    Please tell me how to generate Interactive list from ALV.
    I have already created interactive list without ALV
    ( using AT LINE SELECTION)

    Please refer to the below code.
    A very good example with most of the company Standards.
    *& Report  zalv                                                      *
    REPORT zalv .
    TYPE-POOLS: kkblo,
                slis.
    TABLES: mara, marc, mard.
    DATA:       disvariant   LIKE disvariant,
                eventcat     TYPE slis_t_event,
                eventcat_ln  LIKE LINE OF eventcat,
                fieldcat     TYPE slis_t_fieldcat_alv,
                fieldcat_kkb TYPE kkblo_t_fieldcat,
                fieldcat_ln  LIKE LINE OF fieldcat,
                keyinfo      TYPE slis_keyinfo_alv,
                layout       TYPE slis_layout_alv,
                layout_kkb   TYPE kkblo_layout,
                pgm          LIKE sy-repid,
                printcat     TYPE slis_print_alv,
                sortcat      TYPE slis_t_sortinfo_alv,
                sortcat_ln   LIKE LINE OF sortcat,
                BEGIN OF coltab OCCURS 50,
                  fieldname LIKE fieldcat_ln-fieldname,
                END OF coltab.
    DATA: print          TYPE slis_print_alv.
    DATA : v_repid TYPE sy-repid.
    DATA: BEGIN OF wa OCCURS 0,
            matnr TYPE mara-matnr,
            ersda TYPE mara-ersda,
            ernam TYPE mara-ernam,
            aenam TYPE mara-aenam,
            werks TYPE marc-werks,
            pstat TYPE marc-pstat,
            lfmon TYPE mard-lfmon,
          END OF wa.
    DATA: itab LIKE TABLE OF wa.
    **Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001..
    SELECT-OPTIONS: mat_no FOR mara-matnr.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN END OF BLOCK b1.
    * Parameter for list viewer display variant
    PARAMETERS:    variant  LIKE disvariant-variant.
    AT SELECTION-SCREEN ON variant.
      CHECK NOT variant IS INITIAL.
      PERFORM check_variant_existence USING variant 'U'.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR variant.
      PERFORM f4_display_variant USING variant 'U'.
    *Initialization
    INITIALIZATION.
      v_repid = sy-repid.
    *Start of selection
      PERFORM check_tcode_authority USING 'SA38'.
    START-OF-SELECTION.
      SELECT a~matnr a~ersda
             a~ernam a~aenam
             c~werks c~pstat d~lfmon
      INTO TABLE itab
      UP TO 10 ROWS
      FROM mara AS a
      INNER JOIN marc AS c ON a~matnr = c~matnr
      INNER JOIN mard AS d ON c~matnr = d~matnr
      WHERE a~matnr IN mat_no.
    *End of Selection
    END-OF-SELECTION.
      PERFORM call_list_viewer.
    *&      Form  call_list_viewer
    *       text
    FORM call_list_viewer .
      PERFORM build_fieldcat USING:
               'MATNR' 'ITAB'
                'Material #' 'CHAR'     18 ' ' ' ' ' ' ' ' ' ',
               'ERSDA' 'ITAB'
                'Date Created' 'CHAR'   10 ' ' ' ' ' ' ' ' ' ',
               'ERNAM' 'ITAB'
                'Created By' 'CHAR'     10 ' ' ' ' ' ' ' ' ' ',
               'AENAM' 'ITAB'
                'Changed By' 'CHAR'     10 ' ' ' ' ' ' ' ' ' ',
               'WERKS' 'ITAB'
                'Plant' 'CHAR'           4 ' ' ' ' ' ' ' ' ' ',
               'PSTAT' 'ITAB'
                'Status' 'CHAR'         10 ' ' ' ' ' ' ' ' ' ',
               'LFMON' 'ITAB'
                'Current Period' 'CHAR'  8 ' ' ' ' ' ' ' ' ' '.
      PERFORM build_eventcat USING: 'TOP_OF_LIST',
                                    'TOP_OF_PAGE'.
      PERFORM list_display TABLES itab.
    ENDFORM.                    "call_list_viewer
    * build field catalog entry                                            *
    FORM build_fieldcat USING a_fieldname
                              a_tabname
                              a_heading
                              a_datatype
                              a_outputlen
                              a_key
                              a_no_out
                              a_no_sum
                              a_do_sum
                              a_no_zero.
      CLEAR fieldcat_ln.
      fieldcat_ln-fieldname = a_fieldname.
      fieldcat_ln-tabname  = a_tabname.
      fieldcat_ln-outputlen = a_outputlen.
      fieldcat_ln-datatype = a_datatype.
      fieldcat_ln-reptext_ddic = a_heading.
      fieldcat_ln-key = a_key.
      fieldcat_ln-no_out = a_no_out.
      fieldcat_ln-no_sum = a_no_sum.
      fieldcat_ln-do_sum = a_do_sum.
      fieldcat_ln-no_zero = a_no_zero.
      APPEND fieldcat_ln TO fieldcat.
    ENDFORM.                    "BUILD_FIELDCAT
    *       FORM BUILD_EVENTCAT
    FORM build_eventcat USING a_event.
      eventcat_ln-name = eventcat_ln-form = a_event.
      APPEND eventcat_ln TO eventcat.
    ENDFORM.                    "BUILD_EVENTCAT
    * call the ABAP list viewer                                            *
    FORM list_display TABLES a_output.
      pgm = disvariant-report = sy-repid.
      disvariant-variant = variant.
    * call list viewer
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program       = pgm
    *      i_callback_pf_status_set = 'SET_PF_STATUS'
          it_fieldcat              = fieldcat
          is_variant               = disvariant
          is_layout                = layout
          is_print                 = print
          i_save                   = 'A'
          it_events                = eventcat
          it_sort                  = sortcat
    *      i_callback_user_command  = 'USER_COMMAND'
        TABLES
          t_outtab                 = a_output
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
    ENDFORM.                    "LIST_DISPLAY
    *&      Form  top_of_page
    *       text
    FORM top_of_page.
      PERFORM standard_headings.
      PERFORM print_selection_screen TABLES:
                   mat_no USING  'Material No  : ' 18 'N' 1.
    ENDFORM.                    "top_of_page
    *       FORM CHECK_VARIANT_EXISTENCE
    *       Verify that a variant on the selection screen exists
    FORM check_variant_existence USING varname LIKE disvariant-variant
                                       save   TYPE c.
      DATA: xdisvar LIKE disvariant.
      xdisvar-report  = sy-repid.
      xdisvar-variant = varname.
      CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
        EXPORTING
          i_save        = save
        CHANGING
          cs_variant    = xdisvar
        EXCEPTIONS
          wrong_input   = 1
          not_found     = 2
          program_error = 3
          OTHERS        = 4.
      IF sy-subrc <> 0.
        MESSAGE e256(56) WITH varname.
    *   Anzeigevariante &1 nicht gefunden
      ENDIF.
      disvariant-report  = sy-repid.
      disvariant-variant = varname.
    ENDFORM.                    "check_variant_existence
    *       Form  F4_DISPLAY_VARIANT
    *       F4 help to find a display variant
    *       varname = name of the dynpro field for which f4 is requested
    *       save    = type of list variant saving
    *                 ' ' = no saving allowed
    *                 'A' = standard & user specific variants can be saved
    *                 'U' = only user specific variants can be saved
    *                 'X' = only standard variants can be saved
    FORM f4_display_variant USING varname LIKE disvariant-variant
                                  save    TYPE c.
      disvariant-report = sy-repid.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant    = disvariant
          i_save        = save
        IMPORTING
          es_variant    = disvariant
        EXCEPTIONS
          not_found     = 1
          program_error = 2
          OTHERS        = 3.
      IF sy-subrc = 0.
        varname = disvariant-variant.
      ELSE.
        MESSAGE s245(56).
    *   Keine Anzeigevariante(n) vorhanden
      ENDIF.
    ENDFORM.                               " F4_DISPLAY_VARIANT
    *       FORM STANDARD_HEADINGS                                        *
    *       Print standard page headings for report                       *
    FORM standard_headings.
      DATA: start_column TYPE i,
            title_len TYPE i,
            header_for_80_col(45),
            date_time_for_80_col(45),
            text_h0(11) VALUE 'Report No. ',
            text_h1(5) VALUE 'Date ',
            text_h2(6) VALUE 'Page -',
            text_h3(7) VALUE 'System ',
            text_h4(5) VALUE 'Time ',
            text_h5(11) VALUE 'Run By     '.
      FORMAT INTENSIFIED ON.
      CONDENSE syst-title.
      IF syst-linsz > 80.
        WRITE: /  text_h0,                 "Report No.
               12 syst-repid(8),
               23 text_h1,                 "Date
                  sy-datlo.
        title_len = STRLEN( syst-title ) / 2.
        start_column = ( syst-linsz / 2 ) - title_len.
        IF start_column < 40.
          start_column = 40.
        ENDIF.
        WRITE: AT start_column syst-title.
      ELSE.
        WRITE: /  text_h0,                 "Report No.
               12 syst-repid(8).
        start_column = 22.
        WRITE syst-title TO header_for_80_col CENTERED.
        WRITE: header_for_80_col.
      ENDIF.
      start_column = syst-linsz - 12.
      WRITE: AT start_column text_h2, syst-pagno LEFT-JUSTIFIED.
      IF syst-linsz > 80.
        WRITE: / text_h3,                  "System
              12 syst-sysid(4),
                 syst-mandt,
              23 text_h4,                  "Time
                 syst-timlo.
        WRITE: / text_h5,                  "Run By
              12 syst-uname.
      ELSE.
        WRITE: / text_h3,                  "System
              12 syst-sysid(4),
                 syst-mandt,
              23 text_h1,                  "Date
                 syst-datlo.
        WRITE: / text_h5,                  "Run By
              12 syst-uname,
              23 text_h4,                  "Time
                 syst-timlo.
      ENDIF.
      SKIP.
    ENDFORM.                    "STANDARD_HEADINGS
    *       FORM PRINT_SELECTION_SCREEN                                        *
    *  -->  SIGN                                                          *
    *  -->  OPTION                                                        *
    *  -->  LOW                                                           *
    *  -->  HIGH                                                          *
    *  -->  D_IND                                                         *
    *  -->  S_STRING                                                      *
    FORM print_selection_screen TABLES r_selection TYPE table
                           USING  p_name
                                  p_length TYPE i
                                  p_ind
                                  p_start_col.
      DATA: year(4)       TYPE c,
            month(2)      TYPE c,
            day(2)        TYPE c,
            low_date(10)  TYPE c,
            high_date(10) TYPE c,
            offset(80)    TYPE c.
      DATA: BEGIN OF l_selline,
              sign(1) TYPE c,
              option(2) TYPE c,
              data(200) TYPE c,
            END OF l_selline.
      DATA: l_string(80) TYPE c,
            l_temp(80) TYPE c,
            len TYPE i,
            len1 TYPE i.
      DESCRIBE FIELD p_name LENGTH len IN CHARACTER MODE.
      len = len + p_start_col + 2.
      LOOP AT r_selection.
        IF syst-tabix = 1.
          WRITE AT /p_start_col p_name.
        ELSE.
          len1 = ( STRLEN( l_string ) ).
          len = len1 + len + 2.
        ENDIF.
        MOVE r_selection TO l_selline.
        SHIFT l_selline-data LEFT DELETING LEADING '0'.
        CLEAR l_string.
        CASE l_selline-option.
          WHEN 'EQ'.
            CONCATENATE l_string '=' INTO l_string.
          WHEN 'NE'.
            CONCATENATE l_string 'not =' INTO l_string.
          WHEN 'LT'.
            CONCATENATE l_string '<' INTO l_string.
          WHEN 'GT'.
            CONCATENATE l_string '>' INTO l_string.
          WHEN 'LE'.
            CONCATENATE l_string '<=' INTO l_string.
          WHEN 'GE'.
            CONCATENATE l_string '>=' INTO l_string.
          WHEN 'BT'.
            CONCATENATE l_string 'between' INTO l_string.
          WHEN 'NB'.
            CONCATENATE l_string 'not between' INTO l_string.
          WHEN 'CP'.
            CONCATENATE l_string 'contains pattern' INTO l_string.
          WHEN 'NP'.
            CONCATENATE l_string 'no pattern' INTO l_string.
        ENDCASE.
        IF l_selline-sign EQ 'E'.
          CONCATENATE 'NOT' l_string INTO l_string SEPARATED BY ' '.
        ENDIF.
        IF p_ind EQ 'Y'.
          MOVE l_selline-data(4) TO year.
          MOVE l_selline-data+4(2) TO month.
          MOVE l_selline-data+6(2) TO day.
          CONCATENATE month '/' day '/' year INTO low_date.
          CONCATENATE l_string low_date INTO l_string SEPARATED BY ' '.
          IF l_selline-option EQ 'BT' OR l_selline-option EQ 'NB'.
            MOVE l_selline-data+p_length(4) TO year.
            offset = p_length + 4.
            MOVE l_selline-data+offset(2) TO month.
            ADD 2 TO offset.
            MOVE l_selline-data+offset(2) TO day.
            CONCATENATE month '/' day '/' year INTO high_date.
            CONCATENATE l_string 'and' high_date INTO l_string SEPARATED
                                                  BY ' '.
          ENDIF.
        ELSE.
          MOVE l_selline-data(p_length) TO l_temp.
          CONCATENATE l_string l_temp INTO l_string SEPARATED BY ' '.
          IF l_selline-option EQ 'BT' OR l_selline-option EQ 'NB'.
            MOVE l_selline-data+p_length(p_length) TO l_temp.
            CONCATENATE l_string 'and' l_temp INTO l_string SEPARATED
                                                                BY ' '.
          ENDIF.
        ENDIF.
        WRITE AT len l_string.
      ENDLOOP.
      IF syst-subrc <> 0.
        WRITE: AT /p_start_col p_name, ' *** ALL ***'.
      ENDIF.
    ENDFORM.                    "PRINT_SELECTION_SCREEN
    *       FORM CHECK_TCODE_AUTHORITY                                    *
    *       Check User Security Against A SAP Transaction                 *
    *  -->  a_tcode  Transaction Code For Security                        *
    FORM check_tcode_authority USING a_tcode.
    * if tcode is not passed, then return ok.
      IF NOT a_tcode IS INITIAL.
        CALL FUNCTION 'AUTHORITY_CHECK_TCODE'"Only People that
             EXPORTING                     " have access to
               tcode  = a_tcode            " Transaction t-tcode
             EXCEPTIONS                    " are ALLOWED to execute
                  ok     = 1               " this Program
                  not_ok = 2.
        IF syst-subrc NE 1.
          MESSAGE a999(zz) WITH 'YOU Do Not Have Authority to Execute'.
        ENDIF.
      ELSE.
        MOVE 1 TO syst-subrc.
      ENDIF.
    ENDFORM.                    "CHECK_TCODE_AUTHORITY
    Shreekant

  • How to create secondary lists in ALV

    Hi all,
    Can u plz explain me how to create Secondary lists usingl ALV and how many secondary lists we can create.
    Thanks in advance
    Venkat

    this is the very very simple program in HR module to demonstrate interactive ALV report.
    If u have HR module implemented...just copy and paste this code and debug it...you will easily get the flow of the report...this is the simplest program..
    i hope it helps...here u go......
    REPORT ztej_alv_interactive.
    TABLES: pa0000, pa0001.
    DATA : BEGIN OF it0001 OCCURS 0,
              pernr LIKE pa0001-pernr,
              ename LIKE pa0001-ename,
           END OF it0001.
    DATA : BEGIN OF it0000 OCCURS 0,
              pernr LIKE pa0000-pernr,
              begda LIKE pa0000-begda,
              endda LIKE pa0000-endda,
              massn LIKE pa0000-massn,
              massg LIKE pa0000-massg,
              aedtm LIKE pa0000-aedtm,
           END OF it0000.
    TYPE-POOLS: slis.
    DATA: v_repid LIKE sy-repid .
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: i_fieldcat1 TYPE slis_t_fieldcat_alv.
    DATA: it_listheader TYPE slis_t_listheader.
    DATA: it_listheader1 TYPE slis_t_listheader.
    DATA: v_events TYPE slis_t_event,
          wa_event TYPE slis_alv_event.
    DATA: alv_layout TYPE slis_layout_alv.
    DATA:  i_title_0001 TYPE lvc_title VALUE 'FIRST LIST DISPLAYED'.
    DATA:  i_title_0000 TYPE lvc_title.
    DATA : temp_pernr LIKE pa0001-pernr.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
    SELECTION-SCREEN SKIP.
    SELECT-OPTIONS : s_pernr FOR pa0000-pernr DEFAULT '16240147'.
    SELECTION-SCREEN END OF BLOCK b1.
    INITIALIZATION.
      v_repid = sy-repid.
      PERFORM build_fieldcatlog USING i_fieldcat.
      PERFORM event_call.
      PERFORM populate_event.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM build_listheader USING it_listheader.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATLOG
          text
    -->  p1        text
    <--  p2        text
    FORM build_fieldcatlog USING temp_fieldcat TYPE slis_t_fieldcat_alv.
      DATA : wa_temp_fieldcat TYPE slis_fieldcat_alv.
      wa_temp_fieldcat-tabname = 'IT0001'.
      wa_temp_fieldcat-fieldname = 'PERNR'.
      wa_temp_fieldcat-seltext_m = 'Personnel Number'.
      APPEND wa_temp_fieldcat TO temp_fieldcat.
      CLEAR wa_temp_fieldcat.
      wa_temp_fieldcat-tabname = 'IT0001'.
      wa_temp_fieldcat-fieldname = 'ENAME'.
      wa_temp_fieldcat-seltext_m = 'Name'.
      APPEND wa_temp_fieldcat TO temp_fieldcat.
      CLEAR wa_temp_fieldcat.
    ENDFORM.                    " BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL
          text
    -->  p1        text
    <--  p2        text
    FORM event_call.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
            EXPORTING
               i_list_type     = 0
            IMPORTING
               et_events       = v_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.
    ENDFORM.                    " EVENT_CALL
    *&      Form  POPULATE_EVENT
          text
    -->  p1        text
    <--  p2        text
    FORM populate_event.
      READ TABLE v_events INTO wa_event WITH KEY name = 'TOP_OF_PAGE'.
      IF sy-subrc EQ 0.
        wa_event-form = 'TOP_OF_PAGE'.
        MODIFY v_events FROM wa_event TRANSPORTING form WHERE name =
    wa_event-form.
      ENDIF.
      READ TABLE v_events INTO wa_event WITH KEY name = 'USER_COMMAND'.
      IF sy-subrc EQ 0.
        wa_event-form = 'USER_COMMAND'.
        MODIFY v_events FROM wa_event TRANSPORTING form WHERE name =
    wa_event-name.
      ENDIF.
    ENDFORM.                    " POPULATE_EVENT
    *&      Form  DATA_RETRIEVAL
          text
    -->  p1        text
    <--  p2        text
    FORM data_retrieval.
      SELECT pernr ename
             FROM pa0001
             INTO TABLE it0001
             WHERE pernr IN s_pernr.
      DELETE ADJACENT DUPLICATES FROM it0001.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  BUILD_LISTHEADER
          text
         -->P_IT_LISTHEADER  text
    FORM build_listheader USING i_listheader TYPE slis_t_listheader.
      DATA hline TYPE slis_listheader.
      hline-info = 'This is Interactive ALV Program.'.
      hline-typ = 'H'.
      APPEND hline TO i_listheader.
    ENDFORM.                    " BUILD_LISTHEADER
    *&      Form  DISPLAY_ALV_REPORT
          text
    -->  p1        text
    <--  p2        text
    FORM display_alv_report.
      v_repid = sy-repid.
      alv_layout-colwidth_optimize = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = v_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
         i_callback_user_command           = 'USER_COMMAND'
         i_callback_top_of_page            = 'TOP_OF_PAGE'
         i_grid_title                      = i_title_0001
      I_GRID_SETTINGS                   =
       is_layout                         = alv_layout
         it_fieldcat                       = i_fieldcat[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
        i_default                         = 'ZLAY1'
         i_save                            = 'A'
        is_variant                        = i_variant
         it_events                         = v_events
        TABLES
          t_outtab                          = it0001
    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.
      REFRESH i_fieldcat.
      CLEAR i_fieldcat.
      REFRESH it_listheader.
      CLEAR it_listheader.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  TOP_OF_PAGE
          text
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary       = it_listheader
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
      REFRESH i_fieldcat1.
      REFRESH it_listheader1.
      CASE r_ucomm.
        WHEN '&IC1'.
          READ TABLE it0001 INDEX rs_selfield-tabindex.
          IF sy-subrc = 0.
            temp_pernr = it0001-pernr.
            PERFORM build_fieldcatlog_0000 USING i_fieldcat1.
            PERFORM event_call_0000.
            PERFORM populate_event_0000.
            PERFORM data_retrieval_0000.
            PERFORM build_listheader_0000 USING it_listheader1.
            PERFORM display_alv_0000.
          ENDIF.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  BUILD_FIELDCATLOG_0000
          text
    -->  p1        text
    <--  p2        text
    FORM build_fieldcatlog_0000 USING temp_fieldcat TYPE slis_t_fieldcat_alv
      DATA : wa_temp_fieldcat TYPE slis_fieldcat_alv.
      wa_temp_fieldcat-tabname = 'IT0000'.
      wa_temp_fieldcat-fieldname = 'BEGDA'.
      wa_temp_fieldcat-seltext_m = 'From Date'.
      APPEND wa_temp_fieldcat TO temp_fieldcat.
      CLEAR wa_temp_fieldcat.
      wa_temp_fieldcat-tabname = 'IT0000'.
      wa_temp_fieldcat-fieldname = 'ENDDA'.
      wa_temp_fieldcat-seltext_m = 'To Date'.
      APPEND wa_temp_fieldcat TO temp_fieldcat.
      CLEAR wa_temp_fieldcat.
      wa_temp_fieldcat-tabname = 'IT0000'.
      wa_temp_fieldcat-fieldname = 'MASSN'.
      wa_temp_fieldcat-seltext_m = 'Action'.
      APPEND wa_temp_fieldcat TO temp_fieldcat.
      CLEAR wa_temp_fieldcat.
      wa_temp_fieldcat-tabname = 'IT0000'.
      wa_temp_fieldcat-fieldname = 'MASSG'.
      wa_temp_fieldcat-seltext_m = 'Reason'.
      APPEND wa_temp_fieldcat TO temp_fieldcat.
      CLEAR wa_temp_fieldcat.
      wa_temp_fieldcat-tabname = 'IT0000'.
      wa_temp_fieldcat-fieldname = 'AEDTM'.
      wa_temp_fieldcat-seltext_m = 'Action Run On'.
      APPEND wa_temp_fieldcat TO temp_fieldcat.
      CLEAR wa_temp_fieldcat.
    ENDFORM.                    " BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL_0000
          text
    -->  p1        text
    <--  p2        text
    FORM event_call_0000.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         i_list_type           = 0
       IMPORTING
         et_events             = v_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.
    ENDFORM.                    " EVENT_CALL_0000
    *&      Form  POPULATE_EVENT_0000
          text
    -->  p1        text
    <--  p2        text
    FORM populate_event_0000.
      READ TABLE v_events INTO wa_event WITH KEY name = 'TOP_OF_PAGE'.
      IF sy-subrc EQ 0.
        wa_event-form = 'F_TOP_OF_PAGE'.
        MODIFY v_events FROM wa_event TRANSPORTING form WHERE name =
    wa_event-form.
      ENDIF.
    ENDFORM.                    " POPULATE_EVENT_0000
    *&      Form  TOP_OF_PAGE
          text
    FORM f_top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary       = it_listheader1
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    *retreiving values from the database table ekko
    FORM data_retrieval_0000.
      SELECT pernr begda endda massn massg aedtm
             FROM pa0000
             INTO TABLE it0000
             WHERE pernr = temp_pernr.
    ENDFORM.
    *&      Form  BUILD_LISTHEADER_0000
          text
         -->P_IT_LISTHEADER  text
    FORM build_listheader_0000 USING i_listheader1 TYPE slis_t_listheader.
      DATA: hline1 TYPE slis_listheader.
      hline1-typ = 'H'.
      hline1-info = 'Actions Detail List'.
      APPEND hline1 TO i_listheader1.
    ENDFORM.                    " BUILD_LISTHEADER_0000
    *&      Form  DISPLAY_ALV_0000
          text
    -->  p1        text
    <--  p2        text
    FORM display_alv_0000.
      CONCATENATE 'Actions For Personnel Number ' temp_pernr
                   INTO i_title_0000 SEPARATED BY ' '.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = v_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND'
         i_callback_top_of_page            = 'F_TOP_OF_PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
         i_grid_title                      = i_title_0000
      I_GRID_SETTINGS                   =
       is_layout                          = alv_layout
         it_fieldcat                      = i_fieldcat1[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         =
         i_save                            = 'A'
      IS_VARIANT                        =
         it_events                         = v_events
        TABLES
          t_outtab                          = it0000
       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_0000
    Regards,
    Tejas

  • How doi print Any variable at the end of page in ALV report?

    Hi,
    Anyone can tell me that How do i print Any variable at the end of page in ALV report?
    Exmale: at the ende of alv report i want to print total no of employee who has taken house loan or education loan.

    Hi,
    Go through these links
    Thread in sdn regarding FOOTER IN ALV
    [ALV  FOOTER;
    Wiki in sdn regarding HEADER AND FOOTER IN ALV
    [https://wiki.sdn.sap.com/wiki/display/Snippets/ABAP%20Objects%20-%20ALV%20Model%20-%20Using%20Header%20and%20Footer]
    Header and Footer in ALV
    [http://www.sap-img.com/abap/test-alv-display-with-header-footer.htm]
    Hope this helps.
    Thank you,
    Pavan.

  • Move data from multiple Tables to a Single Table & Convert the list to ALV.

    Hi,
    My aim is to get the list of Materials with their descriptions, with MRP Controller, with Unrestriced Qty. & the Reorder Qty. So, I have to fetch the data from different tables. But finally I am not able to copy or move the fetched data from multiple tables into the single final table.
    Also tell me how to convert this list into ALV.
    Below is the program code.
    *& Report  Y_REORDER_REPORT
    REPORT  Y_REORDER_REPORT.
    tables : marc,makt, mard.
    DATA: Begin of i_final occurs 0,
            matnr type marc-matnr,
            maktx type makt-maktx,
            DISPO type marc-DISPO,
            MINBE type marc-MINBE,
            LABST type mard-LABST,
          end of i_final.
    DATA: Begin of i_marc occurs 0,
           matnr type marc-matnr,
           DISPO type marc-DISPO,
           MINBE type marc-MINBE,
          end of i_marc.
    DATA: Begin of i_makt occurs 0,
           matnr type makt-matnr,
           maktx type makt-maktx,
          end of i_makt.
    DATA: Begin of i_mard occurs 0,
           matnr type mard-matnr,
           LABST type mard-LABST,
           LGORT TYPE MARD-LGORT,
          end of i_mard.
    SELECT  matnr
            dispo
            minbe from marc
            into corresponding fields of table i_marc
            where dispo EQ 'STR'.
    SORT I_MARC by MATNR.
    WRITE: /10  'Material',
            75  'MRP',
            80  'Reorder Qty.'.
    LOOP at i_marc.
    Write: /10  i_marc-matnr,
            75  i_marc-dispo,
            80  i_marc-minbe.
    ENDLOOP.
    write: /.
    SELECT  matnr
            MAKTX from makt
            into corresponding fields of table i_makt
            for all entries in i_marc
            where matnr = i_marc-matnr.
    LOOP at i_makt.
    Write: /10 i_makt-matnr,
            30 i_makt-maktx.
    ENDLOOP.
    SELECT  matnr
            LGORT
            LABST from mard
            into corresponding fields of table i_mard
            for all entries in i_marc
            where matnr = i_marc-matnr.
    LOOP at i_mard.
    Write: /10 i_mard-matnr,
            30 I_MARD-LGORT,
            40 i_mard-labst.
    ENDLOOP.
    move  i_mard-matnr to i_final-matnr.
    move  i_marc-dispo to i_final-dispo.
    move  i_marc-minbe to i_final-minbe.
    move  i_makt-maktx to i_final-maktx.
    move  i_mard-labst to i_final-labst.
    WRITE: /10  'Material',
            30  'Material Desc.',
            75  'MRP',
            80  'Reorder Qty.',
            105 'Current Stock'.
    LOOP at i_final.
    Write: /10  i_final-matnr,
            30  i_final-maktx,
            75  i_final-dispo,
            80  i_final-minbe,
            105 i_final-labst.
    ENDLOOP.
    *LOOP at i_mard.
    *Write: /10  i_mard-matnr,
           30  i_makt-maktx,
           75  i_marc-dispo,
           80  i_marc-minbe,
           105 i_mard-labst.
    *ENDLOOP.
    Regards,
    Vishal

    Change like this,
    SELECT matnr
    lgort
    labst FROM mard
    INTO CORRESPONDING FIELDS OF TABLE i_mard
    FOR ALL ENTRIES IN i_marc
    WHERE matnr = i_marc-matnr.
    LOOP AT i_mard.
       WRITE: /10 i_mard-matnr,
       30 i_mard-lgort,
       40 i_mard-labst.
    ENDLOOP.
    LOOP AT i_marc.
       READ TABLE i_mard WITH KEY matnr =  i_marc-matnr.
       READ TABLE i_makt WITH KEY matnr =  i_marc-matnr.
       MOVE i_mard-matnr TO i_final-matnr.
       MOVE i_marc-dispo TO i_final-dispo.
       MOVE i_marc-minbe TO i_final-minbe.
       MOVE i_makt-maktx TO i_final-maktx.
       MOVE i_mard-labst TO i_final-labst.
       APPEND i_final.
    ENDLOOP.
    WRITE: /10 'Material',
    30 'Material Desc.',
    75 'MRP',
    80 'Reorder Qty.',
    105 'Current Stock'.

  • Drop down list in ALV grid

    Dear Expert,
    I am new to OOPS ,
    I want to display drop down list for a particular field in my output, so I am using OOPS but in my below code
    I am facing problem in displaying the output as I am getting the error message
    Field catalog not found...
    Also advice me how to display drop down list in a particular field.
    Please advice
    MODULE pbo OUTPUT.
      SET PF-STATUS 'ZTEST'.
      IF g_custom_container IS INITIAL.
        DATA: lt_exclude TYPE ui_functions,
              lt_f4 TYPE lvc_t_f4 WITH HEADER LINE.
        CREATE OBJECT g_custom_container
          EXPORTING
            container_name = g_container.
        CREATE OBJECT g_grid
          EXPORTING
            i_parent = g_custom_container.
        PERFORM field_catalog TABLES it_lvc_t_fcat
           USING: 'S_FINAL' 'MATNR' ' ' 'Part Number' ' ' ' ',
                       'S_FINAL' 'MAKTX' ' ' 'Part Description' ' ' ' ',
                       'S_FINAL' 'MBLNR' ' ' 'Document No' ' ' ' ',
                       'S_FINAL' 'BLDAT' ' ' 'Document date' ' ' ' ',
                       'S_FINAL' 'LIFNR' ' ' 'Vendor Number' ' ' ' ',
                       'S_FINAL' 'STATUS' ' ' 'Acknowledgement' ' ' 'X',
                       'S_FINAL' 'REMARKS' ' ' 'Remarks' ' ' 'X'.
        CALL METHOD g_grid->set_table_for_first_display
           EXPORTING
    *    I_STRUCTURE_NAME              =
         is_layout                                =   it_lvc_s_layo
           CHANGING
             it_outtab                        =   i_final
         it_fieldcatalog                =   it_lvc_t_fcat
      ENDIF.
    ENDMODULE.                 " PBO  OUTPUT
    FORM field_catalog  TABLES t_field_catalog STRUCTURE wt_lvc_s_fcat
    USING fp_tabname TYPE any
    fp_fieldname TYPE any
    fp_key TYPE any
    fp_text TYPE any
    fp_do_sum TYPE any
    fp_edit TYPE any.
      t_field_catalog-tabname = fp_tabname.
      t_field_catalog-fieldname = fp_fieldname.
      t_field_catalog-key = fp_key.
      t_field_catalog-seltext = fp_text.
      t_field_catalog-do_sum = fp_do_sum .
      t_field_catalog-edit = fp_edit .
    ENDFORM.                    "field_catalog
    Edited by: Karthik R on Mar 15, 2010 6:11 PM

    Hi Karthik,
    Below mentioned  is a Simple code for creating dropdown lists for columns in ALV grid output
    REPORT z_alv_dropdown.
    *Type pools declarations for ALV
    TYPE-POOLS : slis.
    *data declarations for ALV container, ALV grid,  Field catalogues & layout
    DATA: g_grid  TYPE REF TO cl_gui_alv_grid,
          g_custom_container TYPE REF TO cl_gui_custom_container,
          gt_fieldcat TYPE lvc_t_fcat,
          gs_layout TYPE lvc_s_layo.
    *INTERNAL TABLE AND WA DECLARATIONS FOR t517 A table
    DATA: gt_outtab TYPE STANDARD TABLE OF t517a INITIAL SIZE 0,
          wa_outtab TYPE t517a.
    *initialisation event
    INITIALIZATION.
    *Start of selection event
    START-OF-SELECTION.
    *Call to ALV
      CALL SCREEN 600.
    *On this statement double click  it takes you to the screen painter SE51.
    *Create a Custom container and name it CCONT and OK code as OK_CODE.
    *Save check and Activate the screen painter.
    *Now a normal screen with number 600 is created which holds the ALV grid.
    PBO of the actual screen , Here we can give a title and customized menus
    Here we also call the subroutine for ALV output.
          MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
    set pf-status 'xxx'.
    set titlebar 'MAIN100'.
    Subroutine to display the output in alv
      PERFORM alv_output.
    ENDMODULE.                    "pbo OUTPUT
    PAI module of the screen created. In case we use an interactive ALV or
    *for additional functionalities we can create OK codes and
    based on the user command we can do the coding.
          MODULE PAI INPUT                                              *
    MODULE pai INPUT.
    ENDMODULE.                    "pai INPUT
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat.
      DATA ls_fcat TYPE lvc_s_fcat.
    *Build the field catalogue
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'T517A'
        CHANGING
          ct_fieldcat      = gt_fieldcat.
    To assign dropdown in the fieldcataogue
      LOOP AT gt_fieldcat INTO ls_fcat.
        CASE ls_fcat-fieldname.
          WHEN 'SLART'.
    *drdn-hndl = '1' is the first list box
            ls_fcat-drdn_hndl = '1'.
            ls_fcat-outputlen = 15.
            MODIFY gt_fieldcat FROM ls_fcat.
    *drdn-hndl = '2' is the second list box
          WHEN 'ABART'.
            ls_fcat-drdn_hndl = '2'.
            ls_fcat-outputlen = 15.
            MODIFY gt_fieldcat FROM ls_fcat.
        ENDCASE.
      ENDLOOP.
    ENDFORM.                    "build_fieldcat
    *&      Form  ALV_OUTPUT
    FORM alv_output .
    *Create object for container
      CREATE OBJECT g_custom_container
             EXPORTING container_name = 'CCONT'.
    *create object for grid
      CREATE OBJECT g_grid
             EXPORTING i_parent = g_custom_container.
    Build fieldcat and set column
    *Assign a handle for the dropdown listbox.
      PERFORM build_fieldcat.
    *Build layout
      PERFORM build_layout.
    Define a drop down table.
      PERFORM dropdown_table.
    *fetch values from the T517A table
      SELECT * FROM t517a INTO TABLE gt_outtab.
    *Display ALV output
      CALL METHOD g_grid->set_table_for_first_display
        EXPORTING
          is_layout       = gs_layout
        CHANGING
          it_fieldcatalog = gt_fieldcat
          it_outtab       = gt_outtab.
    ENDFORM.                               "ALV_OUTPUT
    *&      Form  dropdown_table
          text
    -->  p1        text
    <--  p2        text
    FORM dropdown_table.
    *Declarations for drop down lists in ALV.
      DATA: lt_dropdown TYPE lvc_t_drop,
            ls_dropdown TYPE lvc_s_drop.
    First SLART listbox (handle '1').
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '01 Pink'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '02 Yellow'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '03 Green'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '04 Black'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '05 White'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '06 Blue'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '09 Other Colors'.
      APPEND ls_dropdown TO lt_dropdown.
    *method to display the dropdown in ALV
      CALL METHOD g_grid->set_drop_down_table
        EXPORTING
          it_drop_down = lt_dropdown.
    ENDFORM.                               " dropdown_table
    *&      Form  build_layout
          text
    *layout for ALV output
    FORM build_layout .
      gs_layout-cwidth_opt = 'X'.
      gs_layout-grid_title = 'ALV DROPDOWN LISTS'.
      gs_layout-no_toolbar = 'X'.
    ENDFORM.                    " build_layout
    Hope it is helpful,
    Regards,
    Soundarya.

  • How to use intractive list in Alv REPORT

    how to use intractive list in Alv REPORT with example.
    thangs
    venki.......

    Hi
    using the USER_COMMAND we can move to the Secondary(interactive) list in the ALV
    see the sample code
    report yh645_secndry_alv.
    type-pools: slis.
    data: fieldcat type slis_t_fieldcat_alv,
    fieldcat_ln like line of fieldcat,
    fs_layout type slis_layout_alv,
    t_layoout like standard table
    of fs_layout.
    data: begin of fs_spfli,
    carrid type spfli-carrid,
    connid type spfli-connid,
    countryfr type spfli-countryfr,
    cityfrom type spfli-cityfrom,
    airpfrom type spfli-airpfrom,
    countryto type spfli-countryto,
    cityto type spfli-cityto,
    airpto type spfli-airpto,
    fltime type spfli-fltime,
    deptime type spfli-deptime,
    arrtime type spfli-arrtime,
    distance type spfli-distance,
    distid type spfli-distid,
    fltype type spfli-fltype,
    period type spfli-period,
    checkbox,
    color(3),
    end of fs_spfli.
    data:
    begin of fs_table,
    carrid type spfli-carrid,
    connid type spfli-connid,
    end of fs_table.
    data: begin of fs_sflight,
    check,
    color(3).
    include type sflight.
    data:end of fs_sflight.
    data:
    begin of fs_table1,
    carrid type sflight-carrid,
    connid type sflight-connid,
    fldate type sflight-fldate,
    end of fs_table1.
    data:
    t_spfli like standard table
    of fs_spfli.
    data:
    t_table like standard table
    of fs_table.
    data:
    t_table1 like standard table
    of fs_table1.
    data:
    t_sflight like standard table
    of fs_sflight.
    data:
    t_sbook like standard table
    of sbook.
    data t_layout type slis_layout_alv.
    select *
    into corresponding fields of table t_spfli
    from spfli.
    perform start_list_viewer.
    perform get_spfli_details.
    *& Form SUB1
    text
    -->RT_EXTAB text
    form sub1 using rt_extab type slis_t_extab.
    data: flight type slis_extab.
    flight-fcode = 'SFLIGHT'.
    append flight to rt_extab.
    set pf-status 'SFLIGHT'. " EXCLUDING RT_EXTAB.
    endform. "SUB1
    *& Form START_LIST_VIEWER
    text
    --> p1 text
    <-- p2 text
    form start_list_viewer .
    data: pgm like sy-repid.
    pgm = sy-repid.
    fs_layout-box_fieldname = 'CHECKBOX'.
    fs_layout-info_fieldname = 'COLOR'.
    call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
    i_callback_program = pgm
    i_callback_pf_status_set = 'SUB1'
    i_callback_user_command = 'USER_COMMAND'
    i_structure_name = 'SPFLI'
    is_layout = fs_layout
    tables
    t_outtab = t_spfli
    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. " START_LIST_VIEWER
    *******Process Call Back Events (Begin)**************************
    form user_command using ucomm like sy-ucomm
    selfield type slis_selfield.
    case ucomm.
    when 'SFLIGHT'.
    selfield-refresh = 'X'.
    perform get_spfli_details.
    select *
    from sflight
    into corresponding fields of table t_sflight
    for all entries in t_table
    where carrid eq t_table-carrid
    and connid eq t_table-connid.
    perform display_sflight.
    when 'SBOOK'.
    selfield-refresh = 'X'.
    perform get_sflight_details.
    select *
    from sbook
    into corresponding fields of table t_sbook
    for all entries in t_table1
    where carrid eq t_table1-carrid
    and connid eq t_table1-connid
    and fldate eq t_table1-fldate.
    perform display_sbook.
    endcase.
    endform. "USER_COMMAND
    *& Form SUB2
    text
    -->RT_EXTAB text
    form sub2 using rt_extab type slis_t_extab.
    data: flight type slis_extab.
    flight-fcode = 'SBOOK'.
    append flight to rt_extab.
    set pf-status 'SBOOK'. " EXCLUDING RT_EXTAB.
    endform. "SUB2
    *& Form DISPLAY_SFLIGHT
    text
    --> p1 text
    <-- p2 text
    form display_sflight .
    data: pgm like sy-repid.
    pgm = sy-repid.
    clear t_layout.
    fs_layout-box_fieldname = 'CHECK'.
    fs_layout-info_fieldname = 'COLOR'.
    call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
    i_callback_program = pgm
    i_callback_pf_status_set = 'SUB2'
    i_callback_user_command = 'USER_COMMAND'
    i_structure_name = 'SFLIGHT'
    is_layout = fs_layout
    tables
    t_outtab = t_sflight
    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_SFLIGHT
    *& Form GET_SPFLI_DETAILS
    text
    --> p1 text
    <-- p2 text
    form get_spfli_details .
    loop at t_spfli into fs_spfli.
    if fs_spfli-checkbox = 'X'.
    fs_spfli-color = 'C51'.
    fs_spfli-checkbox = '1'.
    fs_table-carrid = fs_spfli-carrid.
    fs_table-connid = fs_spfli-connid.
    append fs_table to t_table.
    modify t_spfli from fs_spfli.
    endif.
    endloop.
    endform. " GET_SFLIGHT_DETAILS
    *& Form GET_SFLIGHT_DETAILS
    text
    --> p1 text
    <-- p2 text
    form get_sflight_details .
    loop at t_sflight into fs_sflight.
    if fs_sflight-check = 'X'.
    fs_sflight-color = 'C71'.
    fs_sflight-check = '1'.
    fs_table1-carrid = fs_sflight-carrid.
    fs_table1-connid = fs_sflight-connid.
    fs_table1-fldate = fs_sflight-fldate.
    append fs_table1 to t_table1.
    modify t_sflight from fs_sflight.
    endif.
    endloop.
    endform. " GET_SFLIGHT_DETAILS
    *& Form DISPLAY_SBOOK
    text
    --> p1 text
    <-- p2 text
    form display_sbook .
    data: pgm like sy-repid.
    pgm = sy-repid.
    call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
    i_callback_program = pgm
    i_structure_name = 'SBOOK'
    tables
    t_outtab = t_sbook
    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_SBOOK
    Reward points for useful Answers
    Regards
    Anji

  • Classical List to ALV format in sap abap report

    Hi All,
    I have a requirement to change the existing abap report in which teh output is dispalyed in classical list format.
    I want to convert this list report output into ALV format.
    COuld anyone please help me how to convert this from Classical list to ALV format?
    Thanks,
    Komal.
    Moderator message: sorry, this not the place to teach the basics, please search for available information. If you understand the classical list and how to use ALV, then you can also do the transfer yourself.
    Edited by: Thomas Zloch on Aug 12, 2011 4:44 PM

    This will be very difficult for you.....
    Since you are getting a time out error....it looks like, you are runnning this report in foreground....................
    Try running it in background it will work...
    ELSE....you have to fetch in small chunks....but the question is how will you do it. Since the USR02 only has BNAME as primary key...
    Either put the BNAME as part of selection screen and fetch the data.....it will solve your problem....
    Only fetch for those BNAME which is entered in the selection screen...
    Hope it helps!

  • The TOP-OF-LIST and END-OF-LIST events are not triggered in spool

    Hi Everyone,
    I am displaying a block list ALV where when using "REUSE_ALV_BLOCK_LIST_APPEND", I have populated the events with TOP-OF-LIST and END-OF-LIST. The ALV is displaying perfectly with the top-of-list and end-of-list.
    I have created a button in the toolbar using the USER COMMAND which when clicked will generate a PDF file with my output result. In the subroutine for USER COMMAND , I have put the print parameters using "GET_PRINT_PARAMETERS". Then I have again called "REUSE_ALV_BLOCK_LIST_DISPLAY" with is_print parameter in order to generate the spool no. Then I am using "CONVERT_ABAPSPOOLJOB_2_PDF" to convert the spool to pdf.
    The problem that I am facing is that the spool is generated without the TOP-OF-LIST and END-OF-LIST. I cannot see the lines written in TOP-OF-LIST and END-OF-LIST in the spool.
    Also the font-size is reduced very much in the pdf.
    Please suggest me some solution if possible.
    <promise removed by moderator>
    Regards,
    Edited by: Thomas Zloch on Mar 29, 2011 4:40 PM

    Hi Everyone,
    I am displaying a block list ALV where when using "REUSE_ALV_BLOCK_LIST_APPEND", I have populated the events with TOP-OF-LIST and END-OF-LIST. The ALV is displaying perfectly with the top-of-list and end-of-list.
    I have created a button in the toolbar using the USER COMMAND which when clicked will generate a PDF file with my output result. In the subroutine for USER COMMAND , I have put the print parameters using "GET_PRINT_PARAMETERS". Then I have again called "REUSE_ALV_BLOCK_LIST_DISPLAY" with is_print parameter in order to generate the spool no. Then I am using "CONVERT_ABAPSPOOLJOB_2_PDF" to convert the spool to pdf.
    The problem that I am facing is that the spool is generated without the TOP-OF-LIST and END-OF-LIST. I cannot see the lines written in TOP-OF-LIST and END-OF-LIST in the spool.
    Also the font-size is reduced very much in the pdf.
    Please suggest me some solution if possible.
    <promise removed by moderator>
    Regards,
    Edited by: Thomas Zloch on Mar 29, 2011 4:40 PM

  • Interactive list in ALV

    Hi All,
    Is there any sample program for an interactive list in ALV? I would like to try an interactive ALV list option for one of my reports
    Thanks

    One more example - ALV Interactive ( two times REUSE_ALV_GRID_DISPLAY )
    REPORT  ZZ_22038_22098_002 NO STANDARD PAGE HEADING LINE-SIZE 650
    MESSAGE-ID ZZ_9838                      .
    TYPE-POOLS: SLIS.
    *type declaration for values from ekko
    TYPES: BEGIN OF I_EKKO,
           EBELN LIKE EKKO-EBELN,
           AEDAT LIKE EKKO-AEDAT,
           BUKRS LIKE EKKO-BUKRS,
           BSART LIKE EKKO-BSART,
           LIFNR LIKE EKKO-LIFNR,
           END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
          WA_EKKO TYPE I_EKKO.
    *type declaration for values from ekpo
    TYPES: BEGIN OF I_EKPO,
           EBELN LIKE EKPO-EBELN,
           EBELP LIKE EKPO-EBELP,
           MATNR LIKE EKPO-MATNR,
           MENGE LIKE EKPO-MENGE,
           MEINS LIKE EKPO-MEINS,
           NETPR LIKE EKPO-NETPR,
           END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
          WA_EKPO TYPE I_EKPO .
    *variable for Report ID
    DATA: V_REPID LIKE SY-REPID .
    *declaration for fieldcatalog
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    declaration for events table where user comand or set PF status will
    be defined
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
          WA_EVENT TYPE SLIS_ALV_EVENT.
    declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    declaration for variant(type of display we want)
    DATA: I_VARIANT TYPE DISVARIANT,
          I_VARIANT1 TYPE DISVARIANT,
          I_SAVE(1) TYPE C.
    *PARAMETERS : p_var TYPE disvariant-variant.
    *Title displayed when the alv list is displayed
    DATA:  I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
    DATA:  I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
    INITIALIZATION.
      V_REPID = SY-REPID.
      PERFORM BUILD_FIELDCATLOG.
      PERFORM EVENT_CALL.
      PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
      PERFORM DATA_RETRIEVAL.
      PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
      PERFORM DISPLAY_ALV_REPORT.
    *&      Form  BUILD_FIELDCATLOG
          Fieldcatalog has all the field details from ekko
    FORM BUILD_FIELDCATLOG.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'AEDAT'.
      WA_FIELDCAT-SELTEXT_M = 'DATE.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'LIFNR'.
      WA_FIELDCAT-NO_OUT    = 'X'.
      WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_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.
    ENDFORM.                    "EVENT_CALL
    *&      Form  POPULATE_EVENT
         Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'USER_COMMAND'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-NAME.
      ENDIF.
    ENDFORM.                    "POPULATE_EVENT
    *&      Form  data_retrieval
      retreiving values from the database table ekko
    FORM DATA_RETRIEVAL.
      SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
    ENDFORM.                    "data_retrieval
    *&      Form  bUild_listheader
          text
         -->I_LISTHEADEtext
    FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
      DATA HLINE TYPE SLIS_LISTHEADER.
      HLINE-INFO = 'this is my first alv pgm'.
      HLINE-TYP = 'H'.
    ENDFORM.                    "build_listheader
    *&      Form  display_alv_report
          text
    FORM DISPLAY_ALV_REPORT.
      V_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
         I_GRID_TITLE                      = I_TITLE_EKKO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         = ALV_LAYOUT
         IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
        i_default                         = 'ZLAY1'
         I_SAVE                            = 'A'
        is_variant                        = i_variant
         IT_EVENTS                         = V_EVENTS
        TABLES
          T_OUTTAB                          = IT_EKKO
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "display_alv_report
    *&      Form  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN '&IC1'.
          READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
          PERFORM BUILD_FIELDCATLOG_EKPO.
          PERFORM EVENT_CALL_EKPO.
          PERFORM POPULATE_EVENT_EKPO.
          PERFORM DATA_RETRIEVAL_EKPO.
          PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
          PERFORM DISPLAY_ALV_EKPO.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  BUILD_FIELDCATLOG_EKPO
          text
    FORM BUILD_FIELDCATLOG_EKPO.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELP'.
      WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MENGE'.
      WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MEINS'.
      WA_FIELDCAT-SELTEXT_M = 'UOM'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'NETPR'.
      WA_FIELDCAT-SELTEXT_M = 'PRICE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG_EKPO
    *&      Form  event_call_ekpo
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL_EKPO.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_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.
    ENDFORM.                    "event_call_ekpo
    *&      Form  POPULATE_EVENT
           Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT_EKPO.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      ENDFORM.                    "POPULATE_EVENT
    *&      Form  TOP_OF_PAGE
          text
    FORM F_TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    *retreiving values from the database table ekko
    FORM DATA_RETRIEVAL_EKPO.
    SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
    ENDFORM.
    FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA: HLINE1 TYPE SLIS_LISTHEADER.
    HLINE1-TYP = 'H'.
    HLINE1-INFO = 'CHECKING PGM'.
    ENDFORM.
    FORM DISPLAY_ALV_EKPO.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND'
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      = I_TITLE_EKPO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         =
       I_SAVE                            = 'A'
      IS_VARIANT                        =
       IT_EVENTS                         = V_EVENTS
      TABLES
        T_OUTTAB                          = IT_EKPO
    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.

Maybe you are looking for

  • How to read the context node of used component?

    Hi, I have component called : SRQM_INCIDENT_H. This component has used component - BTSTATUS. Now, I need to read the context node of the BTSTATUS/UserStatus in GET Methods of Context node in SRQM_INCIDENT_H. Can you plese help me out. Thanks, Sandeep

  • Do I need to re-build my window 8.1 driver for Windows 10 (WDK10)?

    Hi, all I am testing my hardware driver in HLK for windows 10 certification. I test the version for windows 8.1, it manually works OK in windows 10 (Build:10041). My question is : Do I need to re-build it use VS2015 CTP + WDK10? Or just install the 8

  • Photos too big for Flash, what can I do?

    Hi, I have tried all the different Formats of Photo and bringing them into Flash, but they are still too big, causing Flash to crash and meaning I am unable to upload my website to my server. I think i remember being told you could use a preloader. B

  • How to sync video precisely to bar on Logic Pro 9?

    I would really appreciate if someone has a clue about syncing the video precisely to the bar and can post a reply to this thread. Here's what I have done so far... Opened movie from File menu Opened Global tracks > Video --Detect Cuts ( Created Scene

  • Cambiar el correo-e del sync porque el que puse está mal

    Para sync puse un correo, tenía problemas y al final he descubierto que lo escribí mal Puedo corregirlo? puedo sincronizar mas de un correo-e?