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: 

TOP_OF_PAGE in ALV Grid Using OO Approach!!

abdul_hakim
Active Contributor
0 Kudos

Hi Friends,

How to handle TOP_OF_PAGE event in ALV Grid Control using OO Approach?Please give me a sample program...

Thanks,

Abdul

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

Hi Abdul,

Check this code....

REPORT  ZTEST1234_ALV_TOP    MESSAGE-ID ZZ                           .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: L_VALID TYPE C,
      V_FLAG,
      V_DATA_CHANGE,
      V_ROW TYPE LVC_S_ROW,
      V_COLUMN TYPE LVC_S_COL,
      V_ROW_NUM TYPE LVC_S_ROID.
"The Below Definitions Must.....
DATA:
* Reference to document
       DG_DYNDOC_ID       TYPE REF TO CL_DD_DOCUMENT,
* Reference to split container
       DG_SPLITTER          TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
* Reference to grid container
       DG_PARENT_GRID     TYPE REF TO CL_GUI_CONTAINER,
* Reference to html container
       DG_HTML_CNTRL        TYPE REF TO CL_GUI_HTML_VIEWER,
* Reference to html container
       DG_PARENT_HTML     TYPE REF TO CL_GUI_CONTAINER.
"up to here
*---------------------------------------------------------------------*
*       CLASS lcl_event_handler DEFINITION
*---------------------------------------------------------------------*
CLASS LCL_EVENT_HANDLER DEFINITION .
  PUBLIC SECTION .
    METHODS:
**Hot spot Handler
    HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                      IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
**Double Click Handler
    HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                                     IMPORTING E_ROW E_COLUMN ES_ROW_NO,

    TOP_OF_PAGE FOR EVENT TOP_OF_PAGE              "event handler
                         OF CL_GUI_ALV_GRID
                         IMPORTING E_DYNDOC_ID.

ENDCLASS.                    "lcl_event_handler DEFINITION
*---------------------------------------------------------------------*
*       CLASS lcl_event_handler IMPLEMENTATION
*---------------------------------------------------------------------*
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*Handle Hotspot Click
  METHOD HANDLE_HOTSPOT_CLICK .
    CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
    V_ROW  = E_ROW_ID.
    V_COLUMN = E_COLUMN_ID.
    V_ROW_NUM = ES_ROW_NO.
    MESSAGE I000 WITH V_ROW 'clicked'.
  ENDMETHOD.                    "lcl_event_handler

*Handle Double Click
  METHOD  HANDLE_DOUBLE_CLICK.

  ENDMETHOD.                    "handle_double_click

  METHOD TOP_OF_PAGE.                   "implementation
* Top-of-page event
    PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
  ENDMETHOD.                            "top_of_page
ENDCLASS.                    "LCL_EVENT_HANDLER IMPLEMENTATION

*&---------------------------------------------------------------------*
*&             Global Definitions
*&---------------------------------------------------------------------*
DATA:      G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
            G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler

DATA: OK_CODE LIKE SY-UCOMM,
      SAVE_OK LIKE SY-UCOMM,
      G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
      GS_LAYOUT TYPE LVC_S_LAYO.


*- Fieldcatalog for First and second Report
DATA: IT_FIELDCAT  TYPE  LVC_T_FCAT,
      X_FIELDCAT TYPE LVC_S_FCAT,
      LS_VARI  TYPE DISVARIANT.

*---------------------------------------------------------------------
*                START-OF_SELECTION
*---------------------------------------------------------------------
START-OF-SELECTION.
  DATA:BEGIN OF  ITAB OCCURS 0,
       VBELN LIKE LIKP-VBELN,
       POSNR LIKE LIPS-POSNR,
       CELLCOLOR TYPE LVC_T_SCOL, "required for color
       DROP(10),
       END OF ITAB.
  SELECT VBELN
         POSNR
         FROM LIPS
         UP TO 20 ROWS
         INTO CORRESPONDING FIELDS OF TABLE ITAB.

END-OF-SELECTION.
  IF NOT ITAB[] IS INITIAL.
    CALL SCREEN 100.
  ELSE.
    MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
  ENDIF.
*&---------------------------------------------------------------------*
*&      Form  CREATE_AND_INIT_ALV
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM CREATE_AND_INIT_ALV .
  DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
  "attention.....from here
  "split your container here...into two parts

  "create the container
  CREATE OBJECT G_CUSTOM_CONTAINER
           EXPORTING CONTAINER_NAME = G_CONTAINER1.
  "this is for top of page
* Create TOP-Document
  CREATE OBJECT DG_DYNDOC_ID
                   EXPORTING STYLE = 'ALV_GRID'.
* Create Splitter for custom_container
  CREATE OBJECT DG_SPLITTER
             EXPORTING PARENT  = G_CUSTOM_CONTAINER
                       ROWS    = 2
                       COLUMNS = 1.
* Split the custom_container to two containers and move the reference
* to receiving containers g_parent_html and g_parent_grid
  "i am allocating the space for grid and top of page
  CALL METHOD DG_SPLITTER->GET_CONTAINER
    EXPORTING
      ROW       = 1
      COLUMN    = 1
    RECEIVING
      CONTAINER = DG_PARENT_HTML.
  CALL METHOD DG_SPLITTER->GET_CONTAINER
    EXPORTING
      ROW       = 2
      COLUMN    = 1
    RECEIVING
      CONTAINER = DG_PARENT_GRID.

  "you can set the height of it
* Set height for g_parent_html
  CALL METHOD DG_SPLITTER->SET_ROW_HEIGHT
    EXPORTING
      ID     = 1
      HEIGHT = 5.
  "from here as usual..you need to specify parent as splitter part
  "which we alloted for grid
  CREATE OBJECT G_GRID
         EXPORTING I_PARENT = DG_PARENT_GRID.
* Set a titlebar for the grid control
  CLEAR GS_LAYOUT.
  GS_LAYOUT-GRID_TITLE = TEXT-003.
  GS_LAYOUT-ZEBRA = SPACE.
  GS_LAYOUT-CWIDTH_OPT = 'X'.
  GS_LAYOUT-NO_ROWMARK = 'X'.
  GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
  CALL METHOD G_GRID->REGISTER_EDIT_EVENT
    EXPORTING
      I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.

  CREATE OBJECT G_HANDLER.
  SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
  SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
  SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.
  DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
  DATA: L_INDEX TYPE SY-TABIX.
  "Here i am changing the color of line 1,5,10...
  "so you can change the color of font conditionally
  LOOP AT ITAB.
    L_INDEX = SY-TABIX.
    IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
      LS_CELLCOLOR-FNAME = 'VBELN'.
      LS_CELLCOLOR-COLOR-COL = '6'.
      LS_CELLCOLOR-COLOR-INT = '0'.
      LS_CELLCOLOR-COLOR-INV = '1'.
      APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
      MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
      LS_CELLCOLOR-FNAME = 'POSNR'.
      LS_CELLCOLOR-COLOR-COL = '6'.
      LS_CELLCOLOR-COLOR-INT = '0'.
      LS_CELLCOLOR-COLOR-INV = '1'.
      APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
      MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
    ENDIF.
  ENDLOOP.

* setting focus for created grid control
  CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
    EXPORTING
      CONTROL = G_GRID.
* Build fieldcat and set editable for date and reason code
* edit enabled. Assign a handle for the dropdown listbox.
  PERFORM BUILD_FIELDCAT.
  PERFORM  SET_DRDN_TABLE.
* Optionally restrict generic functions to 'change only'.
*   (The user shall not be able to add new lines).
  PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
