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

Multiple section in ALV

Hi Guys,

My exiting program displays an ALV in Grid form. One my requirement is to display an ALV grid with 3 different sections with seprate headers and data and subheadings for each. Is it possible?? If so how??... Please help.... Answers will be suitably rewarded.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 19, 2008 at 06:32 AM

    Hi,

    displaying alv grid in different sections using FMs is not possible.for that u need to go for OOALV.or u can display alv list ini different sections.

    *&---------------------------------------------------------------------*
    *& Report  ZBHALV_BLOCK_LIST                                           *
    *&                                                                     *
    *&---------------------------------------------------------------------*
    *&                                                                     *
    *&                                                                     *
    *&---------------------------------------------------------------------*
    
    REPORT  ZBHALV_BLOCK_LIST.
    
    
    TABLES:LFA1,EKKO.
    
    SELECT-OPTIONS:LIFNR FOR LFA1-LIFNR.
    
    DATA:BEGIN OF ITAB OCCURS 0,
         LIFNR LIKE LFA1-LIFNR,
         NAME1 LIKE LFA1-NAME1,
         LAND1 LIKE LFA1-LAND1,
         ORT01 LIKE LFA1-ORT01,
         REGIO LIKE LFA1-REGIO,
    END OF ITAB.
    
    DATA:BEGIN OF JTAB OCCURS 0,
         LIFNR LIKE EKKO-LIFNR,
         EBELN LIKE EKKO-EBELN,
         BUKRS LIKE EKKO-BUKRS,
         BSTYP LIKE EKKO-BSTYP,
         EKORG LIKE EKKO-EKORG,
         BSART LIKE EKKO-BSART,
    END OF JTAB.
    
    SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE LIFNR
    IN LIFNR.
    
    SELECT * FROM EKKO INTO CORRESPONDING FIELDS OF TABLE JTAB WHERE LIFNR
    IN LIFNR.
    
    TYPE-POOLS:SLIS.
    
    DATA:LAYOUT TYPE slis_layout_alv.
    DATA:EVE TYPE slis_t_event WITH HEADER LINE.
    DATA:EVE1 TYPE slis_t_event WITH HEADER LINE.
    DATA:HEAD TYPE slis_t_listheader WITH HEADER LINE.
    DATA:FCAT TYPE slis_t_fieldcat_alv.
    DATA:FCAT1 TYPE slis_t_fieldcat_alv.
    
    
    LAYOUT-ZEBRA = 'X'.
    LAYOUT-colwidth_optimize = 'X'.
    LAYOUT-WINDOW_TITLEBAR = 'VENDOR DETAILS SCREEN'.
    
    
    
    EVE1-NAME = 'TOP_OF_PAGE'.
    EVE1-FORM = 'TOP_OF_PAGE1'.
    APPEND EVE1.
    
    
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
     EXPORTING
       I_LIST_TYPE           = 0
     IMPORTING
       ET_EVENTS             = EVE[]
     EXCEPTIONS
       LIST_TYPE_WRONG       = 1
       OTHERS                = 2
              .
    IF SY-SUBRC <> 0.
     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    
    
    READ TABLE EVE WITH KEY NAME = 'TOP_OF_PAGE'.
    EVE-FORM = 'TOP_OF_PAGE'.
    MODIFY EVE TRANSPORTING FORM WHERE NAME = 'TOP_OF_PAGE'.
    
    
    
    
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
      EXPORTING
        I_CALLBACK_PROGRAM             = SY-REPID
    *   I_CALLBACK_PF_STATUS_SET       = ' '
    *   I_CALLBACK_USER_COMMAND        = ' '
    *   IT_EXCLUDING                   =
              .
    
    
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
     EXPORTING
       I_PROGRAM_NAME               = SY-REPID
       I_INTERNAL_TABNAME           = 'ITAB'
    *   I_STRUCTURE_NAME             =
    *   I_CLIENT_NEVER_DISPLAY       = 'X'
       I_INCLNAME                   = SY-REPID
    *   I_BYPASSING_BUFFER           =
    *   I_BUFFER_ACTIVE              =
      CHANGING
        CT_FIELDCAT                  = 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.
    
    
    
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
      EXPORTING
        IS_LAYOUT                        = LAYOUT
        IT_FIELDCAT                      = FCAT
        I_TABNAME                        = 'ITAB'
        IT_EVENTS                        = EVE[]
    *   IT_SORT                          =
    *   I_TEXT                           = ' '
      TABLES
        T_OUTTAB                         = ITAB
    * 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_FIELDCATALOG_MERGE'
     EXPORTING
       I_PROGRAM_NAME               = SY-REPID
       I_INTERNAL_TABNAME           = 'JTAB'
    *   I_STRUCTURE_NAME             =
    *   I_CLIENT_NEVER_DISPLAY       = 'X'
       I_INCLNAME                   = SY-REPID
    *   I_BYPASSING_BUFFER           =
    *   I_BUFFER_ACTIVE              =
      CHANGING
        CT_FIELDCAT                  = FCAT1
    * 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_APPEND'
      EXPORTING
        IS_LAYOUT                        = LAYOUT
        IT_FIELDCAT                      = FCAT1
        I_TABNAME                        = 'JTAB'
        IT_EVENTS                        = EVE1[]
    *   IT_SORT                          =
    *   I_TEXT                           = ' '
      TABLES
        T_OUTTAB                         = JTAB
    * 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.
    
    
    
    FORM TOP_OF_PAGE.
    REFRESH HEAD.
         HEAD-TYP = 'H'.
         HEAD-INFO = 'VENDORS DETAILS'.
         APPEND HEAD.
    
         CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
             IT_LIST_COMMENTARY       = HEAD[]
    *        I_LOGO                   =
    *        I_END_OF_LIST_GRID       =
                   .
    
    ENDFORM.
    
    
    FORM TOP_OF_PAGE1.
    REFRESH HEAD.
         HEAD-TYP = 'H'.
         HEAD-INFO = 'PURCHASE DOCCUMENTS DETAILS'.
         APPEND HEAD.
    
         CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
             IT_LIST_COMMENTARY       = HEAD[]
    *        I_LOGO                   =
    *        I_END_OF_LIST_GRID       =
                   .
    
    ENDFORM.
    

    rgds,

    bharat.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 19, 2008 at 06:36 AM

    Hi,

    Example of the Standard Report .

    BALVBT01.

    Regards,

    Balakumar.G

    <REMOVED BY MODERATOR>

    Edited by: Alvaro Tejada Galindo on Mar 19, 2008 6:52 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 19, 2008 at 06:39 AM

    hi,

    we can go for blocked hieraical alvs to display three different sections with header and item

    regards,

    pavan t.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 19, 2008 at 06:56 AM

    Hi Jayesh,

    Yes it is possible with oops ALV. Create a screen.

    Create 3 containers for 3 different displays. Biuld 3 field catelogues and 3 internal tables as per ur requirement.

    While u r calling the screen u have created call this piece of code in the PBOmodule of the screen 3 times with ur internal tables and field catelogues and corrosponding containers.

    CREATE OBJECT container

    EXPORTING

    container_name = 'CON'.

    CREATE OBJECT grid

    EXPORTING

    i_parent = container.

    CALL METHOD grid->set_table_for_first_display

    • EXPORTING

    • is_layout = wa_layout

    CHANGING

    it_outtab = i_zvfortdeltemp

    it_fieldcatalog = i_fieldcat

    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.

    With nornal ALV i saw 2 lists. One is normal list and the other is at the end of list.

    Use Fm REUSE_ALV_COMMENTARY_WRITE for this.

    Thanks,

    Vinod.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 19, 2008 at 10:54 PM

    Check this weblog... [Dynamic ALV List Display|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/5094] [original link is broken] [original link is broken] [original link is broken]; It uses Dynamic tables to construct the ALV. Each block correspond to each Airline Carrier code...

    Greetings,

    Blag.

    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.