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

multiple rows in alv header

Former Member
0 Likes
1,574

is is possible to display multiple rows in the alv header of an ALV

like

VBELN POSNR

SALESDOCU ITEM

This is the header of the ALV. Is it possible to do so...if yes, please give some program pointers..for the same.

Thanks & Regards,

Vijay

7 REPLIES 7
Read only

anversha_s
Active Contributor
0 Likes
825

Hi,

see if this is what you are looking for.

Regards,

Anver

Read only

0 Likes
825

hi anversha,

i saw that post and used that program.

it doesn't work...is it possbile to explain the logic behind that program...how to build the two screens 100 and 200....I copied the program and did necessary syntax changes....it doesn't work. in fact there is no display appearing....and the program doesn't use a field catalog...so how will the ALV display header in the first place?

Thanks & Regards,

Vijay

Read only

Former Member
0 Likes
825

Read only

santhosh_patil
Contributor
0 Likes
825

Hi,

Yes it is possible , like u display the normal header

in any ALV...

display the data(multiple rows ) in the TOP-OF-PAGE event of ALV.

code :

1. populate the event catlog

g_r_events-name = 'TOP_OF_PAGE'.

g_r_events-form = 'TOP_OF_PAGE'.

2. Call the alv function :

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_pf_status_set = 'PF_STATUS_SET'

i_callback_user_command = 'USER_COMMAND'

.

.

..............

..............

i_save = g_f_save

is_variant = g_r_variant

<b> it_events = g_t_events[]</b>

.........

.........

3. define the form TOP_OF_PAGE.

Form TOP_OF_PAGE.

HERE u code the logic to print data.

loop at itab.

write: itab-vbeln........

endloop.

endform.

-


Santhosh

Read only

0 Likes
825

santhosh,

i don't want to display in the top of page

i want to display in the alv header column itself.

there is a difference.

Regards,

Vijay

Read only

Former Member
0 Likes
825

Check out below code:

report ztest_alv_check message-id zz line-size 50 .

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.

It is there in link which I had given earlier. I have executed the code and it gives the output in the way you want. Just check it once.

Best Regards,

Vibha

*Please mark all the helpful answers

Read only

santhosh_patil
Contributor
0 Likes
825

Hi vijay,

There is lot of difference.

One Que. why u want to display the item data in the header?

You can do one thing .

U can use hierarchical list display..

in which u can display the data at the header level and also the data at the item level. u can use the below FM

REUSE_ALV_HIERSEQ_LIST_DISPLAY

-


Santhosh