Application Development 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: 

ALV grid Multiple Header ... ?

nishanthbhandar
Contributor
0 Kudos

Hi All,

My requirement is to display data in 3 levels using ALV grid display.For this i need three separate rows for describing the columns.Is it possible to do this in ALV grid ? If not i welcome suggestions for the approach i need to follow to achieve my requirement.

Cheers

Nishanth

8 REPLIES 8

Former Member
0 Kudos

Hi Nishanth,

First of all i would like know about your requirements,Is it going to be a three level drill down list or in single page you would like to display three types of data.

whatever may be the case both can be done.

if it's going three level drill down list then you can use can see following piece of code. declaration should be like this.

top_of_page type slis_formname value 'TOP_OF_PAGE',

end_of_page type slis_formname value 'END_OF_PAGE',

user_command type slis_formname value 'USER_COMMAND',

pf_status_set type slis_formname value 'PF_STATUS_SET',

user_command1 type slis_formname value 'USER_COMMAND1',

pf_status_set1 type slis_formname value 'PF_STATUS_SET1',

and displaying the first list will be.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

i_callback_program = name

i_callback_pf_status_set = pf_status_set

i_callback_user_command = user_command

  • I_STRUCTURE_NAME =

i_callback_top_of_page = 'TOP-OF-PAGE'

i_grid_title = 'CUSTOMER GROUP WISE REPORT'

is_layout = layout

it_fieldcat = fieldcat_t

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • it_sort = SORT_T

  • IT_FILTER =

  • IS_SEL_HIDE =

i_default = 'X'

i_save = 'A'

  • IS_VARIANT =

  • it_events = events_t

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • IT_ADD_FIELDCAT = FIELDCAT_T1

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

tables

t_outtab = it_basic.

and capturing user command will be like this.

form user_command using ucomm like sy-ucomm

selfield type slis_selfield.

case ucomm.

when '&IC1'.

read table it_basic index selfield-tabindex.

perform get_data_first_list using it_basic-kdgrp.

when '&PLEVEL'.

when '&CUST'.

when '&F15'.

leave to screen 0.

endcase.

endform. "user_command

you may be able to display the similar when the double click a line or clicking on a button.

if you want have mulitple header lines on the top of page you can this.

form top-of-page.

*ALV Header declarations

data: t_header type slis_t_listheader,

wa_header type slis_listheader.

wa_header-typ = 'H'.

wa_header-info = xhead.

append wa_header to t_header.

clear wa_header.

concatenate sy-datum6(2) sy-datum4(2) sy-datum+0(4) into xhead1

separated by '.'.

wa_header-typ = 'H'.

wa_header-info = xhead1.

append wa_header to t_header.

clear wa_header.

  • append t_header.

*append t_header.

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = t_header.

  • i_logo = 'Z_LOGO'.

endform. "top-of-page

Former Member
0 Kudos

Hi Nishanth,

Which version of SAP are you using? I'm sure that it is possible till 4.6C. I think we may be able to do it in 4.7.

In 4.6C, however, we can display a two level list. You can look at the Function Module REUSE_ALV_HIERSEQ_LIST_DISPLAY. It is well documented. You can also search for the programs where it is used.

In case you are on 4.6C and want this functionality, then you can display the first level as a single list. When the user clicks on any of the lines here, you can display the remaining two levels using the above function module.

Regards,

Anand Mandalika.

nishanthbhandar
Contributor
0 Kudos

Thank you for the answers..Guys.I am using SAP version 4.7..I guess i need some time to research on the info that you guys have provided...i am not using the classical approach for building my ALV grid.I am using the implementatiion of the class CL_GUI_ALV_GRID and using the methods inside it to build my grid....What i am specifically looking for is to have my grid display something like this.( soon after selection-screen execution ).

Order Number Location StartDate FinishDate

Status Operation Operation Start Date

Status Material

The above three rows give the description of what the data in the below three rows represent..

For example :

500000333 006 5/2/2005 5/12/2005

Not completed 10 5/11/2005

Released Test-1

Hope this gives a better idea of what i am trying to achieve....

Cheers

Nishanth

0 Kudos

It gets all the more easier.

When you create a screen, split the screen into two parts, the header and the body. The body will have a customer container and the header, you can place text fields with display only option and you can display your fields.

Best Regards,

Subramanian V.

0 Kudos

Hi Nishanth,

Do I understand it correctly that the different rows do not really have any hierarchical relation ship between each other?

In that case, it doesn't make too much sense to display the results in three lines. If you want to do it anyways, I think you can't use ALV for the purpose.

If on the otherhand they do have a hierarchical relationship, then I will also look if I can find something. do let me know.

Regards,

Anand Mandalika.

0 Kudos

Hi Anand,

Thanks again...The Different Rows do have a hierarchical relationship.The first row is the order and the second is the sub-order and the third one shows the components of the sub-order.Please let me know if there is any alternative.I am currently looking into the SLIS package to see if i can find anything useful.

Cheers

Nishanth

0 Kudos

thanks for reply, but here i do't have heirarchy list. i have to print one record in multiple row, this client requirement.

kmoore007
Active Contributor
0 Kudos

You can do up to 3 header rows in the ALV List function. I don't know if you can do this in the Grid function, however.