How to output the title header in ALV

Source: Internet
Author: User
Tags call back

1. Declare Variables
Data: gt_list_top_of_page type slis_t_listheader.
Data: gt_events type slis_t_event.

2. Define a form for ALV to call back
*---------------------------------------------------------------------*
* Form top_of_page *
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
Form top_of_page.

Call function 'reuse _ alv_commentary_write'
Exporting
* I _logo = 'htmlcntl _ testhtm2_saplogo'
I _logo = 'enjoysap _ logo'
It_list_commentary = gt_list_top_of_page.
Endform.

3. Define the internal table form for entering the output content in the ALV Header
Form e04_comment_build using e04_lt_top_of_page type slis_t_listheader.
Data: ls_line type slis_listheader.
*
* Listen überschrift: typ H
Clear ls_line.
LS_LINE-TYP = 'H'. "displayed in black, large
* LS_LINE-KEY: not used for this type
LS_LINE-INFO = text-100.
Append ls_line to e04_lt_top_of_page.
* Kopfinfo: typ s
Clear ls_line.
LS_LINE-TYP ='s '. "displayed as standard font size
LS_LINE-KEY = text-101. "displayed as standard font size, but in black
LS_LINE-INFO = text-102. "displayed as standard font size
Append ls_line to e04_lt_top_of_page.
LS_LINE-KEY = text-103.
LS_LINE-INFO = text-104.
Append ls_line to e04_lt_top_of_page.
* Aktionsinfo: typ
Clear ls_line.
LS_LINE-TYP = 'A'. "displayed in Italic
* LS_LINE-KEY: not used for this type
LS_LINE-INFO = text-105.
Append ls_line to e04_lt_top_of_page.
Endform.

4. Create an ALV event table form. Replace the slis_ev_top_of_page event handler function name of the table in the ALV event with the custom form.
Form e03_eventtab_build using e03_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 = e03_lt_events.
Read Table e03_lt_events with key name = slis_ev_top_of_page
Into ls_event.
If SY-SUBRC = 0.
Move 'top _ of_page 'to LS_EVENT-FORM.
Append ls_event to e03_lt_events.
Endif.
Endform.

5. Call Functions
Perform e03_eventtab_build using gt_events [].
Perform e04_comment_build using gt_list_top_of_page [].
Call function 'reuse _ alv_grid_display'
Exporting
I _callback_program = sy-repid
It_fieldcat = gt_fieldcat []
It_sort = gt_sort []
It_events = gt_events []
Tables
T_outtab = gt_sflight.
Related: http://blog.csdn.net/compassbutton/archive/2007/01/31/1499218.aspx
Http://blog.csdn.net/CompassButton/archive/2006/12/01/1424228.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.