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: 

How to make top of page in alv to be printed.

Former Member
0 Kudos
170

hello expert:

i used following function to output alv.

but after been printed into spool, i cannot find the top of page.

how to set the print parameter to print the top of ALV.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = w_repid

i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'

is_layout = wa_layout

it_fieldcat = it_fieldcat

TABLES

t_outtab = it_comp

EXCEPTIONS

program_error = 1

OTHERS = 2.

thank you and best regards,

Kevin Gao

10 REPLIES 10

Former Member
0 Kudos
115

hi,

Go throgh below link

http://www.sapfans.com/forums/viewtopic.php?t=16629

Rewards points if help full

Regards

Suresh.D

Former Member
0 Kudos
115

hi

from the documentation:

If function module REUSE_ALV_COMMENTARY_WRITE is not used in the form for I_CALLBACK_TOP_OF_PAGE, the form routine must be passed in parameter I_CALLBACK_HTML_TOP_OF_PAGE for the online mode. The form should then have the following format:

form top_of_page using cl_dd type ref to cl_dd_document.

In the form, you can, for example, use methods of class CL_DD_DOCUMENT to display text in HTML format.

have u done this? or are you trying to print the top_of-page using REUSE_ALV_EVENTS_GET & REUSE_ALV_COMMENTARY_WRITE?

if helpful, reward

Sathish. R

0 Kudos
115

i only REUSE_ALV_GRID_DISPLAY..

the problem still is not solved. please give me much more advice

thank u very much

0 Kudos
115

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

i_bypassing_buffer = 'X'

  • I_BUFFER_ACTIVE = ' '

i_callback_program = sy-repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = 'HTML_TOP_OF_PAGE'

I_CALLBACK_HTML_TOP_OF_PAGE = 'HTML_TOP_OF_PAGE'

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • i_structure_name = <DYN_WA>

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

is_layout = gds_layout

it_fieldcat = gdt_field_cata

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • it_sort = gdt_sortinfo

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

i_save = 'X'

is_variant = gt_var

it_events = gdt_eventcat

  • IT_EVENT_EXIT =

IS_PRINT = gds_print

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = <dyn_table>

EXCEPTIONS

program_error = 1

OTHERS = 2 .

&----


*& Form html_top_of_page

&----


FORM html_top_of_page USING document TYPE REF TO cl_dd_document.

DATA: text TYPE sdydo_text_element.

CALL METHOD document->add_gap

EXPORTING

width = 100.

text = 'Company Code Data'.

CALL METHOD document->add_text

EXPORTING

text = text

sap_style = 'HEADING'.

CALL METHOD document->new_line.

CALL METHOD document->new_line.

CALL METHOD document->new_line.

text = 'User Name : '.

CALL METHOD document->add_text

EXPORTING

text = text

sap_emphasis = 'Strong'.

CALL METHOD document->add_gap

EXPORTING

width = 6.

text = sy-uname.

CALL METHOD document->add_text

EXPORTING

text = text

sap_style = 'Key'.

CALL METHOD document->add_gap

EXPORTING

width = 50.

text = 'Date : '.

CALL METHOD document->add_text

EXPORTING

text = text

sap_emphasis = 'Strong'.

CALL METHOD document->add_gap

EXPORTING

width = 6.

text = sy-datum.

CALL METHOD document->add_text

EXPORTING

text = text

sap_style = 'Key'.

CALL METHOD document->add_gap

EXPORTING

width = 50.

text = 'Time : '.

CALL METHOD document->add_text

EXPORTING

text = text

sap_emphasis = 'Strong'.

CALL METHOD document->add_gap

EXPORTING

width = 6.

text = sy-uzeit.

CALL METHOD document->add_text

EXPORTING

text = text

sap_style = 'Key'.

CALL METHOD document->new_line.

CALL METHOD document->new_line.

ENDFORM. "HTML_TOP_OF_PAGE

0 Kudos
115

hi Sathish

i did it. it works .but my quesiton is that top of page can not be output in spool

could u give much more advice.

thanks

Kevin

0 Kudos
115

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = SY-REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_STRUCTURE_NAME =

  • IS_LAYOUT =

IT_FIELDCAT = T_FIELDCAT

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = T_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

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = T_OPEN_DEL

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

