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

sushant_singh
Participant
0 Likes
332

Hi experts

I want to display 3 Columns in Ist row of an ALV and from 2nd row onwards there will be 8 columns. How can I do this.

I am using 'REUSE_ALV_GRID_DISPLAY' FM for displaying the ALV.

I have tried it using ROW_POS field of Field catalog. It was not working.Please help me out.If possible please send me code.

Points are sure.

Thanks,

Sushant

Hi experts

I want to display 3 Columns in Ist row of an ALV and from 2nd row onwards there will be 8 columns. How can I do this.

I am using 'REUSE_ALV_GRID_DISPLAY' FM for displaying the ALV.

I have tried it using ROW_POS field of Field catalog. It was not working.Please help me out.If possible please send me code.

Points are sure.

Thanks,

Sushant

1 REPLY 1
Read only

former_member402443
Contributor
0 Likes
313

Hi Sushant,

Check this code.this gives you an idea how to solve ur problem.

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 ne 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.

Reward Points,if useful.

Regards,

Manoj Kumar