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

Former Member
0 Kudos

Hi,

In my coding i displayed heading in top of pag in ALV report, but it's not display in ALV report, when i come back from ALV report it's display please any one correct my code

REPORT ZE0232_ALV_TOP1 .

TYPE-POOLS: SLIS.

TABLES: EKPO.

DATA: REPID LIKE SY-REPID.

DATA: IT_EVENTS TYPE SLIS_T_EVENT,

IT_PAGE TYPE SLIS_T_LISTHEADER,

WA_EVENTS TYPE SLIS_ALV_EVENT,

WA_PAGE TYPE SLIS_LISTHEADER.

PERFORM BUILD_EVENTS.

PERFORM BUILD_PAGE_HEADER.

DATA: I_EKPO LIKE EKPO OCCURS 0 WITH HEADER LINE.

SELECT * FROM EKPO INTO CORRESPONDING FIELDS OF TABLE I_EKPO.

call function 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

I_STRUCTURE_NAME = 'EKPO'

  • I_BACKGROUND_ID = ' '

I_GRID_TITLE = 'PURCHASING DETAILS'

  • I_GRID_SETTINGS =

  • 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

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

tables

t_outtab = I_EKPO.

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

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = IT_PAGE

  • I_LOGO =

  • I_END_OF_LIST_GRID =

.

&----


*& Form BUILD_EVENTS

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form BUILD_EVENTS .

call function 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = IT_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 IT_EVENTS WITH KEY NAME = slis_ev_top_of_page INTO WA_EVENTS.

IF SY-SUBRC = 0.

MOVE: SLIS_EV_TOP_OF_PAGE TO WA_EVENTS-FORM.

APPEND WA_EVENTS TO IT_EVENTS.

ENDIF.

endform. " BUILD_EVENTS

&----


*& Form BUILD_PAGE_HEADER

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form BUILD_PAGE_HEADER .

WA_page-typ = 'H'.

WA_page-info = 'Header 1'.

APPEND WA_page TO IT_page.

endform. " BUILD_PAGE_HEADER

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

don't call the FM 'REUSE_ALV_COMMENTARY_WRITE' after the call to the grid. Instead, declare a form like 'f_top_of page' that call the reuse_alv_commentary_write.

Then, you should call the grid with your form, like :

call function 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = REPID

I_CALLBACK_TOP_OF_PAGE = 'F_TOP_OF_PAGE'

I_STRUCTURE_NAME = 'EKPO'

I_GRID_TITLE = 'PURCHASING DETAILS'

tables

t_outtab = I_EKPO.

Regards,

NH

2 REPLIES 2

Former Member
0 Kudos

Hi,

don't call the FM 'REUSE_ALV_COMMENTARY_WRITE' after the call to the grid. Instead, declare a form like 'f_top_of page' that call the reuse_alv_commentary_write.

Then, you should call the grid with your form, like :

call function 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = REPID

I_CALLBACK_TOP_OF_PAGE = 'F_TOP_OF_PAGE'

I_STRUCTURE_NAME = 'EKPO'

I_GRID_TITLE = 'PURCHASING DETAILS'

tables

t_outtab = I_EKPO.

Regards,

NH

Former Member
0 Kudos

Hi Uday,

You need to use TOP-OF-PAGE Event in ALV as below

*display report

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

i_callback_top_of_page = 'TOP-OF-PAGE'

it_fieldcat = git_fieldcatalog[]

it_sort = it_sortcat

i_save = c_save

TABLES

t_outtab = data_tab

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. " IF sy-subrc <> 0.

&----


*& Form top-of-page

&----


  • text

----


FORM top-of-page. "#EC CALLED

*ALV Header declarations

DATA: t_header TYPE slis_t_listheader,

wa_header TYPE slis_listheader.

  • Title

wa_header-typ = 'H'.

wa_header-info = text-h01.

APPEND wa_header TO t_header.

CLEAR wa_header.

  • Date

wa_header-typ = gc_s.

wa_header-key = text-h02.

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.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = t_header.

ENDFORM. "top-of-page

<b>Reward Points if this helps,</b>

Satish