IF SY-SUBRC NE 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF. " IF SY-SUBRC NE 0.

ENDIF. " IF T_OPEN_DEL IS NOT INITIAL.

----


  • Form ADD_EVENTS

----


  • This subroutine to append events to ALV

----


  • No Parameter interface

----


FORM ADD_EVENTS.

CLEAR FS_EVENTS.

FS_EVENTS-NAME = C_TOP_OF_PAGE.

FS_EVENTS-FORM = C_TOP_OF_PAGE.

APPEND FS_EVENTS TO T_EVENTS.

CLEAR FS_EVENTS.

FS_EVENTS-NAME = C_BEFORE_LINE_OUTPUT.

FS_EVENTS-FORM = C_BEFORE_LINE_OUTPUT.

APPEND FS_EVENTS TO T_EVENTS.

CLEAR FS_EVENTS.

FS_EVENTS-NAME = C_END_OF_LIST.

FS_EVENTS-FORM = C_END_OF_LIST.

APPEND FS_EVENTS TO T_EVENTS.

ENDFORM. " ADD_EVENTS

Append events to T_EVENTS, then call the event table in the function module,

you will get top-of-page.

Regards,

Pavan P.

Former Member
0 Kudos
115

hi

please refer to my code


CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      i_list_type     = 0
    IMPORTING
      et_events       = it_event
    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 contents of table it_event into work area

  READ TABLE it_event WITH KEY name = slis_ev_top_of_page
  INTO wa_event.

  IF sy-subrc EQ 0.
    MOVE 'ALV_TOP_OF_PAGE' TO wa_event-form.
    MODIFY it_event FROM wa_event INDEX sy-tabix.
  ENDIF.



FORM alv_top_of_page.
  DATA:h_header TYPE slis_t_listheader,
        wa_header TYPE slis_listheader.

* building the header of the list

  wa_header-typ = 'H'.
  CONCATENATE 'Purchase'
              'Requisition'
  INTO wa_header-info SEPARATED BY space.
  APPEND wa_header TO h_header.
  CLEAR wa_header.

  wa_header-typ = 'S'.
  wa_header-key = 'Name:'.
  wa_header-info = TATA INFOTECH LIMITED'.
  APPEND wa_header TO h_header.
  CLEAR wa_header.


  wa_header-typ = 'S'.
  wa_header-key = 'Address:'.
  wa_header-info = 'IT PARK MUMBAI'.
  APPEND wa_header TO h_header.
  CLEAR wa_header.


  wa_header-typ = 'S'.
  wa_header-key = 'DATE:'.
  CONCATENATE sy-datum+6(2)'-'
              sy-datum+4(2)'-'
              sy-datum(4)
  INTO wa_header-info.
  APPEND wa_header TO h_header.
  CLEAR wa_header.

  wa_header-typ = 'S'.
  wa_header-key = 'TIME:'.
  CONCATENATE  sy-uzeit(2)':'
               sy-uzeit+2(2)':'
               sy-uzeit+4(2)
  INTO wa_header-info.
  APPEND wa_header TO h_header.
  CLEAR wa_header.

  wa_header-typ = 'S'.
  wa_header-key = 'Material Number:'.
  wa_header-info = p_matnr.
  APPEND wa_header TO h_header.
  CLEAR wa_header.



  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary = h_header
      i_logo             = 'INFOTECH'.

ENDFORM.                    "ALV_TOP_OF_PAGE

pass this it_events table to the ALV_GRID_DISPLAY FUNTION MODULE

regards

ravish

<b>plz reward if useful</b>

0 Kudos
115

actually.. the code is okey..

but i wanna dispy text at fixed position in the top of page.

So i use the ' FORM html_top_of_page USING document TYPE REF TO cl_dd_document.'

but i can not be printed into spool

thank u

i met the same problem as

Message was edited by:

Kevin Gao

please do me a favor about this issue

Message was edited by:

Kevin Gao

0 Kudos
115

have any solution provided??

help!!!

0 Kudos
115

hi kevin,

I tried to loop the top of page data into ainternal table and then performed a write just before the alv list dispaly.But it creates two different spools one with the alv list and the other with the top of page data.

even i m facing a similar problem..

if u get any answer plz post it on this forum.

Regards,

NIky.