**Vaiant to save the layout
  LS_VARI-REPORT      = SY-REPID.
  LS_VARI-HANDLE      = SPACE.
  LS_VARI-LOG_GROUP   = SPACE.
  LS_VARI-USERNAME    = SPACE.
  LS_VARI-VARIANT     = SPACE.
  LS_VARI-TEXT        = SPACE.
  LS_VARI-DEPENDVARS  = SPACE.

**Calling the Method for ALV output
  CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
      IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
      IS_VARIANT           = LS_VARI
      IS_LAYOUT            = GS_LAYOUT
      I_SAVE               = 'A'
    CHANGING
      IT_FIELDCATALOG      = IT_FIELDCAT
      IT_OUTTAB            = ITAB[].
  "do these..{
* Initializing document
  CALL METHOD DG_DYNDOC_ID->INITIALIZE_DOCUMENT.

* Processing events
  CALL METHOD G_GRID->LIST_PROCESSING_EVENTS
    EXPORTING
      I_EVENT_NAME = 'TOP_OF_PAGE'
      I_DYNDOC_ID  = DG_DYNDOC_ID.
  "end }
* Set editable cells to ready for input initially
  CALL METHOD G_GRID->SET_READY_FOR_INPUT
    EXPORTING
      I_READY_FOR_INPUT = 1.

ENDFORM.                               "CREATE_AND_INIT_ALV
*&---------------------------------------------------------------------*
*&      Form  EXCLUDE_TB_FUNCTIONS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->PT_EXCLUDE text
*----------------------------------------------------------------------*
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
* Only allow to change data not to create new entries (exclude
* generic functions).
  DATA LS_EXCLUDE TYPE UI_FUNC.

  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
*&---------------------------------------------------------------------*
*&      Form  build_fieldcat
*&---------------------------------------------------------------------*
*       Fieldcatalog
*----------------------------------------------------------------------*
FORM BUILD_FIELDCAT .
  DATA: L_POS TYPE I.
  L_POS = L_POS + 1.


  X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
  X_FIELDCAT-FIELDNAME = 'VBELN'.
  X_FIELDCAT-TABNAME = 'IT_FINAL'.
  X_FIELDCAT-COL_POS    = L_POS.
  X_FIELDCAT-NO_ZERO    = 'X'.
  X_FIELDCAT-OUTPUTLEN = '10'.
  X_FIELDCAT-HOTSPOT = 'X'.

  APPEND X_FIELDCAT TO IT_FIELDCAT.
  CLEAR X_FIELDCAT.
  L_POS = L_POS + 1.

  X_FIELDCAT-SCRTEXT_M = 'Item'(025).
  X_FIELDCAT-FIELDNAME = 'POSNR'.
  X_FIELDCAT-TABNAME = 'IT_FINAL'.
  X_FIELDCAT-COL_POS    = L_POS.
  X_FIELDCAT-OUTPUTLEN = '5'.
  APPEND X_FIELDCAT TO IT_FIELDCAT.
  CLEAR X_FIELDCAT.
  L_POS = L_POS + 1.


  X_FIELDCAT-SCRTEXT_M = 'Drop'(025).
  X_FIELDCAT-FIELDNAME = 'DROP'.
  X_FIELDCAT-TABNAME = 'IT_FINAL'.
  X_FIELDCAT-COL_POS    = L_POS.
  X_FIELDCAT-OUTPUTLEN = '5'.
  X_FIELDCAT-EDIT = 'X'.
  X_FIELDCAT-DRDN_HNDL = '1'.
  X_FIELDCAT-DRDN_ALIAS = 'X'.
  APPEND X_FIELDCAT TO IT_FIELDCAT.
  CLEAR X_FIELDCAT.

ENDFORM.                    " build_fieldcat
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'MAIN100'.
  SET TITLEBAR 'MAIN100'.
  IF G_CUSTOM_CONTAINER IS INITIAL.
**Initializing the grid and calling the fm to Display the O/P
    PERFORM CREATE_AND_INIT_ALV.
  ENDIF.
ENDMODULE.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
  CASE SY-UCOMM.
    WHEN 'BACK'.
      LEAVE TO SCREEN 0.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT

*&---------------------------------------------------------------------*
*&      Form  SET_DRDN_TABLE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM SET_DRDN_TABLE.

  DATA:LT_DRAL TYPE LVC_T_DRAL,
        LS_DRAL TYPE LVC_S_DRAL.
  LOOP AT ITAB .
* First listbox (handle '1').
    IF SY-INDEX = 1.
      LS_DRAL-HANDLE = '1'.
      LS_DRAL-VALUE =  ' '.
      LS_DRAL-INT_VALUE =  ' '.
    ELSE.
      LS_DRAL-HANDLE = '1'.
      LS_DRAL-VALUE =  ITAB-POSNR.
      LS_DRAL-INT_VALUE =  ITAB-POSNR.
    ENDIF.
    APPEND LS_DRAL TO LT_DRAL.
  ENDLOOP.
**Setting the Drop down table for Reason Code
  CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
    EXPORTING
      IT_DROP_DOWN_ALIAS = LT_DRAL.
ENDFORM.                               " set_drdn_table
*&---------------------------------------------------------------------*
*&      Form  EVENT_TOP_OF_PAGE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->DG_DYNDOC_ID  text
*----------------------------------------------------------------------*
FORM EVENT_TOP_OF_PAGE USING   DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT.
  "this is more clear.....check it
  "first add text, then pass it to comentry write fm
  DATA : DL_TEXT(255) TYPE C.  "Text
* Populating header to top-of-page
  CALL METHOD DG_DYNDOC_ID->ADD_TEXT
    EXPORTING
      TEXT      = 'Test Report'
      SAP_STYLE = CL_DD_AREA=>HEADING.
* Add new-line
  CALL METHOD DG_DYNDOC_ID->NEW_LINE.

  CLEAR : DL_TEXT.
* Move program ID
  CONCATENATE 'Program Name :' SY-REPID
         INTO DL_TEXT SEPARATED BY SPACE.
* Add Program Name to Document
  PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
  CALL METHOD DG_DYNDOC_ID->NEW_LINE.

  CLEAR : DL_TEXT.
* Move User ID
  CONCATENATE 'User ID :' SY-UNAME INTO DL_TEXT SEPARATED BY SPACE
.
* Add User ID to Document
  PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
  CALL METHOD DG_DYNDOC_ID->NEW_LINE.

  CLEAR : DL_TEXT.
* Move Client
  CONCATENATE 'Client :' SY-MANDT INTO DL_TEXT SEPARATED BY SPACE.
* Add Client to Document
  PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
  CALL METHOD DG_DYNDOC_ID->NEW_LINE.

  CLEAR : DL_TEXT.
* Move date
  WRITE SY-DATUM TO DL_TEXT.
  CONCATENATE 'Date :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
* Add Date to Document
  PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
  CALL METHOD DG_DYNDOC_ID->NEW_LINE.

  CLEAR : DL_TEXT.
* Move time
  WRITE SY-UZEIT TO DL_TEXT.
  CONCATENATE 'Time :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
* Add Time to Document
  PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
  CALL METHOD DG_DYNDOC_ID->NEW_LINE.
* Populating data to html control
  PERFORM HTML.

ENDFORM.                    " EVENT_TOP_OF_PAGE
*&---------------------------------------------------------------------*
*&      Form  ADD_TEXT
*&---------------------------------------------------------------------*
*       To add Text
*----------------------------------------------------------------------*
FORM ADD_TEXT USING P_TEXT TYPE SDYDO_TEXT_ELEMENT.
* Adding text
  CALL METHOD DG_DYNDOC_ID->ADD_TEXT
    EXPORTING
      TEXT         = P_TEXT
      SAP_EMPHASIS = CL_DD_AREA=>HEADING.
