<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Variable header in ALV in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/variable-header-in-alv/m-p/935839#M61928</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I want to print variable text in the top-of-page in the ALV.&lt;/P&gt;&lt;P&gt;Suppose, I am making customer wise sales report.&lt;/P&gt;&lt;P&gt;A new page is triggered when customer changes. I have done this.&lt;/P&gt;&lt;P&gt;I want to print customer name and code in the top of page  whenever the customer changes. I have done coding for this like I have made list header which changes when the customer changes.It is working well when the user sees the report output on the screen but when he prints it , the headers are not printed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please give me the solution of this problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thnaks and Regards&lt;/P&gt;&lt;P&gt;Gurpreet Singh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Sep 2005 09:20:34 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-09-29T09:20:34Z</dc:date>
    <item>
      <title>Variable header in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/variable-header-in-alv/m-p/935839#M61928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I want to print variable text in the top-of-page in the ALV.&lt;/P&gt;&lt;P&gt;Suppose, I am making customer wise sales report.&lt;/P&gt;&lt;P&gt;A new page is triggered when customer changes. I have done this.&lt;/P&gt;&lt;P&gt;I want to print customer name and code in the top of page  whenever the customer changes. I have done coding for this like I have made list header which changes when the customer changes.It is working well when the user sees the report output on the screen but when he prints it , the headers are not printed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please give me the solution of this problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thnaks and Regards&lt;/P&gt;&lt;P&gt;Gurpreet Singh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2005 09:20:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/variable-header-in-alv/m-p/935839#M61928</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-29T09:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: Variable header in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/variable-header-in-alv/m-p/935840#M61929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the alv events add TOP-OF-PAGE and one rountine name like top_of_page&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the routine add the below code like &lt;/P&gt;&lt;P&gt; CLEAR WA_COMMENT.&lt;/P&gt;&lt;P&gt;  WA_COMMENT-TYP = C_S.&lt;/P&gt;&lt;P&gt;  WA_COMMENT-KEY = text-035.&lt;/P&gt;&lt;P&gt;  APPEND WA_COMMENT TO ALV_COMMENT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;            IT_LIST_COMMENTARY = ALV_COMMENT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is this helpful for your problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;sasi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2005 09:35:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/variable-header-in-alv/m-p/935840#M61929</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-29T09:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: Variable header in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/variable-header-in-alv/m-p/935841#M61930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check that whether u &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;b&amp;gt;handle_print_top_of_page&amp;lt;/b&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Or else it wont work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample for TOP-OF-PAGE and PRINT-TOP-OF-PAGE&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

***********************************************************************

* Class definition :
***********************************************************************

*---------------------------------------------------------------------*
*       CLASS v_lcl_event_receiver DEFINITION
*---------------------------------------------------------------------*
CLASS v_lcl_event_receiver DEFINITION.

  PUBLIC SECTION.

    METHODS:

    handle_print_top_of_page FOR EVENT print_top_of_page OF
                                       cl_gui_alv_grid,

    handle_top_of_page FOR EVENT top_of_page OF
                                 cl_gui_alv_grid.

ENDCLASS.
*---------------------------------------------------------------------*
*       CLASS V_LCL_EVENT_RECEIVER IMPLEMENTATION
*---------------------------------------------------------------------*
CLASS v_lcl_event_receiver IMPLEMENTATION.

  METHOD handle_print_top_of_page.
    IF sy-pagno = 1.
        PERFORM top_of_page.
    ENDIF.
  ENDMETHOD.
  METHOD handle_top_of_page.
      PERFORM top_of_page.
  ENDMETHOD.

ENDCLASS.

DATA:        v_event_receiver      TYPE REF TO v_lcl_event_receiver.

FORM top_of_page.
  WRITE: text-020,
           / 

ENDFORM.                    " top_of_page

