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 Header

Former Member
0 Likes
544

Hi all,

In ALVs, I need multiple coloms in header ( list header / top of page)

i am getting multile lines, how to get multiple columns?

3 REPLIES 3
Read only

Former Member
0 Likes
530

hi,

i think its not possible...

Read only

Former Member
0 Likes
530

Hi,

try this code,it meets your requirement. Execute the code.

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: / 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.

Thanks,

chandu.

Read only

Former Member
0 Likes
530

Hello Try the following:

write this in alv_reuse_grid_display parameter:

--> i_callback_top_of_page = 'TOP-OF-PAGE'

In top_of_page write foll code:

FORM top-of-page.

*ALV Header declarations

DATA: t_header TYPE slis_t_listheader,

wa_header TYPE slis_listheader,

t_line LIKE wa_header-info,

ld_lines TYPE i,

ld_linesc(10) TYPE c.

  • Title

wa_header-typ = 'H'.

wa_header-info = 'PURCHASE ORDER DETAILS'.

APPEND wa_header TO t_header.

CLEAR wa_header.

  • Date

wa_header-typ = 'S'.

wa_header-key = 'Report generated By : '.

CONCATENATE 'xyz '

'pqr COMPANY : ABC TECHNOLOGIES LIMITED'

INTO wa_header-info. "todays date

APPEND wa_header TO t_header.

CLEAR: wa_header.

wa_header-typ = 'A'.

wa_header-info = 'DATE :'.

CONCATENATE sy-datum+6(2) '.'

sy-datum+4(2) '.'

sy-datum(4) INTO wa_header-info.

APPEND wa_header TO t_header.

CLEAR: wa_header.

Edited by: Rohan Hardikar on Feb 22, 2008 2:39 PM