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

alv grid display

Hi all,

I want to display 2 alv grid display on same screen.

Output is look like:

kunnr BUKRS

10001 abcd

10002 abcd

belnr -


bldat----


budat

20001 12-11-2007 31-11-2007

20002 10-11-2007 31-11-2007

I m not using 00P concept for this alv grid display.

Plz help me.

thank u in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 12, 2007 at 04:15 AM

    Hi Ankita ,

    I dont think you can acheive this in ALV grids without OOPS , but this can be done in an ALV List.

    Regards

    Arun

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Ankita ,

      You need to use the functions for Bloacked ALV.

      The functions generally used are

      1.REUSE_ALV_BLOCK_LIST_INIT

      2.REUSE_ALV_BLOCK_LIST_APPEND

      3.REUSE_ALV_BLOCK_LIST_DISPLAY.

      Here is a sample code which does the same

      INCLUDE ZAR_ALV_BLOCK_TOP.
      
      start-of-selection.
      
             select matnr werks
             up to 10 rows
             into table it_1
             from marc.
      
      
             select matnr werks lgort labst
             up to 10 rows
             into table it_2
             from mard.
      
      
      *wa_cat-fieldname = 'MATNR'.
      *append wa_cat to cat1..
      *
      *wa_cat-fieldname = 'WERKS'.
      *append wa_cat to cat1..
      *
      *CAT2[] = CAT1[].
      *wa_cat-fieldname = 'LGORT'.
      *append wa_cat to cat2.
      v_rep = sy-repid.
      BREAK-POINT.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
         I_PROGRAM_NAME               =  v_rep
         I_INTERNAL_TABNAME           = 'IT_1'
      *   I_STRUCTURE_NAME             =
      *   I_CLIENT_NEVER_DISPLAY       = 'X'
         I_INCLNAME                   = v_rep
      *   I_BYPASSING_BUFFER           =
      *   I_BUFFER_ACTIVE              =
        CHANGING
          ct_fieldcat                  = CAT1
      * 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.
      
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
         I_PROGRAM_NAME               =  v_rep
         I_INTERNAL_TABNAME           = 'IT_2'
      *   I_STRUCTURE_NAME             =
      *   I_CLIENT_NEVER_DISPLAY       = 'X'
         I_INCLNAME                   = v_rep
      *   I_BYPASSING_BUFFER           =
      *   I_BUFFER_ACTIVE              =
        CHANGING
          ct_fieldcat                  = CAT2
      * 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.
      
      
      
      
      
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
        EXPORTING
          i_callback_program             = v_rep
      *   I_CALLBACK_PF_STATUS_SET       = ' '
      *   I_CALLBACK_USER_COMMAND        = ' '
      *   IT_EXCLUDING                   =
                .
      
      
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout                        = ls_layo
          it_fieldcat                      = cat1
          i_tabname                        = 'table_1'
          it_events                        = event
      *   IT_SORT                          =
      *   I_TEXT                           = ' '
        tables
          t_outtab                         = it_1
      * EXCEPTIONS
      *   PROGRAM_ERROR                    = 1
      *   MAXIMUM_OF_APPENDS_REACHED       = 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.
      
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout                        = ls_layo
          it_fieldcat                      = cat2
          i_tabname                        = 'table_1'
          it_events                        = event
      *   IT_SORT                          =
      *   I_TEXT                           = ' '
        tables
          t_outtab                         = it_2
      * EXCEPTIONS
      *   PROGRAM_ERROR                    = 1
      *   MAXIMUM_OF_APPENDS_REACHED       = 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.
      
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
      * EXPORTING
      *   I_INTERFACE_CHECK             = ' '
      *   IS_PRINT                      =
      *   I_SCREEN_START_COLUMN         = 0
      *   I_SCREEN_START_LINE           = 0
      *   I_SCREEN_END_COLUMN           = 0
      *   I_SCREEN_END_LINE             = 0
      * IMPORTING
      *   E_EXIT_CAUSED_BY_CALLER       =
      *   ES_EXIT_CAUSED_BY_USER        =
      * 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.

      <b>The code for include ZAR_ALV_BLOCK_TOP is as below</b>

      type-pools : slis.
      
      data : Begin of it_1 occurs 0,
                matnr like marc-matnr ,
                werks like marc-werks ,
               End of it_1.
      
      data : Begin of it_2 occurs 0 ,
                matnr like marc-matnr ,
                werks like marc-werks ,
                lgort like mard-lgort,
                labst like mard-labst ,
              End of it_2.
      
      
      
      
      *Data : it_1 type table of ty_1 ,
      *       it_2 type table of ty_2 ,
      *       v_rep type sy-repid.
      
      data : v_rep type sy-repid.
      
      *--> Varaibles for ALV
      Data : cat1 type slis_t_fieldcat_alv,
             cat2 type slis_t_fieldcat_alv,
             wa_cat like line of cat1,
             event type SLIS_T_EVENT ,
             ls_layo   type slis_layout_alv.

      The include is not actually required , if you are creaitng the field catalog manually.

      Do reward points if reply is helpful and feel free to get back in case you have any further queries.

      Regards

      Arun

  • Posted on Sep 12, 2007 at 04:08 AM

    Hi Ankita,

    You can't have 2 ALV Grids on same screen without using OOPS.

    <u><b>OOPS STEPS</b></u>

    Create a screen. Open the layout & place 2 containers one below the other.

    Create ALV using OOPS for both containers.

    Best regards,

    Prashant

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 12, 2007 at 04:09 AM

    Hi,

    in the form of grid it is not possible in normal alv.but, u can show more than one list.

    if u want to display more than one grid in a screen u screen create a screen(in that screen custom container) and OOalv.

    for examples see the system defined programs BCALV_*

    rgds,

    bharat.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 12, 2007 at 05:06 AM

    Hi

    i am sending you a program in which

    the out of the report is displayed in the 2 different table in a single screen

    i think it will be very usefull for you

    execute this and see how its works

    reward if usefull

    tables: mara,spfli.
    
    types: begin of ty_tab,
            matnr type mara-matnr,
            ernam type mara-ernam,
            ersda type mara-ersda,
           end of ty_tab.
    
    DATA ITAB1 TYPE TABLE OF SPFLI.
    DATA WA1 LIKE LINE OF ITAB1.
    
    DATA IO1 TYPE SPFLI-CARRID VALUE 'AA'.
    
    
    
    data itab type table of ty_tab.
    
    data wa like line of itab.
    
    DATA OK_CODE TYPE SY-UCOMM.
    
    DATA: GRID TYPE REF TO CL_GUI_ALV_GRID,
          CONT TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    
    DATA: GRID1 TYPE REF TO CL_GUI_ALV_GRID,
          CONTA TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    
    
    CREATE OBJECT CONT EXPORTING CONTAINER_NAME = 'CONT1' .
    CREATE OBJECT GRID EXPORTING I_PARENT = CONT .
    
    CREATE OBJECT CONTA EXPORTING CONTAINER_NAME = 'CONT2' .
    CREATE OBJECT GRID1 EXPORTING I_PARENT = CONTA .
    
    
    
    selection-screen begin of block b1 with frame title text-100.
    
    select-options: s_matnr for mara-matnr.
    
    selection-screen end of block b1.
    
    select matnr ernam ersda from mara into corresponding fields of table itab up to 15 rows
    where matnr in s_matnr .
    
    call selection-screen 100.
    *&---------------------------------------------------------------------*
    *&      Module  USER_COMMAND_0100  INPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE USER_COMMAND_0100 INPUT.
    
    if ok_code = 'PB1'.
    
    leave to screen 0.
    
    else.
    
    leave to screen 100.
    
    endif.
    
    
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&---------------------------------------------------------------------*
    *&      Module  STATUS_0100  OUTPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE STATUS_0100 OUTPUT.
    *  SET PF-STATUS 'xxxxxxxx'.
    *  SET TITLEBAR 'xxx'.
    
     SELECT * FROM SPFLI INTO
      CORRESPONDING FIELDS OF TABLE ITAB1 WHERE CARRID = IO1.
    
    
    CALL METHOD grid->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
    *    I_BUFFER_ACTIVE               =
    *    I_BYPASSING_BUFFER            =
    *    I_CONSISTENCY_CHECK           =
        I_STRUCTURE_NAME              = 'MARA'
    *    IS_VARIANT                    =
    *    I_SAVE                        =
    *    I_DEFAULT                     = 'X'
    *    IS_LAYOUT                     =
    *    IS_PRINT                      =
    *    IT_SPECIAL_GROUPS             =
    *    IT_TOOLBAR_EXCLUDING          =
    *    IT_HYPERLINK                  =
    *    IT_ALV_GRAPHICS               =
    *    IT_EXCEPT_QINFO               =
    *    IR_SALV_ADAPTER               =
      CHANGING
        IT_OUTTAB                     = itab.
    *    IT_FIELDCATALOG               =
    *    IT_SORT                       =
    *    IT_FILTER                     =
    *  EXCEPTIONS
    *    INVALID_PARAMETER_COMBINATION = 1
    *    PROGRAM_ERROR                 = 2
    *    TOO_MANY_LINES                = 3
    *    others                        = 4
            .
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    
       CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME = 'SPFLI'
        CHANGING
          IT_OUTTAB        = ITAB1.
    
    
    ENDMODULE.                 " STATUS_0100  OUTPUT

    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.