Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple section in ALV

Former Member
0 Kudos

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.

7 REPLIES 7

Former Member
0 Kudos

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.

0 Kudos

Thanks for taking the time and replying.... but i want to know one thing whether will it display the ALV in list or grid??

0 Kudos

hi,

it will display in list....

Former Member
0 Kudos

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

Former Member
0 Kudos

hi,

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

regards,

pavan t.

vinod_vemuru2
Active Contributor
0 Kudos

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.

former_member583013
Active Contributor
0 Kudos

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.