Sunday, December 19, 2010
We use HTML_TOP_OF_PAGE event to display TOP OF PAGE for ALV GRID Display.

REPORT  ztest_notepad.
DATA: gt_sflight TYPE TABLE OF sflight.
DATA: g_repid    LIKE sy-repid.
DATA: r_dd_table TYPE REF TO cl_dd_table_area.
"START-OF-SELECTION

START-OF-SELECTION.
  SELECT * FROM sflight INTO TABLE gt_sflight UP TO 10 ROWS.
  g_repid = sy-repid.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program          = g_repid
      i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
      i_structure_name            = 'SFLIGHT'
    TABLES
      t_outtab                    = gt_sflight.
*&---------------------------------------------------------------------*
*&      Form  html_top_of_page
*&---------------------------------------------------------------------*
FORM html_top_of_page USING document TYPE REF TO cl_dd_document.
  "add heading
  CALL METHOD document->add_text
    EXPORTING
      text      = 'Header information'
      sap_style = cl_dd_area=>heading.
  "underline and new line
  CALL METHOD document->underline.
  CALL METHOD document->new_line.
  "add quick table with two columns
  CALL METHOD document->add_table
    EXPORTING
      no_of_columns = 2
      border        = '0'
      width         = '40%'  "you can set any width of top area in %
    IMPORTING
      tablearea     = r_dd_table.
  "first row
  CALL METHOD r_dd_table->new_row.
  "fill columns in first row
  CALL METHOD r_dd_table->add_text
    EXPORTING
      text      = 'First column first row'
      sap_color = cl_dd_area=>list_key_int.
  CALL METHOD r_dd_table->add_text
    EXPORTING
      text      = 'Second column first row'
      sap_color = cl_dd_area=>list_key.
  "add first row
  CALL METHOD r_dd_table->new_row.
  "fill columns in second row
  CALL METHOD r_dd_table->add_text
    EXPORTING
      text      = 'First column second row'
      sap_color = cl_dd_area=>list_key_int.

  CALL METHOD r_dd_table->add_text
    EXPORTING
      text      = 'Second column second row'
      sap_color = cl_dd_area=>list_key.
  "request for second row
  CALL METHOD r_dd_table->new_row.

ENDFORM.                    "html_top_of_page

1 comment:

  1. how can we get the header information also printed on page?

    ReplyDelete

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.