cancel
Showing results for 
Search instead for 
Did you mean: 

Heading one below the other in column, alv grid?

Former Member
0 Kudos

Is it possible to have headings one below the other in a column of alv grid header?

if so how to achieve it, with some example?!

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

thanks all.

Former Member
0 Kudos

Hi,

Have a look on the following code and try like this

type-pools: slis.

data: x_fieldcat type slis_fieldcat_alv,

it_fieldcat type slis_t_fieldcat_alv,

l_layout type slis_layout_alv,

x_events type slis_alv_event,

it_events type slis_t_event.

data: begin of itab occurs 0,

vbeln like vbak-vbeln,

posnr like vbap-posnr,

male type i,

female type i,

end of itab.

select vbeln

posnr

from vbap

up to 20 rows

into table itab.

x_fieldcat-fieldname = 'VBELN'.

x_fieldcat-seltext_l = 'VBELN'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = 1.

append x_fieldcat to it_fieldcat.

clear x_fieldcat.

x_fieldcat-fieldname = 'POSNR'.

x_fieldcat-seltext_l = 'POSNR'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = 2.

append x_fieldcat to it_fieldcat.

clear x_fieldcat.

x_fieldcat-fieldname = 'MALE'.

x_fieldcat-seltext_l = 'MALE'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = 3.

append x_fieldcat to it_fieldcat.

clear x_fieldcat.

x_fieldcat-fieldname = 'FEMALE'.

x_fieldcat-seltext_l = 'FEMALE'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = 3.

append x_fieldcat to it_fieldcat.

clear x_fieldcat.

x_events-name = slis_ev_top_of_page.

x_events-form = 'TOP_OF_PAGE'.

append x_events to it_events.

clear x_events .

l_layout-no_colhead = 'X'.

call function 'REUSE_ALV_LIST_DISPLAY'

exporting

i_callback_program = sy-repid

is_layout = l_layout

it_fieldcat = it_fieldcat

it_events = it_events

tables

t_outtab = itab

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.

*-To display the headers for main list

format color col_heading.

write: /(45) sy-uline(103).

write: / sy-vline,

(8) ' ' ,

sy-vline,

(8) ' ' ,

sy-vline,

(19) 'SEX'(015) centered,

sy-vline.

write: / sy-vline,

(8) 'VBELN'(013) ,

sy-vline,

(8) 'POSNR'(014) ,

sy-vline,

(8) 'MALE'(016) ,

sy-vline,

(8) 'FMALE'(017) ,

sy-vline.

format color off.

endform.

Regards,

Chandu

Former Member
0 Kudos

HI Padmashree,

Can u explain me detail.......

Former Member
0 Kudos

4 different fields are there like 'length, width, area & surface'.

this 4 fields are same for main headings 'permit details' and 'execution details' .. so i want them as one long heading

and subheadings beneath them in column wise with those headings.

example:.

-


permit details | execution details

-


lengh | width | area | surf | length | width | area | surf |

-


Is this type possible in ALV GRID - HEADER?

if not what is the choice?

Edited by: Padmashree RamMaghenthar on Jun 23, 2008 3:02 PM

Edited by: Padmashree RamMaghenthar on Jun 23, 2008 3:03 PM

Former Member
0 Kudos

Hi,

This is how you can do it:

w_html_top_of_page

Concatenate '--


NEW--


'

'--


OLD--


' into w_title

FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = w_program

i_grid_title = w_title

  • i_callback_pf_status_set = 'SET_PF_STATUS'

i_callback_user_command = 'USER_COMMAND'

i_callback_html_top_of_page = w_html_top_of_page

is_layout = w_layout

it_fieldcat = t_fieldcat

it_sort = t_sorttab

i_default = 'X'

i_save = 'A'

is_variant = w_variante

it_events = t_events

IMPORTING

es_exit_caused_by_user = t_exit_caused_by_user

TABLES

t_outtab = t_output

EXCEPTIONS

program_error = 1

OTHERS = 2.

In this case -


NEW--


OLD----Is the first line of the hdg & on the second line you have got sub headings.

I hope this helps,

Sub headings are normal column hdgs thru Fieldcat.

Regards

Raju Chitale

Edited by: Raju Chitale on Jun 23, 2008 12:26 PM