ENDFORM.                    " ADD_TEXT
*&---------------------------------------------------------------------*
*&      Form  HTML
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM HTML.
  DATA : DL_LENGTH  TYPE I,                           " Length
         DL_BACKGROUND_ID TYPE SDYDO_KEY VALUE SPACE. " Background_id
* Creating html control
  IF DG_HTML_CNTRL IS INITIAL.
    CREATE OBJECT DG_HTML_CNTRL
         EXPORTING
              PARENT    = DG_PARENT_HTML.
  ENDIF.
* Reuse_alv_grid_commentary_set
  CALL FUNCTION 'REUSE_ALV_GRID_COMMENTARY_SET'
    EXPORTING
      DOCUMENT = DG_DYNDOC_ID
      BOTTOM   = SPACE
    IMPORTING
      LENGTH   = DL_LENGTH.
* Get TOP->HTML_TABLE ready
  CALL METHOD DG_DYNDOC_ID->MERGE_DOCUMENT.
* Set wallpaper
  CALL METHOD DG_DYNDOC_ID->SET_DOCUMENT_BACKGROUND
    EXPORTING
      PICTURE_ID = DL_BACKGROUND_ID.
* Connect TOP document to HTML-Control
  DG_DYNDOC_ID->HTML_CONTROL = DG_HTML_CNTRL.
* Display TOP document
  CALL METHOD DG_DYNDOC_ID->DISPLAY_DOCUMENT
    EXPORTING
      REUSE_CONTROL      = 'X'
      PARENT             = DG_PARENT_HTML
    EXCEPTIONS
      HTML_DISPLAY_ERROR = 1.
  IF SY-SUBRC NE 0.
    MESSAGE I999 WITH 'Error in displaying top-of-page'(036).
  ENDIF.

ENDFORM.                    " HTML

Regards

vijay

20 REPLIES 20

Former Member
0 Kudos

BCALV_GRID_01

former_member181966
Active Contributor
0 Kudos

Try this link :

