cancel
Showing results for 
Search instead for 
Did you mean: 

ALV Grid top of page

Former Member
0 Kudos

HI All,

I want to display some text on top of my grid. For that I am using 'REUSE_ALV_COMMENTARY_WRITE' function & writing a subroutine 'TOP_OF_PAGE'. In that passing

it_list_commentary = header. Header is having that text I want to display. And finally passing it at 'REUSE_ALV_GRID_DISPLAY' IT_EVENTS = xt_events.

But that top of page text is not comming.

What I am missing?

Regards,

Dilip

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

See the smaple code

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = gd_repid

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

is_layout = gd_layout

it_fieldcat = fieldcatalog[]

i_save = 'X'

tables

t_outtab = it_ekko

exceptions

program_error = 1

others = 2.

----


  • Form TOP-OF-PAGE *

----


  • ALV Report Header *

----


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.

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = t_header.

  • i_logo = 'Z_LOGO'.

endform.

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

Former Member
0 Kudos

Hi ,

We handle this using slis_t_event.

So is there any specific reason to use

i_<b>callback_top_of_page = 'TOP-OF-PAGE'</b>

Regards,

Dilip

Former Member
0 Kudos

Hi,

If u r not using that the TOP-OF-PAGE event then it wont get trigger. its mandatory to use i_callback_top_of_page = 'TOP-OF-PAGE' .

Its similar to passing teh output internal table in the outtab.

Please reward and close the thread if this helps.

Former Member
0 Kudos

Hi Judith,

As mention by you i have msde the changes.

But still the blank space is comming the text I want to display is not comming.

following id my subroutine.

FORM top-of-page.

wa_header-typ = 'H'.

wa_header-info = 'Displaying selected materials Details'.

APPEND wa_header TO header.

CLEAR wa_header.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = header

  • I_LOGO = 'ENJOYSAP_LOGO'

  • I_END_OF_LIST_GRID =

.

ENDFORM.

And in reuse_alv_grid_display :-

i_callback_top_of_page = 'TOP-OF-PAGE'

Former Member
0 Kudos

hI,

U CAN TRY OUT THE SAMPLE PROGRAM IN THE LINK.

Can u copy and past me ur code as a whole so taht i can have a look into it.

What u have mentioned below is right.

I want to confirm u that have u checked that the top-of-page is appearing for u or its some white color part appears at the top? If then u can ask them to reinstall SAP.

Reply me reg this.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi Diliip,

Just check SE80.Is it possible for you to choose the development class and type the program you want.

Are you getting blank screen there also?

If it is blank, then it is GUI problem only.

You have to reinstall.

Former Member
0 Kudos

Hi,

Even I tried the sap standard program <b>'BCALV_FULLSCREEN_DEMO'.</b> There also the no o/p in

top-of-page.

i m attatching my full sample code which I am using as a template for all programs.

Regards,

Dilip

REPORT zialvd01.

TABLES : mara , makt.

TYPE-POOLS: slis,abap.

DATA : fld_cat TYPE slis_t_fieldcat_alv,

fls TYPE slis_fieldcat_alv,

fld_lay TYPE slis_layout_alv,

xt_events TYPE slis_t_event,

ls_events TYPE slis_alv_event,

header TYPE slis_t_listheader,

wa_header LIKE LINE OF header,

footer TYPE slis_t_listheader,

wa_footer LIKE LINE OF footer.

SELECT-OPTIONS s_matnr FOR mara-matnr.

DATA : BEGIN OF exclude OCCURS 1,

fcode LIKE rsmpe-func,

END OF exclude.

DATA BEGIN OF IT_MARA OCCURS 1.

INCLUDE STRUCTURE MARA.

DATA END OF IT_MARA.

START-OF-SELECTION.

PERFORM select_data.

IF it_mara[] IS INITIAL.

EXIT.

ENDIF.

PERFORM build_alv.

FORM top_of_page.

DATA DATE LIKE SY-DATUM.

DATE = SY-DATUM.

wa_header-typ = 'H'.

wa_header-info = 'Displaying selected materials details'."text-001.

APPEND wa_header TO header.

CLEAR wa_header.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = header

  • I_LOGO = 'ENJOYSAP_LOGO'

  • I_END_OF_LIST_GRID =