&amp;lt;u&amp;gt;In PBo of the screen&amp;lt;/u&amp;gt;
   DATA: v_split            TYPE REF TO cl_gui_easy_splitter_container,
         v_contnr_top       TYPE REF TO cl_gui_container,
         v_contnr_bot       TYPE REF TO cl_gui_container,
         v_grid_02          TYPE REF TO cl_gui_alv_grid,
         v_html             TYPE REF TO cl_dd_document,
         v_text20(255)      TYPE c,
         v_text16(255)      TYPE c,

FORM f9000_objects_create.
  IF cl_gui_alv_grid=&amp;gt;offline( ) IS INITIAL.
Create a container
    CREATE OBJECT o_dockingcontainer
      EXPORTING
        ratio                       = '95'
      EXCEPTIONS
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5
        others                      = 6.
    IF sy-subrc NE 0.
      MESSAGE i000 WITH text-e01."Error in creating Docking container
      LEAVE LIST-PROCESSING.
    ENDIF.

    CREATE OBJECT v_split
         EXPORTING
           parent            = o_dockingcontainer
*          ORIENTATION       = 0
           sash_position     = 25
           with_border       = 0
         EXCEPTIONS
           cntl_error        = 1
           cntl_system_error = 2
           others            = 3.
    IF sy-subrc NE 0.
      MESSAGE i000 WITH text-e01."Error in creating Docking container
      LEAVE LIST-PROCESSING.
    ENDIF.
*   Get the containers of the splitter control
    v_contnr_top = v_split-&amp;gt;top_left_container.
    v_contnr_bot = v_split-&amp;gt;bottom_right_container.

    CREATE OBJECT o_alvgrid
   EXPORTING
     i_parent = o_dockingcontainer.

*   Create an instance of alv control
    CREATE OBJECT o_alvgrid
         EXPORTING i_parent = v_contnr_bot.

*   Object for display of selection parameters in HTML top container
    CREATE OBJECT v_html
         EXPORTING
           style = 'ALV_GRID'.


*   Must be after the SET HANDLER for TOP_OF_PAGE and foreground only
    CALL METHOD o_alvgrid-&amp;gt;list_processing_events
                     EXPORTING i_event_name = 'TOP_OF_PAGE'
                               i_dyndoc_id  = v_html.

    v_text20 = text-020(summary Record counts)Any text.

    CALL METHOD v_html-&amp;gt;add_gap
                EXPORTING
                  width         = 120.
    CALL METHOD v_html-&amp;gt;add_text
           EXPORTING
             text          = v_text20.
    CALL METHOD v_html-&amp;gt;new_line.
** Display Text-016
    v_text16 = text-016.

    CALL METHOD v_html-&amp;gt;add_gap
                EXPORTING
                  width         = 1.
    CALL METHOD v_html-&amp;gt;add_text
           EXPORTING
             text          = v_text16.

    v_text16 = v_sap_recon.
    CALL METHOD v_html-&amp;gt;add_gap
                EXPORTING
                  width         = 1.
    CALL METHOD v_html-&amp;gt;add_text
           EXPORTING
             text          = v_text16.
    CALL METHOD v_html-&amp;gt;new_line.

&amp;lt;b&amp;gt;* Display the data
   CALL METHOD v_html-&amp;gt;display_document
      EXPORTING
         parent             = v_contnr_top.

*   Handle the event
   CALL METHOD o_alvgrid-&amp;gt;list_processing_events
                        EXPORTING i_event_name = 'PRINT_TOP_OF_PAGE'.&amp;lt;/b&amp;gt; 
IN PBO while populating in the output table
FORM f9004_display_data TABLES   p_report_tab
                                 p_fieldcat.
  CALL METHOD o_alvgrid-&amp;gt;set_table_for_first_display
    EXPORTING
       is_variant                    = w_variant
       i_save                        = c_a
       is_layout                     = w_layout
    CHANGING
       it_outtab                     = p_report_tab[]
       it_fieldcatalog               = p_fieldcat[]
    EXCEPTIONS
       invalid_parameter_combination = 1
       program_error                 = 2
       too_many_lines                = 3
       OTHERS                        = 4.

  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE i000 WITH text-e06."Error in ALV report display
    LEAVE LIST-PROCESSING.
  ENDIF.