Hope this`ll help you .

Thanks

Former Member
0 Kudos

hi Abdul,

First add a handler method in your handler class definition as:

e.g.

METHOD handle_print_top_of_page
FOR EVENT print_top_of_page OF cl_gui_alv_grid .



Then implement the method in the implementation part of your local class.
e.g.
METHOD handle_print_top_of_page .

check this sample code for reference..

*----------------------------------------------------------------------*
*             A L V  D E C L A R A T I O N S
*----------------------------------------------------------------------*
 
DATA : dg_fieldcatalog   TYPE lvc_t_fcat, " Field Catalog
* Reference to custom container
       dg_custom_container  TYPE REF TO cl_gui_custom_container,
* Reference to Grid
       dg_grid1             TYPE REF TO cl_gui_alv_grid,
* Reference to Control container
       dg_mycontainer       TYPE scrfname VALUE 'CONTROL',
* Reference to event receiver
       dg_event_receiver    TYPE REF TO lcl_event_receiver,
* Reference to document
       dg_dyndoc_id       TYPE REF TO cl_dd_document,
* Reference to split container
       dg_splitter          TYPE REF TO cl_gui_splitter_container,
* Reference to grid container
       dg_parent_grid     TYPE REF TO cl_gui_container,
* Reference to html container
       dg_html_cntrl        TYPE REF TO cl_gui_html_viewer,
* Reference to html container
       dg_parent_html     TYPE REF TO cl_gui_container.
 
  *----------------------------------------------------------------------*
*           C L A S S  D E C L A R A T I O N S
 
****************************************************************
* LOCAL CLASSES: Definition
****************************************************************
*===============================================================
 
CLASS lcl_event_receiver DEFINITION.
  PUBLIC SECTION.
* § 2. Define a method for each print event you need.
    METHODS:
    top_of_page FOR EVENT top_of_page
                         OF cl_gui_alv_grid
                         IMPORTING e_dyndoc_id,
    handle_top_of_page
        FOR EVENT print_top_of_page OF cl_gui_alv_grid,
 
    handle_end_of_list
        FOR EVENT print_end_of_list OF cl_gui_alv_grid.
  PRIVATE SECTION.
ENDCLASS.
*===============================================================
****************************************************************
* LOCAL CLASSES: Implementation
****************************************************************
*===============================================================
* class c_event_receiver (Implementation)
CLASS lcl_event_receiver IMPLEMENTATION.
*§ 3.Implement your event handler methods. Use WRITE to provide output
  METHOD handle_top_of_page.
*  Print Top-of-page
    PERFORM print_top_of_page.
  ENDMETHOD.                           "handle_top_of_page
*-------------------------------------------
  METHOD handle_end_of_list.
* Print End-of-list
    PERFORM print_end_of_list.
  ENDMETHOD.                            "handle_end_of_list
*-------------------------------------------
  METHOD top_of_page.
* Top-of-page event
    PERFORM event_top_of_page USING dg_dyndoc_id.
  ENDMETHOD.                            "top_of_page
*-----------------------------------------------------------------
ENDCLASS.
*&---------------------------------------------------------------------*
*&      Form  EVENT_TOP_OF_PAGE
*&---------------------------------------------------------------------*
*       Top-of-page event
*----------------------------------------------------------------------*
FORM event_top_of_page USING   dg_dyndoc_id TYPE REF TO cl_dd_document.
 
 DATA : dl_text(255) TYPE c,  "Text
         dl_background_id TYPE sdydo_key VALUE '/EMN/EASTMAN_LOGO',
         dl_type.
  DATA a_logo TYPE REF TO cl_dd_area.
 
* Create TOP-Document
  CREATE OBJECT dg_dyndoc_id
                   EXPORTING style = 'ALV_GRID'.
* Populating header to top-of-page
  CALL METHOD dg_dyndoc_id->add_text
         EXPORTING
            text      = 'Primary Contact Membership Lists'(036)
            sap_style =  cl_dd_area=>heading.
 CALL METHOD dg_dyndoc_id->new_line.
 
  CLEAR : dl_text.
* Add 'Primary Contact ID'
  dl_text = text-033.
  PERFORM add_text USING dl_text 'H'.
 
  CALL METHOD dg_dyndoc_id->add_gap
         EXPORTING width   = 3.
 
  CLEAR dl_text.
  CONCATENATE dg_contact dg_ename INTO dl_text
  SEPARATED BY space.
 
  PERFORM add_text USING dl_text 'S'.
* Add new-line
  CALL METHOD dg_dyndoc_id->new_line.
 
  CLEAR : dl_text,dt_protc.
  READ TABLE dt_protc WITH KEY pgroup = dg_protc.
 
 
* Add Protocol category
  dl_text = text-034.
  PERFORM add_text USING dl_text 'H'.
  CALL METHOD dg_dyndoc_id->add_gap
         EXPORTING width   = 4.
 
  CLEAR dl_text.
  CONCATENATE dg_protc dt_protc-pgroupnam INTO dl_text
  SEPARATED BY space.
 
  PERFORM add_text USING dl_text 'S'.
 
 
* Add new-line
  CALL METHOD dg_dyndoc_id->new_line.
 
  CLEAR : dl_text,dt_prot.
  READ TABLE dt_prot WITH KEY pnumber = dg_prot.
 
* Add Protocol Number
  dl_text = text-035.
  PERFORM add_text USING dl_text 'H'.
  CALL METHOD dg_dyndoc_id->add_gap
         EXPORTING width   = 5.
 
  CLEAR dl_text.
 
  CONCATENATE dg_prot  dt_prot-pname INTO dl_text
  SEPARATED BY space.
 
  PERFORM add_text USING dl_text 'S'.
 
 
  CALL METHOD dg_dyndoc_id->vertical_split
              EXPORTING split_area =  dg_dyndoc_id
                        split_width = '70%'
                 IMPORTING right_area = a_logo.
 
  CALL METHOD a_logo->add_picture
        EXPORTING picture_id = '/EMN/EASTMAN_LOGO'.
 
  CALL METHOD dg_dyndoc_id->merge_document.
 
  CALL METHOD  dg_dyndoc_id->display_document
      EXPORTING reuse_control = 'X'
                parent =  dg_parent_html
      EXCEPTIONS html_display_error = 1.
 
ENDFORM.                    " EVENT_TOP_OF_PAGE
 
  



2) In PBO do below : First you need to split the container to two containers one is to palce top-of-page and other to display grid.

  IF dg_custom_container IS INITIAL.
* Create fieldcatalog for structure dt_final
    PERFORM fieldcat_init  USING dg_fieldcatalog[].
    dt_final[] = dt_members[].
* Create a custom container control for our ALV Control
    CREATE OBJECT dg_custom_container
        EXPORTING
            container_name = dg_mycontainer
        EXCEPTIONS
            cntl_error = 1
            cntl_system_error = 2
            create_error = 3
            lifetime_error = 4
            lifetime_dynpro_dynpro_link = 5.
    IF sy-subrc <> 0.
      dg_repid = sy-repid.
* Add your handling, for example
      CALL FUNCTION 'POPUP_TO_INFORM'
           EXPORTING
                titel = dg_repid
                txt2  = sy-subrc
                txt1  = 'The control could not be created'.
    ENDIF.
 
* Create TOP-Document
    CREATE OBJECT dg_dyndoc_id
                     EXPORTING style = 'ALV_GRID'.
* Create Splitter for custom_container
    CREATE OBJECT dg_splitter
               EXPORTING parent  = dg_custom_container
                         rows    = 2
                         columns = 1.
* Split the custom_container to two containers and move the reference
* to receiving containers g_parent_html and g_parent_grid
 
    CALL METHOD dg_splitter->get_container EXPORTING
                                   row                 = 1
                                   column              = 1
                               RECEIVING container = dg_parent_html.
    CALL METHOD dg_splitter->get_container EXPORTING
                                  row                 = 2
                                  column              = 1
                              RECEIVING container = dg_parent_grid.
 
 
* Set height for g_parent_html
    CALL METHOD dg_splitter->set_row_height
      EXPORTING
        id     = 1
        height = 25.
* Create an instance of alv control
    CREATE OBJECT dg_grid1
          EXPORTING i_appl_events = c_x
                    i_parent = dg_parent_grid.
* Registering events
    CREATE OBJECT dg_event_receiver.
    SET HANDLER dg_event_receiver->top_of_page FOR dg_grid1.
    SET HANDLER dg_event_receiver->handle_top_of_page FOR dg_grid1.
    SET HANDLER dg_event_receiver->handle_end_of_list FOR dg_grid1.
 
* Grid display
    CALL METHOD dg_grid1->set_table_for_first_display
             EXPORTING
               i_structure_name = 'TP_FINAL'
               is_layout        = ds_layout
             CHANGING
                it_fieldcatalog  = dg_fieldcatalog[]
                it_outtab        = dt_final.
 
* Initializing document
    CALL METHOD dg_dyndoc_id->initialize_document.
 
* Processing events
    CALL METHOD dg_grid1->list_processing_events
                      EXPORTING i_event_name = 'TOP_OF_PAGE'
                                i_dyndoc_id  = dg_dyndoc_id.
 
 
  ENDIF.
* Setting focus for created grid control
  CALL METHOD cl_gui_control=>set_focus EXPORTING control = dg_grid1.

WRITE:/ 'Flights Made on ', sy-datum .

ENDMETHOD.

And register this method as the handler.
e.g.

SET HANDLER gr_event_handler->handle_print_top_of_list FOR gr_alvgrid .

regards

satesh

0 Kudos

Hi Satesh,

Can you give me a simple example.I dont want to print event and html views and all.

I got this same program from other threads...

Abdul

former_member188685
Active Contributor
0 Kudos

Hi Abdul,

i remember you also joined in the discussion long time,

check this thread, and see second page, you have some sample code.

regards

vijay

0 Kudos

Hi Vijay,

Yeah you are right..

That program is fully confusing..

Can you please give me a simple example.it will be helpful for me.

Thanks,

Abdul

0 Kudos

Hi Abdul,

if it is not that urgent , i will give you tomorrow, since i was little loaded.

regards

vijay

0 Kudos

Hi Vijay,

Thanks.I need to deliver by tomorrow.Only TOP_OF_PAGE part is missing.Please update tomorrow.

Thanks,

Abdul

Former Member
0 Kudos

hi Abdul,

just to give the implementation of it..

in the class definition..

PUBLIC section.

methods:

METHOD handle_print_top_of_page

FOR EVENT print_top_of_page OF cl_gui_alv_grid .

in the class implementation.

METHOD handle_print_top_of_page .

WRITE: / 'TOP OF PAGE'.

ENDMETHOD .

CREATE Object gr_event_handler.

SET HANDLER gr_event_handler->handle_print_top_of_page FOR gr_alvgrid.

where gr_alvgrid is ..

DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid .

regards

satesh

0 Kudos

Hi Satesh,

I dont want print top of page.I want TOP-OF-PAGE like the one which is existing in conventional reporting..

Thanks,

Abdul

0 Kudos

hi Abdul,

you can write anything inside the

METHOD handle_print_top_of_page.

...................

ENDMETHOD.

i just gave it for an example..

And i currently out of access..

thats why cudn't give you a sample

regards

satesh

0 Kudos

by handling <b>print_top_of_page</b> method as mentioned above and also by setting<b>

set handler</b> u can achive it.

but u cant view it, only u can view it in print preview.

<b>note : u need to set the print parameters of type lvc_s_prnt</b>

0 Kudos

Hi Hymavathi,

I know about the print_top_of_page event.My question is i want to handle top_of_page not the print_top_of_page.

Abdul

0 Kudos

there is event TOP_OF_PAGE too in cl_gui_alv_grid.

u handle in the same way as above. no need to set print parametrs then but reserving lines is better

another way is to write what ever u want as top_of_page in the layout above the custom container

0 Kudos

Hi,

Here is a sample code for top of page event.

In this case, you will get TOP in background too:


REPORT zad_test_alv
       NO STANDARD PAGE HEADING
       MESSAGE-ID zcs_cs_001.

************************************************************************
*                    DATA DECLARATIONS
************************************************************************

************************************************************************
* Table Declarations:
************************************************************************
TABLES: mara.


************************************************************************
* Internal Tables:
************************************************************************
DATA:  i_fieldcat    TYPE lvc_t_fcat,
       i_fieldrows   TYPE lvc_t_row,
       i_output      TYPE STANDARD TABLE OF mara,


************************************************************************
* Work Areas:
************************************************************************
      w_fieldrows   LIKE LINE OF i_fieldrows,
      w_output      TYPE mara.

************************************************************************
* Constants Declarations:
************************************************************************
CONSTANTS:    c_x                        TYPE c VALUE 'X'.


*----------------------------------------------------------------------*
*             SELECTION SCREEN FIELDS
************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK b_0 WITH FRAME TITLE text-000.
SELECT-OPTIONS: s_mara FOR mara-matnr.
SELECTION-SCREEN END OF BLOCK b_0.



*----------------------------------------------------------------------*
*                   CLASS DECLARATIONS                                 *
*----------------------------------------------------------------------*

INCLUDE <icon>.
* Predefine a local class for event handling to allow the
* declaration of a reference variable before the class is defined.
CLASS lcl_event_receiver DEFINITION DEFERRED.

DATA : o_alvgrid          TYPE REF TO cl_gui_alv_grid ,
       o_dockingcontainer TYPE REF TO cl_gui_docking_container ,
       o_eventreceiver    TYPE REF TO lcl_event_receiver,
       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_text01(255)      TYPE c VALUE 'This is the heading',
       v_font(50)         TYPE c VALUE '30',
*---------------------------------------------------------------------*
*       Work Area
*---------------------------------------------------------------------*
       w_layout TYPE lvc_s_layo ,
       w_variant TYPE disvariant.
*---------------------------------------------------------------------*
*       Constants
*---------------------------------------------------------------------*

CONSTANTS : c_a(1) TYPE c VALUE 'A' .                     " All Layouts
*---------------------------------------------------------------------*
*       CLASS lcl_event_receiver DEFINITION
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
CLASS lcl_event_receiver DEFINITION.

  PUBLIC SECTION.
    CLASS-METHODS:
* Hot Spot Click
       handle_hotspot
         FOR EVENT hotspot_click OF cl_gui_alv_grid
            IMPORTING e_row_id
                      e_column_id
                      es_row_no,
      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.
* Implementation
CLASS lcl_event_receiver IMPLEMENTATION.
*&---------------------------------------------------------------------*
*&      Method handle_hotspot
*&---------------------------------------------------------------------*
* This method is called when the user clicks on a hotspot to drill down.
* The following types are exported from the ALV
* LVC_S_ROW
* LVC_S_COL
* LVC_S_ROID
*&---------------------------------------------------------------------*
  METHOD handle_hotspot.
* The hotspot processing coded in the form below.
    PERFORM f9802_handle_hotspot USING e_row_id
                                       e_column_id
                                       es_row_no.

  ENDMETHOD.
  METHOD handle_print_top_of_page.
    IF sy-pagno = 1.
      PERFORM f9803_top_of_page.
    ENDIF.
  ENDMETHOD.
  METHOD handle_top_of_page.
    PERFORM f9803_top_of_page.
  ENDMETHOD.
ENDCLASS.


***********************************************************************
* START-OF-SELECTION
***********************************************************************
START-OF-SELECTION.

  PERFORM f5000_get_data.

************************************************************************
** END-OF-SELECTION
************************************************************************

END-OF-SELECTION.
************************************************************************
  IF NOT i_output[] IS INITIAL.
    CALL SCREEN 9001.
  ELSE.
    MESSAGE i001 WITH text-051.
    " No documents were found for the selection
    LEAVE LIST-PROCESSING.
  ENDIF.


*----------------------------------------------------------------------*
*                           FORMS                                      *
*----------------------------------------------------------------------*
* This part has the various forms used in the program
************************************************************************

*&---------------------------------------------------------------------*
*&      Form  f5000_get_totals
*&---------------------------------------------------------------------*
*       To get Data
*----------------------------------------------------------------------*
FORM f5000_get_data.

  SELECT *
         INTO TABLE i_output UP TO 5 ROWS
         FROM mara.


ENDFORM.                    " f5000_get_data

*&---------------------------------------------------------------------*
*&      Form  f9000_objects_create
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM f9000_objects_create.

  IF cl_gui_alv_grid=>offline( ) IS INITIAL.
    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 i001 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->top_left_container.
    v_contnr_bot = v_split->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->list_processing_events
                     EXPORTING i_event_name = 'TOP_OF_PAGE'
                               i_dyndoc_id  = v_html.
    CLEAR v_text01.

    v_text01     = 'Heading'.


    v_font = 'HEADING'.
    CALL METHOD v_html->add_gap
                EXPORTING
                  width         = 120.
    CALL METHOD v_html->add_text
           EXPORTING
             text           = v_text01
             sap_style      = v_font.

    CALL METHOD v_html->new_line.
* Display the data
    CALL METHOD v_html->display_document
      EXPORTING
         parent             = v_contnr_top.

*   Handle the event
    CALL METHOD o_alvgrid->list_processing_events
                        EXPORTING i_event_name = 'PRINT_TOP_OF_PAGE'.
  ENDIF.

* IF Program Running in Background, place a container.
  IF sy-batch = 'X'.
    CREATE OBJECT o_alvgrid
 EXPORTING
   i_parent = o_dockingcontainer.
  ENDIF.

ENDFORM.                    " f9000_objects_create

*&---------------------------------------------------------------------*
*&      Form  f9001_build_field_cat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_I_FIELDCAT  text
*      -->P_0021   text
*----------------------------------------------------------------------*
FORM f9001_build_field_cat TABLES   p_fieldcat STRUCTURE lvc_s_fcat
                      USING value(p_structure).

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
            i_structure_name       = p_structure
       CHANGING
            ct_fieldcat            = p_fieldcat[]
       EXCEPTIONS
            inconsistent_interface = 1
            program_error          = 2
            OTHERS                 = 3.
  IF sy-subrc <> 0.
    MESSAGE i001 WITH text-e05."Error in ALV field catalogue creation
    LEAVE LIST-PROCESSING.
  ENDIF.

ENDFORM.                    " f9001_build_field_cat
*&---------------------------------------------------------------------*
*&      Form  f9002_modify_field_cat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_I_FIELDCAT  text
*----------------------------------------------------------------------*
FORM f9002_modify_field_cat TABLES p_fieldcat STRUCTURE lvc_s_fcat.

  FIELD-SYMBOLS : <lfs_fieldcat> TYPE lvc_s_fcat.


ENDFORM.                    " f9002_modify_field_cat
*&---------------------------------------------------------------------*
*&      Form  f9003_layout
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_SY_TITLE  text
*      -->P_0030   text
*      -->P_0031   text
*      -->P_0032   text
*----------------------------------------------------------------------*
FORM f9003_layout USING  value(ptitle)
                         value(pzebra)
                         value(pmode)
                         value(pwidth).

  w_layout-grid_title  = ptitle.
  w_layout-zebra       = pzebra.
  w_layout-sel_mode    = pmode.
  w_layout-cwidth_opt  = pwidth.
  w_variant-report     = sy-repid.

ENDFORM.                    " f9003_layout
*&---------------------------------------------------------------------*
*&      Form  f9004_display_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_I_OUTPUT  text
*      -->P_I_FIELDCAT  text
*----------------------------------------------------------------------*
FORM f9004_display_data TABLES   p_output
                                 p_fieldcat.

  IF sy-batch = 'X'.
    CREATE OBJECT o_eventreceiver.
    SET HANDLER o_eventreceiver->handle_print_top_of_page FOR o_alvgrid.
  ENDIF.

  CALL METHOD o_alvgrid->set_table_for_first_display
    EXPORTING
       is_variant                    = w_variant
       i_save                        = c_a
       is_layout                     = w_layout
    CHANGING
       it_outtab                     = p_output[]
       it_fieldcatalog               = p_fieldcat[]
    EXCEPTIONS
       invalid_parameter_combination = 1
       program_error                 = 2
       too_many_lines                = 3
       OTHERS                        = 4.

  IF sy-subrc <> 0.
    MESSAGE i128 WITH text-e06."Error in ALV report display
    LEAVE LIST-PROCESSING.
  ENDIF.

  IF sy-batch NE 'X'.
    CREATE OBJECT o_eventreceiver.
    SET HANDLER o_eventreceiver->handle_print_top_of_page FOR o_alvgrid.
    SET HANDLER o_eventreceiver->handle_top_of_page FOR o_alvgrid.
  ENDIF.

ENDFORM.                    " f9004_display_data
*&---------------------------------------------------------------------*
*&      Form  f9005_free_objects
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_O_ALVGRID  text
*      -->P_0056   text
*      -->P_TEXT_E02  text
*----------------------------------------------------------------------*
FORM f9005_free_objects USING pobject
                        value(ptype)
                        value(ptext).
  CASE ptype.

    WHEN 'ALV'.
      DATA lobjectalv TYPE REF TO cl_gui_alv_grid.
      lobjectalv = pobject.
      IF NOT ( lobjectalv IS INITIAL ).
        CALL METHOD lobjectalv->free
          EXCEPTIONS
            cntl_error        = 1
            cntl_system_error = 2
            OTHERS            = 3.
        CLEAR: pobject ,
               lobjectalv.
        PERFORM f9006_error_handle USING ptext.
      ENDIF.

    WHEN 'DOCKING'.
      DATA lobjectdock TYPE REF TO cl_gui_docking_container.
      lobjectdock = pobject.
      IF NOT ( lobjectdock IS INITIAL ).
        CALL METHOD lobjectdock->free
          EXCEPTIONS
            cntl_error        = 1
            cntl_system_error = 2
            OTHERS            = 3.
        CLEAR: pobject ,
               lobjectdock.
        PERFORM f9006_error_handle USING ptext.
      ENDIF.

    WHEN 'CONTAINER'.
      DATA lobjectcontainer TYPE REF TO cl_gui_container.
      lobjectcontainer = pobject.
      IF NOT ( lobjectcontainer IS INITIAL ).
        CALL METHOD lobjectcontainer->free
          EXCEPTIONS
            cntl_error        = 1
            cntl_system_error = 2
            OTHERS            = 3.
        CLEAR: pobject ,
               lobjectcontainer.
        PERFORM f9006_error_handle USING ptext.
      ENDIF.

    WHEN OTHERS.
      sy-subrc = 1.
      PERFORM f9006_error_handle USING text-e04.
  ENDCASE.
ENDFORM.                    " f9005_free_objects
*&---------------------------------------------------------------------*
*&      Form  f9006_error_handle
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_PTEXT  text
*----------------------------------------------------------------------*
FORM f9006_error_handle USING value(ptext).

  IF sy-subrc NE 0.
    CALL FUNCTION 'POPUP_TO_INFORM'
         EXPORTING
              titel = text-e03
              txt2  = sy-subrc
              txt1  = ptext.
  ENDIF.

ENDFORM.                    " f9006_error_handle
*&---------------------------------------------------------------------*
*&      Form  f9802_handle_hotspot
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_E_ROW_ID  text
*      -->P_E_COLUMN_ID  text
*      -->P_ES_ROW_NO  text
*----------------------------------------------------------------------*
FORM f9802_handle_hotspot USING    p_row_id
                                   p_column_id
                                   p_row_no.


ENDFORM.                    " f9802_handle_hotspot
*&---------------------------------------------------------------------*
*&      Form  f9803_top_of_page
*&---------------------------------------------------------------------*
*      TOP-OF-PAGE
*----------------------------------------------------------------------*
FORM f9803_top_of_page.
* List heading
  WRITE:/ v_text01.
ENDFORM.                    " f9803_top_of_page



*----------------------------------------------------------------------*
*   INCLUDE ZCSGM_MFRECON_SUMMRPT_LD_SCRN                              *
************************************************************************
*&---------------------------------------------------------------------*
*&      Module  STATUS_1001  OUTPUT
*&---------------------------------------------------------------------*
*       This performs PBO
*----------------------------------------------------------------------*
MODULE  status_9001 OUTPUT.

  IF o_dockingcontainer IS INITIAL.
    SET PF-STATUS 'ZSTATUS'.
    SET TITLEBAR  'ZTITLE'.
*   Creating Object
    PERFORM f9000_objects_create.

*   Building the field catalog
    PERFORM f9001_build_field_cat TABLES i_fieldcat
                            USING 'MARA'.
  ENDIF.
*   Modifying the field catalog
  PERFORM f9002_modify_field_cat TABLES i_fieldcat.

*   For Layout
  PERFORM f9003_layout USING sy-title 'X' 'B' 'X' .
*   To display output
  PERFORM f9004_display_data TABLES i_output
                                    i_fieldcat.
* Set handlers for events
  SET HANDLER o_eventreceiver->handle_hotspot       FOR o_alvgrid.

ENDMODULE.                 " STATUS_9001  OUTPUT

*&---------------------------------------------------------------------
*&      Module  USER_COMMAND_9001  INPUT
*&---------------------------------------------------------------------
*       This performs PAI
*----------------------------------------------------------------------*

MODULE user_command_9001 INPUT.

  CASE sy-ucomm.
    WHEN 'EXIT' OR  'CANC'.
      PERFORM f9005_free_objects :
              USING o_alvgrid 'ALV' text-e02 ,
              USING o_dockingcontainer 'DOCKING' text-e01.
      LEAVE PROGRAM.
    WHEN 'BACK'.
      PERFORM f9005_free_objects :
              USING o_alvgrid 'ALV' text-e02 ,
              USING o_dockingcontainer 'DOCKING' text-e01.
      SET SCREEN '0'.
    WHEN OTHERS.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_9001  INPUT


Best Regards,

Anjali

former_member188685
Active Contributor
0 Kudos

Hi Abdul,

Check this code....

REPORT  ZTEST1234_ALV_TOP    MESSAGE-ID ZZ                           .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: L_VALID TYPE C,
      V_FLAG,
      V_DATA_CHANGE,
      V_ROW TYPE LVC_S_ROW,
      V_COLUMN TYPE LVC_S_COL,
      V_ROW_NUM TYPE LVC_S_ROID.
"The Below Definitions Must.....
DATA:
* Reference to document
       DG_DYNDOC_ID       TYPE REF TO CL_DD_DOCUMENT,
* Reference to split container
       DG_SPLITTER          TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
* Reference to grid container
       DG_PARENT_GRID     TYPE REF TO CL_GUI_CONTAINER,
* Reference to html container
       DG_HTML_CNTRL        TYPE REF TO CL_GUI_HTML_VIEWER,
* Reference to html container
       DG_PARENT_HTML     TYPE REF TO CL_GUI_CONTAINER.
"up to here
*---------------------------------------------------------------------*
*       CLASS lcl_event_handler DEFINITION
*---------------------------------------------------------------------*
CLASS LCL_EVENT_HANDLER DEFINITION .
  PUBLIC SECTION .
    METHODS:
**Hot spot Handler
    HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                      IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
**Double Click Handler
    HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                                     IMPORTING E_ROW E_COLUMN ES_ROW_NO,

    TOP_OF_PAGE FOR EVENT TOP_OF_PAGE              "event handler
                         OF CL_GUI_ALV_GRID
                         IMPORTING E_DYNDOC_ID.

ENDCLASS.                    "lcl_event_handler DEFINITION
*---------------------------------------------------------------------*
*       CLASS lcl_event_handler IMPLEMENTATION
*---------------------------------------------------------------------*
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*Handle Hotspot Click
  METHOD HANDLE_HOTSPOT_CLICK .
    CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
    V_ROW  = E_ROW_ID.
    V_COLUMN = E_COLUMN_ID.
    V_ROW_NUM = ES_ROW_NO.
    MESSAGE I000 WITH V_ROW 'clicked'.
  ENDMETHOD.                    "lcl_event_handler

*Handle Double Click
  METHOD  HANDLE_DOUBLE_CLICK.

  ENDMETHOD.                    "handle_double_click

  METHOD TOP_OF_PAGE.                   "implementation
* Top-of-page event
    PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
  ENDMETHOD.                            "top_of_page
ENDCLASS.                    "LCL_EVENT_HANDLER IMPLEMENTATION

*&---------------------------------------------------------------------*
*&             Global Definitions
*&---------------------------------------------------------------------*
DATA:      G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
            G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler

DATA: OK_CODE LIKE SY-UCOMM,
      SAVE_OK LIKE SY-UCOMM,
      G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
      GS_LAYOUT TYPE LVC_S_LAYO.


*- Fieldcatalog for First and second Report
DATA: IT_FIELDCAT  TYPE  LVC_T_FCAT,
      X_FIELDCAT TYPE LVC_S_FCAT,
      LS_VARI  TYPE DISVARIANT.

*---------------------------------------------------------------------
*                START-OF_SELECTION
*---------------------------------------------------------------------
START-OF-SELECTION.
  DATA:BEGIN OF  ITAB OCCURS 0,
       VBELN LIKE LIKP-VBELN,
       POSNR LIKE LIPS-POSNR,
       CELLCOLOR TYPE LVC_T_SCOL, "required for color
       DROP(10),
       END OF ITAB.
  SELECT VBELN
         POSNR
         FROM LIPS
         UP TO 20 ROWS
         INTO CORRESPONDING FIELDS OF TABLE ITAB.

END-OF-SELECTION.
  IF NOT ITAB[] IS INITIAL.
    CALL SCREEN 100.
  ELSE.
    MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
  ENDIF.
*&---------------------------------------------------------------------*
*&      Form  CREATE_AND_INIT_ALV
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM CREATE_AND_INIT_ALV .
  DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
  "attention.....from here
  "split your container here...into two parts

  "create the container
  CREATE OBJECT G_CUSTOM_CONTAINER
           EXPORTING CONTAINER_NAME = G_CONTAINER1.
  "this is for top of page
* Create TOP-Document
  CREATE OBJECT DG_DYNDOC_ID
                   EXPORTING STYLE = 'ALV_GRID'.
* Create Splitter for custom_container
  CREATE OBJECT DG_SPLITTER
             EXPORTING PARENT  = G_CUSTOM_CONTAINER
                       ROWS    = 2
                       COLUMNS = 1.
* Split the custom_container to two containers and move the reference
* to receiving containers g_parent_html and g_parent_grid
  "i am allocating the space for grid and top of page
  CALL METHOD DG_SPLITTER->GET_CONTAINER
    EXPORTING
      ROW       = 1
      COLUMN    = 1
    RECEIVING
      CONTAINER = DG_PARENT_HTML.
  CALL METHOD DG_SPLITTER->GET_CONTAINER
    EXPORTING
      ROW       = 2
      COLUMN    = 1
    RECEIVING
      CONTAINER = DG_PARENT_GRID.

  "you can set the height of it
* Set height for g_parent_html
  CALL METHOD DG_SPLITTER->SET_ROW_HEIGHT
    EXPORTING
      ID     = 1
      HEIGHT = 5.
  "from here as usual..you need to specify parent as splitter part
  "which we alloted for grid
  CREATE OBJECT G_GRID
         EXPORTING I_PARENT = DG_PARENT_GRID.
* Set a titlebar for the grid control
  CLEAR GS_LAYOUT.
  GS_LAYOUT-GRID_TITLE = TEXT-003.
  GS_LAYOUT-ZEBRA = SPACE.
  GS_LAYOUT-CWIDTH_OPT = 'X'.
  GS_LAYOUT-NO_ROWMARK = 'X'.
  GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
  CALL METHOD G_GRID->REGISTER_EDIT_EVENT
    EXPORTING
      I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.

  CREATE OBJECT G_HANDLER.
  SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
  SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
  SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.
  DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
  DATA: L_INDEX TYPE SY-TABIX.
  "Here i am changing the color of line 1,5,10...
  "so you can change the color of font conditionally
  LOOP AT ITAB.
    L_INDEX = SY-TABIX.
    IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
      LS_CELLCOLOR-FNAME = 'VBELN'.
      LS_CELLCOLOR-COLOR-COL = '6'.
      LS_CELLCOLOR-COLOR-INT = '0'.
      LS_CELLCOLOR-COLOR-INV = '1'.
      APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
      MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
      LS_CELLCOLOR-FNAME = 'POSNR'.
      LS_CELLCOLOR-COLOR-COL = '6'.
      LS_CELLCOLOR-COLOR-INT = '0'.
      LS_CELLCOLOR-COLOR-INV = '1'.
      APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
      MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
    ENDIF.
  ENDLOOP.

* setting focus for created grid control
  CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
    EXPORTING
      CONTROL = G_GRID.
* Build fieldcat and set editable for date and reason code
* edit enabled. Assign a handle for the dropdown listbox.
  PERFORM BUILD_FIELDCAT.
  PERFORM  SET_DRDN_TABLE.
* Optionally restrict generic functions to 'change only'.
*   (The user shall not be able to add new lines).
  PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
**Vaiant to save the layout
  LS_VARI-REPORT      = SY-REPID.
  LS_VARI-HANDLE      = SPACE.
  LS_VARI-LOG_GROUP   = SPACE.
  LS_VARI-USERNAME    = SPACE.
  LS_VARI-VARIANT     = SPACE.
  LS_VARI-TEXT        = SPACE.
  LS_VARI-DEPENDVARS  = SPACE.

**Calling the Method for ALV output
  CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
      IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
      IS_VARIANT           = LS_VARI
      IS_LAYOUT            = GS_LAYOUT
      I_SAVE               = 'A'
    CHANGING
      IT_FIELDCATALOG      = IT_FIELDCAT
      IT_OUTTAB            = ITAB[].
  "do these..{
* Initializing document
  CALL METHOD DG_DYNDOC_ID->INITIALIZE_DOCUMENT.

* Processing events
  CALL METHOD G_GRID->LIST_PROCESSING_EVENTS
    EXPORTING
      I_EVENT_NAME = 'TOP_OF_PAGE'
      I_DYNDOC_ID  = DG_DYNDOC_ID.
  "end }
* Set editable cells to ready for input initially
  CALL METHOD G_GRID->SET_READY_FOR_INPUT
    EXPORTING
      I_READY_FOR_INPUT = 1.

ENDFORM.                               "CREATE_AND_INIT_ALV
*&---------------------------------------------------------------------*
*&      Form  EXCLUDE_TB_FUNCTIONS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->PT_EXCLUDE text
*----------------------------------------------------------------------*
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
* Only allow to change data not to create new entries (exclude
* generic functions).
  DATA LS_EXCLUDE TYPE UI_FUNC.

  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
*&---------------------------------------------------------------------*
*&      Form  build_fieldcat
*&---------------------------------------------------------------------*
*       Fieldcatalog
*----------------------------------------------------------------------*
FORM BUILD_FIELDCAT .
  DATA: L_POS TYPE I.
  L_POS = L_POS + 1.


  X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
  X_FIELDCAT-FIELDNAME = 'VBELN'.
  X_FIELDCAT-TABNAME = 'IT_FINAL'.
  X_FIELDCAT-COL_POS    = L_POS.
  X_FIELDCAT-NO_ZERO    = 'X'.
  X_FIELDCAT-OUTPUTLEN = '10'.
  X_FIELDCAT-HOTSPOT = 'X'.

  APPEND X_FIELDCAT TO IT_FIELDCAT.
  CLEAR X_FIELDCAT.
  L_POS = L_POS + 1.

  X_FIELDCAT-SCRTEXT_M = 'Item'(025).
  X_FIELDCAT-FIELDNAME = 'POSNR'.
  X_FIELDCAT-TABNAME = 'IT_FINAL'.
  X_FIELDCAT-COL_POS    = L_POS.
  X_FIELDCAT-OUTPUTLEN = '5'.
  APPEND X_FIELDCAT TO IT_FIELDCAT.
  CLEAR X_FIELDCAT.
  L_POS = L_POS + 1.


  X_FIELDCAT-SCRTEXT_M = 'Drop'(025).
  X_FIELDCAT-FIELDNAME = 'DROP'.
  X_FIELDCAT-TABNAME = 'IT_FINAL'.
  X_FIELDCAT-COL_POS    = L_POS.
  X_FIELDCAT-OUTPUTLEN = '5'.
  X_FIELDCAT-EDIT = 'X'.
  X_FIELDCAT-DRDN_HNDL = '1'.
  X_FIELDCAT-DRDN_ALIAS = 'X'.
  APPEND X_FIELDCAT TO IT_FIELDCAT.
  CLEAR X_FIELDCAT.

ENDFORM.                    " build_fieldcat
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'MAIN100'.
  SET TITLEBAR 'MAIN100'.
  IF G_CUSTOM_CONTAINER IS INITIAL.
**Initializing the grid and calling the fm to Display the O/P
    PERFORM CREATE_AND_INIT_ALV.
  ENDIF.
ENDMODULE.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
  CASE SY-UCOMM.
    WHEN 'BACK'.
      LEAVE TO SCREEN 0.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT

*&---------------------------------------------------------------------*
*&      Form  SET_DRDN_TABLE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM SET_DRDN_TABLE.

  DATA:LT_DRAL TYPE LVC_T_DRAL,
        LS_DRAL TYPE LVC_S_DRAL.
  LOOP AT ITAB .
* First listbox (handle '1').
    IF SY-INDEX = 1.
      LS_DRAL-HANDLE = '1'.
      LS_DRAL-VALUE =  ' '.
      LS_DRAL-INT_VALUE =  ' '.
    ELSE.
      LS_DRAL-HANDLE = '1'.
      LS_DRAL-VALUE =  ITAB-POSNR.
      LS_DRAL-INT_VALUE =  ITAB-POSNR.
    ENDIF.
    APPEND LS_DRAL TO LT_DRAL.
  ENDLOOP.
**Setting the Drop down table for Reason Code
  CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
    EXPORTING
      IT_DROP_DOWN_ALIAS = LT_DRAL.
ENDFORM.                               " set_drdn_table
*&---------------------------------------------------------------------*
*&      Form  EVENT_TOP_OF_PAGE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->DG_DYNDOC_ID  text
*----------------------------------------------------------------------*
FORM EVENT_TOP_OF_PAGE USING   DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT.
  "this is more clear.....check it
  "first add text, then pass it to comentry write fm
  DATA : DL_TEXT(255) TYPE C.  "Text
* Populating header to top-of-page
  CALL METHOD DG_DYNDOC_ID->ADD_TEXT
    EXPORTING
      TEXT      = 'Test Report'
      SAP_STYLE = CL_DD_AREA=>HEADING.
* Add new-line
  CALL METHOD DG_DYNDOC_ID->NEW_LINE.

  CLEAR : DL_TEXT.
* Move program ID
  CONCATENATE 'Program Name :' SY-REPID
         INTO DL_TEXT SEPARATED BY SPACE.
* Add Program Name to Document
  PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
  CALL METHOD DG_DYNDOC_ID->NEW_LINE.

  CLEAR : DL_TEXT.
* Move User ID
  CONCATENATE 'User ID :' SY-UNAME INTO DL_TEXT SEPARATED BY SPACE
.
* Add User ID to Document
  PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
  CALL METHOD DG_DYNDOC_ID->NEW_LINE.

  CLEAR : DL_TEXT.
* Move Client
  CONCATENATE 'Client :' SY-MANDT INTO DL_TEXT SEPARATED BY SPACE.
* Add Client to Document
  PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
  CALL METHOD DG_DYNDOC_ID->NEW_LINE.

  CLEAR : DL_TEXT.
* Move date
  WRITE SY-DATUM TO DL_TEXT.
  CONCATENATE 'Date :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
* Add Date to Document
  PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
  CALL METHOD DG_DYNDOC_ID->NEW_LINE.

  CLEAR : DL_TEXT.
* Move time
  WRITE SY-UZEIT TO DL_TEXT.
  CONCATENATE 'Time :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
* Add Time to Document
  PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
  CALL METHOD DG_DYNDOC_ID->NEW_LINE.
* Populating data to html control
  PERFORM HTML.

ENDFORM.                    " EVENT_TOP_OF_PAGE
*&---------------------------------------------------------------------*
*&      Form  ADD_TEXT
*&---------------------------------------------------------------------*
*       To add Text
*----------------------------------------------------------------------*
FORM ADD_TEXT USING P_TEXT TYPE SDYDO_TEXT_ELEMENT.
* Adding text
  CALL METHOD DG_DYNDOC_ID->ADD_TEXT
    EXPORTING
      TEXT         = P_TEXT
      SAP_EMPHASIS = CL_DD_AREA=>HEADING.
ENDFORM.                    " ADD_TEXT
*&---------------------------------------------------------------------*
*&      Form  HTML
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM HTML.
  DATA : DL_LENGTH  TYPE I,                           " Length
         DL_BACKGROUND_ID TYPE SDYDO_KEY VALUE SPACE. " Background_id
* Creating html control
  IF DG_HTML_CNTRL IS INITIAL.
    CREATE OBJECT DG_HTML_CNTRL
         EXPORTING
              PARENT    = DG_PARENT_HTML.
  ENDIF.
* Reuse_alv_grid_commentary_set
  CALL FUNCTION 'REUSE_ALV_GRID_COMMENTARY_SET'
    EXPORTING
      DOCUMENT = DG_DYNDOC_ID
      BOTTOM   = SPACE
    IMPORTING
      LENGTH   = DL_LENGTH.
* Get TOP->HTML_TABLE ready
  CALL METHOD DG_DYNDOC_ID->MERGE_DOCUMENT.
* Set wallpaper
  CALL METHOD DG_DYNDOC_ID->SET_DOCUMENT_BACKGROUND
    EXPORTING
      PICTURE_ID = DL_BACKGROUND_ID.
* Connect TOP document to HTML-Control
  DG_DYNDOC_ID->HTML_CONTROL = DG_HTML_CNTRL.
* Display TOP document
  CALL METHOD DG_DYNDOC_ID->DISPLAY_DOCUMENT
    EXPORTING
      REUSE_CONTROL      = 'X'
      PARENT             = DG_PARENT_HTML
    EXCEPTIONS
      HTML_DISPLAY_ERROR = 1.
  IF SY-SUBRC NE 0.
    MESSAGE I999 WITH 'Error in displaying top-of-page'(036).
  ENDIF.

ENDFORM.                    " HTML

Regards

vijay

0 Kudos

Hi Vijay,

Thanks for your code.

May i know why u are using splitter container and moving the ref to html viewer..

Thanks,

Abdul Hakim

0 Kudos

hi,

since we are using container, there is no space to give the top of page. so we need to split the container into two parts and reserve the space for it. and add the text through comentry write.

did you check the mail....

check it.

regards

vijay

0 Kudos

Hi Vijay,

I have checked it.It is really superb.

Thanks a lot.Sorry for the delayed response..

Why we are using html container then?

Thanks,

Abdul

0 Kudos

To show the HTML format of top of page, since we are adding all the data to dynamic document, and passing to html control.

regards

vijay