Skip to Content
author's profile photo Former Member
Former Member

Dialog program with ALV and ALV toolbars

Hi guys,

Is it possible to create an ALV report with ALV toolbars in a dialog screen?

how am i going to do it?

Thanks a lot!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 09:15 AM

    Hi,

    You can do this. In any screen you can place the container, in that container we can display the ALV Grid.

    for alv grid display you can see the examples BCALV*

    Thanks,

    Rajinikanth

    Edited by: Rajinikanth G on Jun 19, 2008 11:18 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 09:17 AM

    Take a look at this sample code

    this code makes use of two container.

    you can make changes according to ur need.

    Dont forget to define a container on the screen.

    *&---------------------------------------------------------------------*
    *& Report  ZOO_ALV
    *&
    *&---------------------------------------------------------------------*
    *&
    *&
    *&---------------------------------------------------------------------*
    
    REPORT  ZOO_ALV.
    
    "report zrich_0006.
    
    tables: mara.
    
    type-pools: slis.
    
    * Internal Tables
    data: begin of ialv occurs 0,
          matnr type mara-matnr,
          maktx type makt-maktx,
          end of ialv .
    
    * Internal Tables
    data: begin of ialv2 occurs 0,
          matnr type mard-matnr,
          werks type mard-werks,
          lgort type mard-lgort,
          end of ialv2 .
    
    
    ***********************************************************************
    *       CLASS lcl_event_receiver DEFINITION      Handles Double Click
    ***********************************************************************
    class lcl_event_receiver definition.
      public section.
        methods handle_hotspot_click
           for event hotspot_click of cl_gui_alv_grid
          importing e_row_id.
      private section.
    endclass.
    
    ***********************************************************************
    *       CLASS lCL_EVENT_RECEIVER IMPLEMENTATION    Handles Double Click
    ***********************************************************************
    class lcl_event_receiver implementation.
      method handle_hotspot_click.
        perform get_details using e_row_id-index.
      endmethod.
    endclass.
    
    data: alv_container type ref to cl_gui_custom_container,
          event_receiver type ref to lcl_event_receiver,
          alv_grid type ref to cl_gui_alv_grid,
          alv_container2 type ref to cl_gui_custom_container,
          alv_grid2 type ref to cl_gui_alv_grid,
          ok_code like sy-ucomm,
          fieldcat type lvc_t_fcat,
          fieldcat2 type lvc_t_fcat.
    
    select-options: s_matnr for mara-matnr.
    
    start-of-selection.
    
      perform get_data.
    
    
      call screen 100.
    
    ************************************************************************
    *      Module  status_0100  OUTPUT
    ************************************************************************
    module status_0100 output.
    
      data: variant type  disvariant.
      data: lt_exclude type ui_functions.
      data: ls_fcat type lvc_s_fcat.
    
      set pf-status '0100'.
      set titlebar '0100'.
    
      check alv_container is initial.
    
    ***   Code for first ALV Grid
    
    * Create Controls
      create object alv_container
             exporting container_name = 'ALV_CONTAINER'.
    
    *   create Event Receiver
      create object event_receiver.
    
      create object alv_grid
             exporting  i_parent =  alv_container.
    
    
      clear fieldcat.  refresh: fieldcat.
    
      clear: ls_fcat.
      ls_fcat-reptext    = 'Material Number'.
      ls_fcat-coltext    = 'Material Number'.
      ls_fcat-fieldname  = 'MATNR'.
      ls_fcat-ref_table  = 'IALV'.
      ls_fcat-hotspot    = 'X'.
      ls_fcat-outputlen  = '18'.
      ls_fcat-col_pos    = 1.
      append ls_fcat to fieldcat.
    
      clear: ls_fcat.
      ls_fcat-reptext    = 'Material Description'.
      ls_fcat-coltext    = 'Material Description'.
      ls_fcat-fieldname  = 'MATKX'.
      ls_fcat-ref_table  = 'IALV'.
      ls_fcat-outputlen  = '40'.
      ls_fcat-col_pos    = 2.
      append ls_fcat to fieldcat.
    
      call method alv_grid->set_table_for_first_display
          changing
               it_outtab       = ialv[]
               it_fieldcatalog = fieldcat[].
    
    *   handler for ALV grid
      set handler event_receiver->handle_hotspot_click for alv_grid.
    
    
    
    ***   Code for second ALV Grid
    
    * Create Controls
      create object alv_container2
             exporting container_name = 'ALV_CONTAINER2'.
    
    *   create Event Receiver
      create object alv_grid2
             exporting  i_parent =  alv_container2.
    
      clear fieldcat.  refresh: fieldcat.
    
      clear: ls_fcat.
      ls_fcat-reptext    = 'Material Number'.
      ls_fcat-coltext    = 'Material Number'.
      ls_fcat-fieldname  = 'MATNR'.
      ls_fcat-ref_table  = 'IALV2'.
      ls_fcat-outputlen  = '18'.
      append ls_fcat to fieldcat2.
    
      clear: ls_fcat.
      ls_fcat-reptext    = 'Plant'.
      ls_fcat-coltext    = 'Plant'.
      ls_fcat-fieldname  = 'MATNR'.
      ls_fcat-ref_table  = 'IALV2'.
      ls_fcat-outputlen  = '4'.
      append ls_fcat to fieldcat2.
    
      clear: ls_fcat.
      ls_fcat-reptext    = 'Store Loc'.
      ls_fcat-coltext    = 'Store Loc'.
      ls_fcat-fieldname  = 'LGORT'.
      ls_fcat-ref_table  = 'IALV2'.
      ls_fcat-outputlen  = '4'.
      append ls_fcat to fieldcat2.
    
      call method alv_grid2->set_table_for_first_display
           changing
               it_outtab       = ialv2[]
               it_fieldcatalog = fieldcat2[].
    
    
    endmodule.
    
    ************************************************************************
    *      Module  USER_COMMAND_0100  INPUT
    ************************************************************************
    module user_command_0100 input.
    
      case sy-ucomm.
    
        when 'BACK' or 'CANC'.
          if not alv_container is initial.
            call method alv_container->free.
            clear: alv_container.
            free : alv_container.
          endif.
          if not alv_container2 is initial.
            call method alv_container2->free.
            clear: alv_container2.
            free : alv_container2.
          endif.
          if sy-subrc = 0.
            set screen 0.
            leave screen.
          else.
            leave program.
          endif.
    
      endcase.
    
    endmodule.
    
    
    *********************************************************************
    *       FORM GET_DATA.
    *********************************************************************
    form get_data.
    
      select mara~matnr makt~maktx
                 into corresponding fields of table ialv
                     from mara
                          inner join makt
                             on mara~matnr = makt~matnr
                                    where mara~matnr in s_matnr
                                      and makt~spras = sy-langu.
    
      sort ialv ascending by matnr.
    
    endform.
    
    *********************************************************************
    *       FORM GET_MORE_DATA.
    *********************************************************************
    form get_more_data.
    
      select matnr werks lgort
                 into corresponding fields of table ialv2
                     from mard
                               where matnr = ialv-matnr.
    
      sort ialv2 ascending by matnr.
    
    endform.
    
    
    
    ************************************************************************
    * GET_DETAILS
    ************************************************************************
    form get_details using index.
    
      read table ialv index index.
      if sy-subrc = 0.
    
        perform get_more_data.
        call method alv_grid2->refresh_table_display.
    
      endif.
    
    endform.
    
    

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.