Skip to Content
0
Former Member
Nov 12, 2007 at 02:56 PM

ALV report Printing.

12 Views

Hi Guys,

I have an ALV grid display which I need to print.

Following is the function module I have used>>

  IF g_t_final_report[] IS NOT INITIAL.

    SORT g_t_final_report BY vbeln.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program          = sy-repid
        i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
        it_fieldcat                 = g_t_fieldcat[]
      TABLES
        t_outtab                    = g_t_final_report[]
      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.
  ELSE.
    MESSAGE i999(zz) WITH text-029.     "NO RECORDS FETCHED
  ENDIF.


  DATA: text TYPE sdydo_text_element.

  CALL METHOD document->add_gap
    EXPORTING
      width = 500.
  text =  text-021.

  CALL METHOD document->add_text
    EXPORTING
      text      = text
      sap_style = text-022.

  CALL METHOD document->new_line.
  CALL METHOD document->new_line.

  text = text-023.
  CALL METHOD document->add_text
    EXPORTING
      text         = text
      sap_emphasis = text-022.

  CALL METHOD document->add_gap
    EXPORTING
      width = 6.

  text = s_period-low.
  CALL METHOD document->add_text
    EXPORTING
      text      = text
      sap_style = text-024.

  CALL METHOD document->add_gap
    EXPORTING
      width = 20.

  text = text-025.
  CALL METHOD document->add_text
    EXPORTING
      text         = text
      sap_emphasis = text-022.

  CALL METHOD document->add_gap
    EXPORTING
      width = 6.

  text = s_period-high.
  CALL METHOD document->add_text
    EXPORTING
      text      = text
      sap_style = text-024.

  CALL METHOD document->new_line.


  CLEAR G_T_FIELDCAT.
  G_T_FIELDCAT-COL_POS   = '1'.
  G_T_FIELDCAT-TABNAME   = 'G_T_FINAL_REPORT'.
  G_T_FIELDCAT-FIELDNAME = 'SUPER_CAI'.
  G_T_FIELDCAT-SELTEXT_M = TEXT-002.
  APPEND G_T_FIELDCAT.

Please let me know <b>How I can print the header in the print command</b>.

Regards,

Shashank.