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 display

Former Member
0 Likes
1,390

hi,

I am using ALV to display one report.

I am using standard ALV report functionality.

I would like to add one header statement above the table like " LINE ITEMS ",etc above the ALV table.

Is it possible to add the header or one line of information above the ALV display or ALV report.

Right now i am using fieldcatalog to display the report .

Thanks in advance.

aasr.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,268

Thanks Jayanti for the response.

But when i see the function module it does not have the option like i_callback_top_of_page.I am inserting the fm as it is .

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

  • EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

  • I_CALLBACK_PROGRAM = ' '

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_STRUCTURE_NAME =

  • IS_LAYOUT =

  • IT_FIELDCAT =

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • 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 =

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

Please advise.

Thanks in advance.

aasr

hi,

I am using ALV to display one report.

I am using standard ALV report functionality.

I would like to add one header statement above the table like " LINE ITEMS ",etc above the ALV table.

Is it possible to add the header or one line of information above the ALV display or ALV report.

Right now i am using fieldcatalog to display the report .

Thanks in advance.

aasr.

11 REPLIES 11
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,268

Hi,

Here is the sample code.

i_output is output table with matnr and werks field.w_output is workarea.

w_output-matnr = 'Material NUmber'.

w_output-werks = 'Plant'.

INSERT w_output INTO i_output INDEX 1.

Read only

0 Likes
1,268

Are you looking at one more column heading or something that gets displayed even above the column headings.

If you want to display something above the column headings, you have something called as COMMENTARY WRITE in the REUSE function modules. Try that out, it will work.

If you are using classes, you can split your container, make the top one as a HTML container and write whatever you want to write there.

The solution given above cannot be used as you are adding one more row to the table, which absolutely does not make snese. It will not look like a heading but will look like a data row. Moreover, if you do a SORT, you don't where the row is going to end up.

Regards,

Ravi

Read only

Former Member
0 Likes
1,268

Hi,

I assume that u want to display the heading for the ALV display right?

If then,

In the PBO,

MODULE status_9001 OUTPUT.

IF o_dockingcontainer IS INITIAL.

SET PF-STATUS 'ZSTATUS'.

SET TITLEBAR 'ZTITLE'.

Double click on the Ztitle it will ask for the title give the description u want that will get dispalyed in the grid.

Hope this helps.

Thanks & Reagards,

Judith.

Read only

Former Member
0 Likes
1,268

Thanks for the response Jayanthi,Ravi and Judith.

Ravi,

i am trying to display the header above the ALV column headings and when i try to use the COMMENTARY WRITE REUSE function module , i could not pass the heading to the workarea slis_t_listhead.I am getting error as "Since the slis_t_listhead doesn't have header, you cannot put value in "typ" field.

Please let me know where am i doing wrong.

Thanks for the reply in advance.

aasr

Read only

0 Likes
1,268
Read only

Former Member
0 Likes
1,268

Yes, try this.

data :

wf_list_top_of_page TYPE slis_t_listheader,

gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.

1. PERFORM f_heading_build USING wf_list_top_of_page[].

FORM f_heading_build USING p_lt_top_of_page

TYPE slis_t_listheader.

DATA: ls_line TYPE slis_listheader.

DATA : wf_loc(25).

ls_line-typ = 'H'.

CONCATENATE 'OMDCS Expence report for the month : '

wf_mtext '-' 'Year: ' p_gjahr

INTO ls_line-info.

APPEND ls_line TO p_lt_top_of_page.

CLEAR ls_line.

ls_line-typ = 'S'.

CLEAR : wf_loc.

wf_loc = wc_tot_read.

SHIFT wf_loc LEFT DELETING LEADING space.

CONCATENATE

'Total Number of records from Input file :' wf_loc

INTO ls_line-info.

APPEND ls_line TO p_lt_top_of_page.

CLEAR: ls_line,wf_loc.

ENDFORM. " f_heading_build

2. PERFORM f_eventtab_build USING wf_events[].

FORM f_eventtab_build USING p_lt_events TYPE slis_t_event.

DATA: ls_event TYPE slis_alv_event.

*

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = p_lt_events.

READ TABLE p_lt_events WITH KEY name = slis_ev_top_of_page

INTO ls_event.

IF sy-subrc = 0.

MOVE gc_formname_top_of_page TO ls_event-form.

APPEND ls_event TO p_lt_events.

ENDIF.

ENDFORM. " f_eventtab_build

3.

FORM top_of_page.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = wf_list_top_of_page.

ENDFORM.

4.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_buffer_active = ' '

i_callback_program = wf_repid

is_layout = wf_layout

it_fieldcat = wf_fieldcat[]

it_sort = wf_sort[]

i_save = wf_save

is_variant = wf_variant

it_events = wf_events[]

TABLES

t_outtab = <datatab>.

Prabhu Rajesh

Read only

Former Member
0 Likes
1,268

hi jayanti ,

I am using REUSE_ALV_LIST_DISPLAY, i want to display header using above function module but the site shows for another fm.Please advise.

Thanks in advance

aasr

Read only

0 Likes
1,268

Hi,

Check this.It is for the FM you asked.

http://www.sapdevelopment.co.uk/reporting/alv/alvlist_code.htm

Read only

Former Member
0 Likes
1,269

Thanks Jayanti for the response.

But when i see the function module it does not have the option like i_callback_top_of_page.I am inserting the fm as it is .

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

  • EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

  • I_CALLBACK_PROGRAM = ' '

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_STRUCTURE_NAME =

  • IS_LAYOUT =

  • IT_FIELDCAT =

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • 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 =

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

Please advise.

Thanks in advance.

aasr

Read only

0 Likes
1,268

Hi,

Just try to add that also in the function module as in that sample code and activate.

Did you tried it?

Message was edited by: Jayanthi Jayaraman

Read only

0 Likes
1,268

Can try this out

form display_alv_report.

gd_repid = sy-repid.

call function 'REUSE_ALV_LIST_DISPLAY'

exporting

i_callback_program = gd_repid

i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM

  • i_callback_user_command = 'USER_COMMAND'

  • i_grid_title = outtext

is_layout = gd_layout

it_fieldcat = fieldcatalog[]

  • it_special_groups = gd_tabgroup

  • IT_EVENTS = GT_XEVENTS

i_save = 'X'

  • is_variant = z_template

tables

t_outtab = it_ekko

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.

endform. " DISPLAY_ALV_REPORT

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 = 'EKKO Table Report'.

append wa_header to t_header.

clear wa_header.

  • Date

wa_header-typ = 'S'.

wa_header-key = 'Date: '.

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

sy-datum+4(2) '.'

sy-datum(4) INTO wa_header-info. "todays date

append wa_header to t_header.

clear: wa_header.

  • Total No. of Records Selected

describe table it_ekko lines ld_lines.

ld_linesc = ld_lines.

concatenate 'Total No. of Records Selected: ' ld_linesc

into t_line separated by space.

wa_header-typ = 'A'.

wa_header-info = t_line.

append wa_header to t_header.

clear: wa_header, t_line.

<b> call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = t_header.

endform.</b>

Thanks & Regards,

Judith.