* Create object
  IF v_event_receiver IS INITIAL.
    CREATE OBJECT v_event_receiver.
  ENDIF.

  SET HANDLER v_event_receiver-&amp;gt;handle_print_top_of_page FOR o_alvgrid.
&amp;lt;b&amp;gt;  SET HANDLER v_event_receiver-&amp;gt;handle_top_of_page FOR o_alvgrid&amp;lt;/b&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps u.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2005 10:02:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/variable-header-in-alv/m-p/935841#M61930</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-29T10:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Variable header in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/variable-header-in-alv/m-p/935842#M61931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chek out this code snippet:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS v_lcl_event_receiver DEFINITION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS v_lcl_event_receiver DEFINITION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;    handle_print_top_of_page FOR EVENT print_top_of_page OF&lt;/P&gt;&lt;P&gt;                                       cl_gui_alv_grid,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    handle_top_of_page FOR EVENT top_of_page OF&lt;/P&gt;&lt;P&gt;                                 cl_gui_alv_grid.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS V_LCL_EVENT_RECEIVER IMPLEMENTATION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS v_lcl_event_receiver IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;  METHOD handle_print_top_of_page.&lt;/P&gt;&lt;P&gt;    IF sy-pagno = 1.&lt;/P&gt;&lt;P&gt;        PERFORM top_of_page.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;  METHOD handle_top_of_page.&lt;/P&gt;&lt;P&gt;      PERFORM top_of_page.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:    v_event_receiver      TYPE REF TO v_lcl_event_receiver.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the main Program:&lt;/P&gt;&lt;P&gt;TOP-OF-PAGE.&lt;/P&gt;&lt;P&gt;  PERFORM TOP_OF_PAGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Form:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  top_of_page&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Top of Page&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM TOP_OF_PAGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PERFORM SELECTION_PAGE_PRINT.&lt;/P&gt;&lt;P&gt;  WRITE:/5(20) V_REPNAME,&lt;/P&gt;&lt;P&gt;        23(25) SY-REPID,&lt;/P&gt;&lt;P&gt;        70     TEXT-011,&lt;/P&gt;&lt;P&gt;        96     V_BR1    ,&lt;/P&gt;&lt;P&gt;        98    XUDATE-LOW.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  WRITE: 150(9) 'Page No.:', SY-PAGNO.             "   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " top_of_page&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*AD:19.08.05(END)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  selection_page_print&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      print data from selection screen&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM SELECTION_PAGE_PRINT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  WRITE:/5 TEXT-100.      "Selection Screen Values&lt;/P&gt;&lt;P&gt;  SKIP.&lt;/P&gt;&lt;P&gt;  WRITE:/5 'Customer name:', p_CUST.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " selection_page_print&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-BATCH NE 'X'.&lt;/P&gt;&lt;P&gt;    CREATE OBJECT V_EVENT_RECEIVER.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;SET HANDLER V_EVENT_RECEIVER-&amp;gt;HANDLE_PRINT_TOP_OF_PAGE FOR O_ALVGRID.&lt;/P&gt;&lt;P&gt;   SET HANDLER V_EVENT_RECEIVER-&amp;gt;HANDLE_TOP_OF_PAGE FOR O_ALVGRID.&amp;lt;/b&amp;gt;  &lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Anjali&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2005 10:21:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/variable-header-in-alv/m-p/935842#M61931</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-29T10:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: Variable header in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/variable-header-in-alv/m-p/935843#M61932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;I am using type-pool : slis to make ALV.&lt;/P&gt;&lt;P&gt;Please respond according to that. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards &lt;/P&gt;&lt;P&gt;Gurpreet Singh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2005 11:35:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/variable-header-in-alv/m-p/935843#M61932</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-29T11:35:04Z</dc:date>
    </item>
  </channel>
</rss>

