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: 

HTML TOP header is not shown in mail

former_member184029
Participant
0 Kudos

Hi

I've an ALV for sending a list thru mail correctly, but when user open it HTML top header is not shown

FM

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program          = sy-repid
      i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
      i_structure_name            = 'ZMMALV_01'
      it_sort                     = gt_sortinfo
    TABLES
      t_outtab                    = it_data01.

FORM html_top_of_page

text = 'Time : '.
  CALL METHOD top->add_text
    EXPORTING
      text         = text
      sap_emphasis = 'Strong'.

  CALL METHOD top->add_gap
    EXPORTING
      width = 6.

  text = sy-uzeit.
  CALL METHOD top->add_text
    EXPORTING
      text      = text
      sap_style = 'Key'.

  CALL METHOD top->new_line.

Thanks in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Use the concept of Events.

I am giving you one of my requirement to show date and title on the ALV report.

Here it is:

Add this event in your report.

*--- Add events for the List
  wa_event-name = 'TOP_OF_PAGE'.
  wa_event-form = 'TOP_OF_PAGE'.
  APPEND wa_event TO it_event.

call function 'REUSE_ALV_GRID_DISPLAY'
  exporting
    i_callback_program       = sy-repid
    is_layout                = it_layout
    it_fieldcat              = it_fieldcat
    i_default                = 'X'
    i_save                   = 'A'
    it_events                = it_event
  tables
    t_outtab                 = it_outtab
  exceptions
    program_error            = 1
    others                   = 2.

After that use the 'TOP_OF_PAGE' event.

But make sure use the name of event as it is, otherwise it will give error to you.

*&---------------------------------------------------------------------*
*&      Form TOP_OF_PAGE
*&---------------------------------------------------------------------*
*     Top of page for ALV
*----------------------------------------------------------------------*
 
FORM top_of_page.
  REFRESH it_header.
  CLEAR wa_header.
  DATA: lfl_date(10) TYPE c,
        lfl_title TYPE lvc_title VALUE 'PROJECT STATUS REPORT'.
 
* Title
  wa_header-typ  = 'H'.
  wa_header-info = lfl_title.
  APPEND wa_header TO it_header.
  CLEAR wa_header.
 
*mask date to dd-mm-yy format.
  WRITE sy-datum TO lfl_date USING EDIT MASK
                      '__-__-_____'.
  CONCATENATE 'RUN DATE :' lfl_date INTO wa_header-info.
  wa_header-typ  = 'H'.
  APPEND wa_header TO it_header.
 
*FM to display TOP_OF_PAGE
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary = it_header.
 
  CLEAR wa_header.
ENDFORM.                    "top_of_page

May it helps you.

Regards.

DS.

4 REPLIES 4

Former Member
0 Kudos

Hi Tokio Franco,

HTML TOP header wont be printed even if you use Print / Print Preview.

I think we cannot use HTML TOP header for both Email and Printing Purpose. Its only for Display as of now.

CHeck for other options.

former_member156446
Active Contributor
0 Kudos

HTML top of page does not work for that purpose

use :
reuse FM>>>>>>
 i_callback_top_of_page  = 'TOP_OF_PAGE'

*&---------------------------------------------------------------------*
*&    TOP_OF_PAGE
*&---------------------------------------------------------------------*
FORM top_of_page.

  DATA: i_listheader  TYPE slis_t_listheader,
        wa_listheader LIKE LINE OF i_listheader.
  DATA: lv_date TYPE string, lv_time TYPE string,
        lv_butxt TYPE t001-butxt,
        lv_ort01 TYPE t001-ort01,
        lv_land1 TYPE t001-land1.

  CLEAR wa_listheader.
  wa_listheader-typ = 'H'.
  wa_listheader-info = 'Payment List'.
  APPEND wa_listheader TO i_listheader.
  CLEAR wa_listheader.
  wa_listheader-typ = 'S'.
  WRITE sy-datum TO wa_listheader-info.
  CONCATENATE 'Date:' wa_listheader-info INTO lv_date.
  CLEAR: wa_listheader-info.
  WRITE sy-timlo TO wa_listheader-info.
  CONCATENATE 'Time:' wa_listheader-info INTO lv_time.
  CLEAR: wa_listheader-info.
  CONCATENATE lv_date lv_time INTO wa_listheader-info
  SEPARATED BY space.
  APPEND wa_listheader TO i_listheader.

  SELECT SINGLE butxt ort01 land1
    FROM t001
    INTO (lv_butxt, lv_ort01, lv_land1)
    WHERE bukrs EQ p_zbukr.
  IF NOT p_zbukr IS INITIAL.
    wa_listheader-typ = 'H'.
    CONCATENATE lv_butxt lv_ort01 lv_land1 INTO wa_listheader-info
    SEPARATED BY space.
    APPEND wa_listheader TO i_listheader.
  ENDIF.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary = i_listheader.

ENDFORM.                                                 "top_of_page

Former Member
0 Kudos

Hi,

Use the concept of Events.

I am giving you one of my requirement to show date and title on the ALV report.

Here it is:

Add this event in your report.

*--- Add events for the List
  wa_event-name = 'TOP_OF_PAGE'.
  wa_event-form = 'TOP_OF_PAGE'.
  APPEND wa_event TO it_event.

call function 'REUSE_ALV_GRID_DISPLAY'
  exporting
    i_callback_program       = sy-repid
    is_layout                = it_layout
    it_fieldcat              = it_fieldcat
    i_default                = 'X'
    i_save                   = 'A'
    it_events                = it_event
  tables
    t_outtab                 = it_outtab
  exceptions
    program_error            = 1
    others                   = 2.

After that use the 'TOP_OF_PAGE' event.

But make sure use the name of event as it is, otherwise it will give error to you.

*&---------------------------------------------------------------------*
*&      Form TOP_OF_PAGE
*&---------------------------------------------------------------------*
*     Top of page for ALV
*----------------------------------------------------------------------*
 
FORM top_of_page.
  REFRESH it_header.
  CLEAR wa_header.
  DATA: lfl_date(10) TYPE c,
        lfl_title TYPE lvc_title VALUE 'PROJECT STATUS REPORT'.
 
* Title
  wa_header-typ  = 'H'.
  wa_header-info = lfl_title.
  APPEND wa_header TO it_header.
  CLEAR wa_header.
 
*mask date to dd-mm-yy format.
  WRITE sy-datum TO lfl_date USING EDIT MASK
                      '__-__-_____'.
  CONCATENATE 'RUN DATE :' lfl_date INTO wa_header-info.
  wa_header-typ  = 'H'.
  APPEND wa_header TO it_header.
 
*FM to display TOP_OF_PAGE
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary = it_header.
 
  CLEAR wa_header.
ENDFORM.                    "top_of_page

May it helps you.

Regards.

DS.

0 Kudos

Thanks to all of you for answers