.

*refresh header.

ENDFORM. "top_of_page

FORM select_data .

SELECT * FROM mara INTO CORRESPONDING FIELDS OF TABLE it_mara WHERE matnr IN s_matnr.

ENDFORM. " select_data

FORM build_alv .

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

  • EXPORTING

  • I_LIST_TYPE = 0

IMPORTING

et_events = xt_events

  • EXCEPTIONS

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

READ TABLE xt_events INTO ls_events

WITH KEY name = slis_ev_top_of_page.

IF sy-subrc EQ 0.

ls_events-form = slis_ev_top_of_page.

MODIFY xt_events FROM ls_events

TRANSPORTING form WHERE name = slis_ev_top_of_page.

ENDIF.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = 'ZIALVD01'

i_callback_top_of_page = 'TOP-OF-PAGE'

i_structure_name = 'MARA'

i_grid_title = 'MATERIAL LIST DISPLAY'

is_layout = fld_lay

it_fieldcat = fld_cat

  • it_events = xt_events[]

TABLES

t_outtab = it_mara

EXCEPTIONS

program_error = 1

OTHERS = 2

.

IF sy-subrc <> 0.

EXIT.

ENDIF.

ENDFORM. " build_alv

Former Member
0 Kudos

Hi,

Got where the problem is

  • it_events = xt_events[] <b>remove the comment</b> otherwise the event wont get triggered.

Alos check once

i_callback_program = 'ZIALVD01' is the name of ur program.

I checked ur program its working fine.

Hope this solves ur problem, if so please reward and close the thread.

Thanks & Reagrds,

Judith.

Former Member
0 Kudos

Hi Judith,

I tried the given solutions but as suggested by Jayanti, the problem may be with GUI. Just tell me whether you can see the text in top of page?

Thanks for your help.

Regards,

Dilip

Former Member
0 Kudos

Ya that is what i also mentioned in my previous reply ask them to reinstall and check or u can run this program in some other system and check.

In my system too i have this problem, I tried in other system and found that to be working fine.

I can see the text

<b>Displaying selected materials details</b> in the top of page in big font size.

Please close this thread if ur problem got solved.

Answers (4)

Answers (4)

Former Member
0 Kudos

hi,

Just follow the simple steps which areexplained witht he code.

1. define your header data

DATA: gs_line TYPE slis_listheader,

i_header TYPE slis_t_listheader.

CLEAR: gs_line.

gs_line-typ = 'H'.

gs_line-info = text-009.

APPEND gs_line TO i_header.

CLEAR: gs_line.

gs_line-typ = 'S'.

gs_line-key = 'Month'.

gs_line-info = p_month.

APPEND gs_line TO i_header.

2. Define the events for the top-of-page

DATA: line_event TYPE slis_alv_event,

i_events TYPE slis_t_event.

CLEAR line_event.

line_event-name = 'TOP_OF_PAGE'.

line_event-form = 'F4200_TOP_OF_PAGE'.

APPEND line_event TO i_events.

3. defien the form as specified in the above event defintion.

FORM f4200_top_of_page.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

i_logo = 'ENJOYSAP_LOG'

it_list_commentary = i_header.

ENDFORM.

4. call your ALV FM with the events details.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = ws_c_repid

i_grid_title = ws_title

is_layout = i_layout

it_fieldcat = i_fieldcat

i_default = 'X'

i_save = 'A'

  • I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

  • IS_VARIANT =

it_events = i_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

  • IT_ALV_GRAPHICS =

  • IT_ADD_FIELDCAT =

  • IT_HYPERLINK =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IT_EXCEPT_QINFO =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = i_final_out

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.

Regards,

Jagath.

Former Member
0 Kudos

Hi,

First please check whether u have given the event/form name inside the quotes in CAPITAL. This may also be a problem.

Regs,

Venkat Ramanan

jayanthi_jayaraman
Active Contributor
0 Kudos
Former Member
0 Kudos

Hi,

Please have a look at the program 'BALVST03_GRID' (or any program starting with 'BALV*'for that matter)to understand how TOP_OF_PAGE has been called,

Hope this helps.

Rgds,