Application Development and Automation 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: 
Read only

ALV GRID Header

Former Member
0 Likes
497

Hi..all.

I have a question.

Is there any method to make dual header?

For example,

table name 1

table name 2

fld1

fld2

fld3

fld4

fld1

fld2

fld3

fld4

record

....

end of list.

I found some materials and Dev.class slis but I couldn't find the method.

Is this possible? If I can't do this, what I can use as an alternative.

Ilook forward your answer.

Thanks.

3 REPLIES 3
Read only

Former Member
0 Likes
473

Hi,

There is no such provision in ALV grid.

You will have to go for classical reporting.

Regards,

Sachin

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
473

Hello,

table name 1 table name 2

fld1 fld2 fld3 fld4 fld1 fld2 fld3 fld4

Unfortunately cannot be done through ALV as suggested in the post above you can use Classical report.

Else if you donot want to lose ALV functionalities you can try something like:

table1- fld1 table2-fld2 table2-fld3 table2-fld4 .... and so on

Upto you to decide.

BR,

Suhas

Read only

Former Member
0 Likes
473

Hi,

In ALV Grid this is not possible but with ALV List this is possible as elaborated below.

For displaying two headers in ALV, you have to use the following process...

  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      i_bypassing_buffer     = c_x
      i_callback_program    = lv_repid
      is_layout                   = wa_layout
      it_fieldcat                  = it_fieldcat
      it_events                   = it_events
      i_save                      = c_a
    TABLES
      t_outtab                   = it_final
    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.

For setting layout use the following form -

*&---------------------------------------------------------------------*
*&      Form  F_SET_LAYOUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_set_layout .

  wa_layout-zebra             = c_x.
  wa_layout-colwidth_optimize = c_x.

ENDFORM.                    " F_SET_LAYOUT

Similarly for events use -

*&---------------------------------------------------------------------*
*&      Form  F_CALL_EVENT
*&---------------------------------------------------------------------*
*      Defining events which have to triggered
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f_call_event .

  wa_events-name = slis_ev_top_of_page.
  wa_events-form   = c_top.                   

  APPEND wa_events TO it_events.
  CLEAR wa_events .

ENDFORM.                    " F_CALL_EVENT

where c_top is defined as -

c_top                TYPE slis_formname    VALUE 'TOP_OF_PAGE'

Also u have to define a form (mentioned below) with the same name which can be called from f_call_event form automaticaly...

*&---------------------------------------------------------------------*
*&      Form  TOP_OF_PAGE
*&---------------------------------------------------------------------*
*       Defining the column's main heading
*----------------------------------------------------------------------*
FORM top_of_page.

  FORMAT COLOR COL_HEADING.

  WRITE : / sy-uline(255).

  WRITE : / sy-vline,
            (10)c_space,
            sy-vline,
            (2) c_space,
            sy-vline,
            (8) c_space,
            sy-vline,
            (17)c_space,
            sy-vline,
            (18)c_space,
            sy-vline,
            (18)c_space,
            sy-vline,
            (26)c_space,
            sy-vline,
            (31)c_space,
            sy-vline,
            (12)c_space,
            sy-vline,
            (41)c_jan   CENTERED,
            sy-vline,
            (41)c_feb   CENTERED,
            sy-vline,
            (41)c_mar   CENTERED,
            sy-vline,
            (41)c_apr   CENTERED,
            sy-vline,
            (41)c_may   CENTERED,
            sy-vline,
            (41)c_jun   CENTERED,
            sy-vline.

  FORMAT COLOR OFF.

ENDFORM.                    "top_of_page

In this you can define the 1st column headings along with the position.

This will help you add 2 headers to each column viz....

1st Heading from the top of the page form

and

2nd heading from the field catalog you have defined.

Let me know in case any further detail is needed.

Thanks.