Unable to print TOP_OF_PAGE in ALV Using OOPS??plz help me in my code

*&--data declaration
TYPE-POOLS : slis.
TYPES : BEGIN OF type_vbak,
        vbeln LIKE vbak-vbeln,   "SD Order
        ernam LIKE vbak-ernam,   "Name of the person who created
        audat LIKE vbak-audat,   "Document Date
        vbtyp LIKE vbak-vbtyp,   "SD Document Category
        auart LIKE vbak-auart,   "Type of Order
        netwr LIKE vbak-netwr,
        "Net value in sales current doc currency
        waerk LIKE vbak-waerk,   "SD Document Currency
        vkorg LIKE vbak-vkorg,   "Sales Organization
        vtweg LIKE vbak-vtweg,   "Distribution Chanel
        spart LIKE vbak-spart,   "Division
        END OF type_vbak.
TYPES : BEGIN OF type_vbap,
        vbeln LIKE vbap-vbeln,   "SD Order
        posnr LIKE vbap-posnr,   "Sales Document Item
        matnr LIKE vbap-matnr,   "Component
        charg LIKE vbap-charg,   "Batch Number
        matkl LIKE vbap-matkl,   "Material Group
        arktx LIKE vbap-arktx,   "Short Text for Sales Order Item
        kwmeng LIKE vbap-kwmeng,
        "cumulative order quantity in sales unit
        vrkme LIKE vbap-vrkme,   "Sales Unit
        netpr LIKE vbap-netpr,   "Net Price
        END OF type_vbap.
TYPES : type_t_vbak TYPE type_vbak,
        type_t_vbap TYPE type_vbap.
DATA : it_vbak TYPE STANDARD TABLE OF type_t_vbak,
       it_vbap TYPE STANDARD TABLE OF type_t_vbap.
DATA : wa_vbak TYPE type_t_vbak,
       wa_vbap TYPE type_t_vbap.
DATA : d_vbeln LIKE vbak-vbeln,
       d_audat LIKE vbak-audat,
       lv_vbeln TYPE vbak-vbeln.
*&---Internal table for event catalog
DATA :it_event TYPE slis_t_event,
Internal table for Header printing
      i_header TYPE slis_t_listheader,
*&---Work area for event catalog
      wa_event TYPE slis_alv_event,
*&---Work area for report layout
      wa_layout TYPE slis_layout_alv,
Workarea for Header printing
      wa_header TYPE slis_listheader.
*&---cc1 is refering to the global class 'cl_gui_custom_container'
DATA : cc1 TYPE REF TO cl_gui_custom_container.
*&----alv1 is refering to the global class 'cl_gui_alv_grid'
DATA : alv1 TYPE REF TO cl_gui_alv_grid.
*&----work area for field catalog
DATA : wa_fieldcatalog1 TYPE lvc_s_fcat.
*&----internal table for field catalog
DATA : it_fieldcatalog1 TYPE lvc_t_fcat.
*&----data declaration for ok_code
DATA: ok_code_0101 LIKE sy-ucomm.
*&---cc2 is refering to the global class 'cl_gui_custom_container'
DATA : cc2 TYPE REF TO cl_gui_custom_container.
*&----alv2 is refering to the global class 'cl_gui_alv_grid'
DATA : alv2 TYPE REF TO cl_gui_alv_grid.
*&----work area for field catalog
DATA : wa_fieldcatalog2 TYPE lvc_s_fcat.
*&----internal table for field catalog
DATA : it_fieldcatalog2 TYPE lvc_t_fcat.
*&----data declaration for ok_code
DATA: ok_code_0102 LIKE sy-ucomm.
*&--defining the selection screen
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_vbeln FOR d_vbeln OBLIGATORY,   "SD Order
                 s_audat FOR d_audat.              "Document Date
SELECTION-SCREEN END OF BLOCK bl1.
AT SELECTION-SCREEN ON s_vbeln.
  IF s_vbeln[] IS INITIAL.
    SET CURSOR FIELD 'S_VBELN-LOW'.
    MESSAGE e001 WITH text-001.
  ELSE.
    SELECT SINGLE vbeln INTO wa_vbak-vbeln
                        FROM vbak
                        WHERE vbeln IN s_vbeln.
    IF sy-subrc <> 0.
      SET CURSOR FIELD 'S_VBELN-LOW'.
      MESSAGE e002 WITH text-002.
    ENDIF.
  ENDIF.
  DATA :  wa_row_id TYPE lvc_s_row.
      CLASS lcl_event_reciver DEFINITION
CLASS lcl_event_reciver DEFINITION.
  PUBLIC SECTION.
   &--defining the method for each event
    METHODS : handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
                                  IMPORTING e_row_id e_column_id es_row_no,
              handle_top_of_page FOR EVENT TOP_OF_PAGE OF cl_gui_alv_grid
                                  IMPORTING e_dyndoc_id.
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.                    "lcl_event_reciver DEFINITION
      CLASS lcl_event_reciver IMPLEMENTATION
CLASS lcl_event_reciver IMPLEMENTATION.
*&--implement the event handler methods for hot spot click.
  METHOD handle_hotspot_click.
    CLEAR lv_vbeln.
    READ TABLE it_vbak INTO wa_vbak INDEX e_row_id.
    lv_vbeln = wa_vbak-vbeln.
**&--for freeing the instance which was created alv2.
perform free_previous_object.
*CALL METHOD alv2->free
EXCEPTIONS
   CNTL_ERROR        = 1
   CNTL_SYSTEM_ERROR = 2
   others            = 3
*IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
*&--fetching the data
*perform fetch_data_alv2 usinr lv_vbeln.
    SELECT  vbeln    "SD Order
            posnr    "Sales Document Item
            matnr    "Component
            charg    "Batch Number
            matkl    "Material Group
            arktx    "Short Text for Sales Order Item
            kwmeng   "cumulative order quantity in sales unit
            vrkme    "Sales Unit
            netpr    "Net Price
               INTO TABLE it_vbap
               FROM vbap
               WHERE vbeln = lv_vbeln.
    IF sy-subrc <> 0.
      MESSAGE e004 WITH text-004.
    ENDIF.
*&---populating the second alv
*perform populate_fieldcatalog2.
*&-POPULATING THE FIELD VBELN
    wa_fieldcatalog2-col_pos = 1.  "position of the column
    wa_fieldcatalog2-fieldname = 'VBELN'. "field name
    wa_fieldcatalog2-tabname = 'IT_VBAP'.    "INTERNAL table name
    wa_fieldcatalog2-ref_table = 'VBAP'.     "FOR REFERENCE
*wa_fieldcatalog2-hotspot = 'X'.
    wa_fieldcatalog2-outputlen = 10.  "output length of the field.
    wa_fieldcatalog2-seltext = 'SD ORDER NUMBER'.
    "long key word
    APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
    CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD POSNR
    wa_fieldcatalog2-col_pos = 2.  "position of the column
    wa_fieldcatalog2-fieldname = 'POSNR'. "field name
    wa_fieldcatalog2-tabname = 'IT_VBAP'.    "INTERNAL table name
    wa_fieldcatalog2-ref_table = 'VBAP'.     "FOR REFERENCE
    wa_fieldcatalog2-outputlen = 2.  "output length of the field.
    wa_fieldcatalog2-seltext = 'SD ITEM'.
    "long key word
    APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
    CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD MATNR
    wa_fieldcatalog2-col_pos = 3.  "position of the column
    wa_fieldcatalog2-fieldname = 'MATNR'. "field name
    wa_fieldcatalog2-tabname = 'IT_VBAP'.    "INTERNAL table name
    wa_fieldcatalog2-ref_table = 'VBAP'.     "FOR REFERENCE
    wa_fieldcatalog2-outputlen = 2.  "output length of the field.
    wa_fieldcatalog2-seltext = 'COMPONENT'.
    "long key word
    APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
    CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD CHARG
    wa_fieldcatalog2-col_pos = 4.  "position of the column
    wa_fieldcatalog2-fieldname = 'CHARG'. "field name
    wa_fieldcatalog2-tabname = 'IT_VBAP'.    "INTERNAL table name
    wa_fieldcatalog2-ref_table = 'VBAP'.     "FOR REFERENCE
    wa_fieldcatalog2-outputlen = 2.  "output length of the field.
    wa_fieldcatalog2-seltext = 'BATCH NUMBER'.
    "long key word
    APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
    CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD MATKL
    wa_fieldcatalog2-col_pos = 5.  "position of the column
    wa_fieldcatalog2-fieldname = 'MATKL'. "field name
    wa_fieldcatalog2-tabname = 'IT_VBAP'.    "INTERNAL table name
    wa_fieldcatalog2-ref_table = 'VBAP'.     "FOR REFERENCE
    wa_fieldcatalog2-outputlen = 2.  "output length of the field.
    wa_fieldcatalog2-seltext = 'MATERIAL GROUP'.
    "long key word
    APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
    CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD ARKTX
    wa_fieldcatalog2-col_pos = 6.  "position of the column
    wa_fieldcatalog2-fieldname = 'ARKTX'. "field name
    wa_fieldcatalog2-tabname = 'IT_VBAP'.    "INTERNAL table name
    wa_fieldcatalog2-ref_table = 'VBAP'.     "FOR REFERENCE
    wa_fieldcatalog2-outputlen = 2.  "output length of the field.
    wa_fieldcatalog2-seltext = 'SHORT TEXT'.
    "long key word
    APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
    CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD KWMENG
    wa_fieldcatalog2-col_pos = 7.  "position of the column
    wa_fieldcatalog2-fieldname = 'KEMENG'. "field name
    wa_fieldcatalog2-tabname = 'IT_VBAP'.    "INTERNAL table name
    wa_fieldcatalog2-ref_table = 'VBAP'.     "FOR REFERENCE
    wa_fieldcatalog2-outputlen = 2.  "output length of the field.
    wa_fieldcatalog2-seltext = 'SALES QUANTITY'.
    "long key word
    APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
    CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD VRKME
    wa_fieldcatalog2-col_pos = 8.  "position of the column
    wa_fieldcatalog2-fieldname = 'VRKME'. "field name
    wa_fieldcatalog2-tabname = 'IT_VBAP'.    "INTERNAL table name
    wa_fieldcatalog2-ref_table = 'VBAP'.     "FOR REFERENCE
    wa_fieldcatalog2-outputlen = 2.  "output length of the field.
    wa_fieldcatalog2-seltext = 'SALES UNIT'.
    "long key word
    APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
    CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD NETPR
    wa_fieldcatalog2-col_pos = 9.  "position of the column
    wa_fieldcatalog2-fieldname = 'NETPR'. "field name
    wa_fieldcatalog2-tabname = 'IT_VBAP'.    "INTERNAL table name
    wa_fieldcatalog2-ref_table = 'VBAP'.     "FOR REFERENCE
    wa_fieldcatalog2-outputlen = 2.  "output length of the field.
    wa_fieldcatalog2-seltext = 'NET PRICE'.
    "long key word
    APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
    CLEAR wa_fieldcatalog2.
*&--display the alv2
*perform display_alv2.
    CREATE OBJECT cc2
        EXPORTING
   PARENT                      =
          container_name              = 'CUSTOMCONTROL2'
   STYLE                       =
   LIFETIME                    = lifetime_default
   REPID                       =
   DYNNR                       =
   NO_AUTODEF_PROGID_DYNNR     =
EXCEPTIONS
   CNTL_ERROR                  = 1
   CNTL_SYSTEM_ERROR           = 2
   CREATE_ERROR                = 3
   LIFETIME_ERROR              = 4
   LIFETIME_DYNPRO_DYNPRO_LINK = 5
   others                      = 6
    IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CREATE OBJECT alv2
      EXPORTING
   I_SHELLSTYLE      = 0
   I_LIFETIME        =
        i_parent          = cc2
   I_APPL_EVENTS     = space
   I_PARENTDBG       =
   I_APPLOGPARENT    =
   I_GRAPHICSPARENT  =
   I_NAME            =
   I_FCAT_COMPLETE   = SPACE
EXCEPTIONS
   ERROR_CNTL_CREATE = 1
   ERROR_CNTL_INIT   = 2
   ERROR_CNTL_LINK   = 3
   ERROR_DP_CREATE   = 4
   others            = 5
    IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL METHOD alv2->set_table_for_first_display
EXPORTING
   I_BUFFER_ACTIVE               =
   I_BYPASSING_BUFFER            =
   I_CONSISTENCY_CHECK           =
   I_STRUCTURE_NAME              =
   IS_VARIANT                    =
   I_SAVE                        =
   I_DEFAULT                     = 'X'
   IS_LAYOUT                     =
   IS_PRINT                      =
   IT_SPECIAL_GROUPS             =
   IT_TOOLBAR_EXCLUDING          =
   IT_HYPERLINK                  =
   IT_ALV_GRAPHICS               =
   IT_EXCEPT_QINFO               =
   IR_SALV_ADAPTER               =
      CHANGING
        it_outtab                     = it_vbap
        it_fieldcatalog               = it_fieldcatalog2
   IT_SORT                       =
   IT_FILTER                     =
EXCEPTIONS
   INVALID_PARAMETER_COMBINATION = 1
   PROGRAM_ERROR                 = 2
   TOO_MANY_LINES                = 3
   others                        = 4
    IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
  ENDMETHOD.                    "handle_hotspot_click
*&--implement the event handler methods for top of page
method handle_top_of_page.
CALL METHOD e_dyndoc_id->display_document
EXPORTING parent = cc1.
*write:/5 'Desc :' , 'Sales Document Header & Items'.
*write:/5 'Date :' , sy-datum.
*write:/5 'Page no :' , sy-pagno.
endmethod.
ENDCLASS.                    "lcl_event_reciver IMPLEMENTATION
*&--data for event handler in hot spot click
DATA: event_handler TYPE REF TO lcl_event_reciver,
*&--data for event handler in top of page
      o_dd_doc TYPE REF TO cl_dd_document.
*&--main logic
START-OF-SELECTION.
*&--vbak.
  SELECT  vbeln    "SD Order
          ernam    "Name of the person who created
          audat    "Document Date
          vbtyp    "SD Document Category
          auart    "Type of Order
          netwr    "Net value in sales current doc currency
          waerk    "SD Document Currency
          vkorg    "Sales Organization
          vtweg    "Distribution Chanel
          spart    "Division
             INTO TABLE it_vbak
             FROM vbak
             WHERE vbeln IN s_vbeln AND
                   audat IN s_audat.
  IF sy-subrc <> 0.
    MESSAGE e003 WITH text-003.
  ENDIF.
  CLEAR wa_fieldcatalog1 .
  REFRESH  it_fieldcatalog1 .
*&-POPULATING THE FIELD VBELN
  wa_fieldcatalog1-col_pos = 1.  "position of the column
  wa_fieldcatalog1-fieldname = 'VBELN'. "field name
  wa_fieldcatalog1-tabname = 'IT_VBAK'.    "INTERNAL table name
  wa_fieldcatalog1-ref_table = 'VBAK'.     "FOR REFERENCE
  wa_fieldcatalog1-hotspot = 'X'.
  wa_fieldcatalog1-outputlen = 10.  "output length of the field.
  wa_fieldcatalog1-seltext = 'SD ORDER NUMBER'.
  "long key word
  APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
  CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD ERNAM
  wa_fieldcatalog1-col_pos = 2.  "position of the column
  wa_fieldcatalog1-fieldname = 'ERNAM'. "field name
  wa_fieldcatalog1-tabname = 'IT_VBAK'.    "INTERNAL table name
  wa_fieldcatalog1-ref_table = 'VBAK'.     "FOR REFERENCE
  wa_fieldcatalog1-outputlen = 12.  "output length of the field.
  wa_fieldcatalog1-seltext = 'NAME OF THE PERSON WHO CREATED'.
  "long key word
  APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
  CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD AUDAT
  wa_fieldcatalog1-col_pos = 3.  "position of the column
  wa_fieldcatalog1-fieldname = 'AUDAT'. "field name
  wa_fieldcatalog1-tabname = 'IT_VBAK'.    "INTERNAL table name
  wa_fieldcatalog1-ref_table = 'VBAK'.     "FOR REFERENCE
  wa_fieldcatalog1-outputlen = 8.  "output length of the field.
  wa_fieldcatalog1-seltext = 'DOCUMENT DATE'.
  "long key word
  APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
  CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD VBTYP
  wa_fieldcatalog1-col_pos = 4.  "position of the column
  wa_fieldcatalog1-fieldname = 'VBTYP'. "field name
  wa_fieldcatalog1-tabname = 'IT_VBAK'.    "INTERNAL table name
  wa_fieldcatalog1-ref_table = 'VBAK'.     "FOR REFERENCE
  wa_fieldcatalog1-outputlen = 1.  "output length of the field.
  wa_fieldcatalog1-seltext = 'DOCUMENT CATEGORY'.
  "long key word
  APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
  CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD AUART
  wa_fieldcatalog1-col_pos = 5.  "position of the column
  wa_fieldcatalog1-fieldname = 'AUART'. "field name
  wa_fieldcatalog1-tabname = 'IT_VBAK'.    "INTERNAL table name
  wa_fieldcatalog1-ref_table = 'VBAK'.     "FOR REFERENCE
  wa_fieldcatalog1-outputlen = 4.  "output length of the field.
  wa_fieldcatalog1-seltext = 'TYPE OF THE ORDER'.
  "long key word
  APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
  CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD NETWR
  wa_fieldcatalog1-col_pos = 6.  "position of the column
  wa_fieldcatalog1-fieldname = 'NETWR'. "field name
  wa_fieldcatalog1-tabname = 'IT_VBAK'.    "INTERNAL table name
  wa_fieldcatalog1-ref_table = 'VBAK'.     "FOR REFERENCE
  wa_fieldcatalog1-outputlen = 15.  "output length of the field.
  wa_fieldcatalog1-seltext = 'NET VALUE'.
  "long key word
  APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
  CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD WAERK
  wa_fieldcatalog1-col_pos = 7.  "position of the column
  wa_fieldcatalog1-fieldname = 'WAERK'. "field name
  wa_fieldcatalog1-tabname = 'IT_VBAK'.    "INTERNAL table name
  wa_fieldcatalog1-ref_table = 'VBAK'.     "FOR REFERENCE
  wa_fieldcatalog1-outputlen = 5.  "output length of the field.
  wa_fieldcatalog1-seltext = 'DOCUMENT CURRENCY'.
  "long key word
  APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
  CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD VKORG
  wa_fieldcatalog1-col_pos = 8.  "position of the column
  wa_fieldcatalog1-fieldname = 'VKORG'. "field name
  wa_fieldcatalog1-tabname = 'IT_VBAK'.    "INTERNAL table name
  wa_fieldcatalog1-ref_table = 'VBAK'.     "FOR REFERENCE
  wa_fieldcatalog1-outputlen = 4.  "output length of the field.
  wa_fieldcatalog1-seltext = 'SALES ORG'.
  "long key word
  APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
  CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD VTWEG
  wa_fieldcatalog1-col_pos = 9.  "position of the column
  wa_fieldcatalog1-fieldname = 'VTWEG'. "field name
  wa_fieldcatalog1-tabname = 'IT_VBAK'.    "INTERNAL table name
  wa_fieldcatalog1-ref_table = 'VBAK'.     "FOR REFERENCE
  wa_fieldcatalog1-outputlen = 2.  "output length of the field.
  wa_fieldcatalog1-seltext = 'DISTRIBUTION CHANEL'.
  "long key word
  APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
  CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD SPART
  wa_fieldcatalog1-col_pos = 10.  "position of the column
  wa_fieldcatalog1-fieldname = 'SPART'. "field name
  wa_fieldcatalog1-tabname = 'IT_VBAK'.    "INTERNAL table name
  wa_fieldcatalog1-ref_table = 'VBAK'.     "FOR REFERENCE
  wa_fieldcatalog1-outputlen = 2.  "output length of the field.
  wa_fieldcatalog1-seltext = 'DIVISION'.
  "long key word
  APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
  CLEAR wa_fieldcatalog1.
  CREATE OBJECT cc1
      EXPORTING
   PARENT                      =
        container_name              = 'CUSTOMCONTROL1'
   STYLE                       =
   LIFETIME                    = lifetime_default
   REPID                       =
   DYNNR                       =
   NO_AUTODEF_PROGID_DYNNR     =
EXCEPTIONS
   CNTL_ERROR                  = 1
   CNTL_SYSTEM_ERROR           = 2
   CREATE_ERROR                = 3
   LIFETIME_ERROR              = 4
   LIFETIME_DYNPRO_DYNPRO_LINK = 5
   others                      = 6
  IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  CREATE OBJECT alv1
    EXPORTING
   I_SHELLSTYLE      = 0
   I_LIFETIME        =
      i_parent          = cc1
   I_APPL_EVENTS     = space
   I_PARENTDBG       =
   I_APPLOGPARENT    =
   I_GRAPHICSPARENT  =
   I_NAME            =
   I_FCAT_COMPLETE   = SPACE
EXCEPTIONS
   ERROR_CNTL_CREATE = 1
   ERROR_CNTL_INIT   = 2
   ERROR_CNTL_LINK   = 3
   ERROR_DP_CREATE   = 4
   others            = 5
  IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  CREATE OBJECT event_handler.
*&---set handler for hot spot click
  SET HANDLER: event_handler->handle_hotspot_click FOR alv1,
*&---set handler for top of page
              event_handler->handle_top_of_page for alv1.
  CALL METHOD alv1->set_table_for_first_display
EXPORTING
   I_BUFFER_ACTIVE               =
   I_BYPASSING_BUFFER            =
   I_CONSISTENCY_CHECK           =
   I_STRUCTURE_NAME              =
   IS_VARIANT                    =
   I_SAVE                        =
   I_DEFAULT                     = 'X'
   IS_LAYOUT                     =
   IS_PRINT                      =
   IT_SPECIAL_GROUPS             =
   IT_TOOLBAR_EXCLUDING          =
   IT_HYPERLINK                  =
   IT_ALV_GRAPHICS               =
   IT_EXCEPT_QINFO               =
   IR_SALV_ADAPTER               =
    CHANGING
      it_outtab                     = it_vbak
      it_fieldcatalog               = it_fieldcatalog1
   IT_SORT                       =
   IT_FILTER                     =
EXCEPTIONS
   INVALID_PARAMETER_COMBINATION = 1
   PROGRAM_ERROR                 = 2
   TOO_MANY_LINES                = 3
   others                        = 4
  IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
*&--for hot spot click
  CALL METHOD cl_gui_control=>set_focus
    EXPORTING
      control = alv1.
*&--for top of page
CALL METHOD alv1->list_processing_events
  EXPORTING
    i_event_name      = 'TOP_OF_PAGE'
    I_DYNDOC_ID       = o_dd_doc
   IS_SUBTOTTXT_INFO =
   IP_SUBTOT_LINE    =
   I_TABLE_INDEX     =
CHANGING
   C_SUBTOTTXT       =
  CALL SCREEN 0101.
*&      Module  STATUS_0101  OUTPUT
      text
MODULE status_0101 OUTPUT.
  SET PF-STATUS 'Z9D_MENU1_ALV'.
SET TITLEBAR 'xxx'.
ENDMODULE.                 " STATUS_0101  OUTPUT
*&      Module  USER_COMMAND_0101  INPUT
      text
MODULE user_command_0101 INPUT.
  CASE ok_code_0101.
    WHEN 'BCK1'.
      LEAVE PROGRAM.
  ENDCASE.

*&--data declaration
TYPE-POOLS : slis.
TYPES : BEGIN OF type_vbak,
vbeln LIKE vbak-vbeln, "SD Order
ernam LIKE vbak-ernam, "Name of the person who created
audat LIKE vbak-audat, "Document Date
vbtyp LIKE vbak-vbtyp, "SD Document Category
auart LIKE vbak-auart, "Type of Order
netwr LIKE vbak-netwr,
"Net value in sales current doc currency
waerk LIKE vbak-waerk, "SD Document Currency
vkorg LIKE vbak-vkorg, "Sales Organization
vtweg LIKE vbak-vtweg, "Distribution Chanel
spart LIKE vbak-spart, "Division
END OF type_vbak.
TYPES : BEGIN OF type_vbap,
vbeln LIKE vbap-vbeln, "SD Order
posnr LIKE vbap-posnr, "Sales Document Item
matnr LIKE vbap-matnr, "Component
charg LIKE vbap-charg, "Batch Number
matkl LIKE vbap-matkl, "Material Group
arktx LIKE vbap-arktx, "Short Text for Sales Order Item
kwmeng LIKE vbap-kwmeng,
"cumulative order quantity in sales unit
vrkme LIKE vbap-vrkme, "Sales Unit
netpr LIKE vbap-netpr, "Net Price
END OF type_vbap.
TYPES : type_t_vbak TYPE type_vbak,
type_t_vbap TYPE type_vbap.
DATA : it_vbak TYPE STANDARD TABLE OF type_t_vbak,
it_vbap TYPE STANDARD TABLE OF type_t_vbap.
DATA : wa_vbak TYPE type_t_vbak,
wa_vbap TYPE type_t_vbap.
DATA : d_vbeln LIKE vbak-vbeln,
d_audat LIKE vbak-audat,
lv_vbeln TYPE vbak-vbeln.
*&---Internal table for event catalog
DATA :it_event TYPE slis_t_event,
Internal table for Header printing
i_header TYPE slis_t_listheader,
*&---Work area for event catalog
wa_event TYPE slis_alv_event,
*&---Work area for report layout
wa_layout TYPE slis_layout_alv,
Workarea for Header printing
wa_header TYPE slis_listheader.
*&---cc1 is refering to the global class 'cl_gui_custom_container'
DATA : cc1 TYPE REF TO cl_gui_custom_container.
*&----alv1 is refering to the global class 'cl_gui_alv_grid'
DATA : alv1 TYPE REF TO cl_gui_alv_grid.
*&----work area for field catalog
DATA : wa_fieldcatalog1 TYPE lvc_s_fcat.
*&----internal table for field catalog
DATA : it_fieldcatalog1 TYPE lvc_t_fcat.
*&----data declaration for ok_code
DATA: ok_code_0101 LIKE sy-ucomm.
*&---cc2 is refering to the global class 'cl_gui_custom_container'
DATA : cc2 TYPE REF TO cl_gui_custom_container.
*&----alv2 is refering to the global class 'cl_gui_alv_grid'
DATA : alv2 TYPE REF TO cl_gui_alv_grid.
*&----work area for field catalog
DATA : wa_fieldcatalog2 TYPE lvc_s_fcat.
*&----internal table for field catalog
DATA : it_fieldcatalog2 TYPE lvc_t_fcat.
*&----data declaration for ok_code
DATA: ok_code_0102 LIKE sy-ucomm.
*&--defining the selection screen
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_vbeln FOR d_vbeln OBLIGATORY, "SD Order
s_audat FOR d_audat. "Document Date
SELECTION-SCREEN END OF BLOCK bl1.
AT SELECTION-SCREEN ON s_vbeln.
IF s_vbeln[] IS INITIAL.
SET CURSOR FIELD 'S_VBELN-LOW'.
MESSAGE e001 WITH text-001.
ELSE.
SELECT SINGLE vbeln INTO wa_vbak-vbeln
FROM vbak
WHERE vbeln IN s_vbeln.
IF sy-subrc <> 0.
SET CURSOR FIELD 'S_VBELN-LOW'.
MESSAGE e002 WITH text-002.
ENDIF.
ENDIF.
DATA : wa_row_id TYPE lvc_s_row,
<b>ls_print type lvc_s_prnt.</b>
CLASS lcl_event_reciver DEFINITION
CLASS lcl_event_reciver DEFINITION.
PUBLIC SECTION.
&--defining the method for each event
METHODS : handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id e_column_id es_row_no,
handle_top_of_page FOR EVENT TOP_OF_PAGE OF cl_gui_alv_grid
IMPORTING e_dyndoc_id.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS. "lcl_event_reciver DEFINITION
CLASS lcl_event_reciver IMPLEMENTATION
CLASS lcl_event_reciver IMPLEMENTATION.
*&--implement the event handler methods for hot spot click.
METHOD handle_hotspot_click.
CLEAR lv_vbeln.
READ TABLE it_vbak INTO wa_vbak INDEX e_row_id.
lv_vbeln = wa_vbak-vbeln.
**&--for freeing the instance which was created alv2.
perform free_previous_object.
*CALL METHOD alv2->free
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3
*IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
*&--fetching the data
*perform fetch_data_alv2 usinr lv_vbeln.
SELECT vbeln "SD Order
posnr "Sales Document Item
matnr "Component
charg "Batch Number
matkl "Material Group
arktx "Short Text for Sales Order Item
kwmeng "cumulative order quantity in sales unit
vrkme "Sales Unit
netpr "Net Price
INTO TABLE it_vbap
FROM vbap
WHERE vbeln = lv_vbeln.
IF sy-subrc <> 0.
MESSAGE e004 WITH text-004.
ENDIF.
*&---populating the second alv
*perform populate_fieldcatalog2.
*&-POPULATING THE FIELD VBELN
wa_fieldcatalog2-col_pos = 1. "position of the column
wa_fieldcatalog2-fieldname = 'VBELN'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
*wa_fieldcatalog2-hotspot = 'X'.
wa_fieldcatalog2-outputlen = 10. "output length of the field.
wa_fieldcatalog2-seltext = 'SD ORDER NUMBER'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD POSNR
wa_fieldcatalog2-col_pos = 2. "position of the column
wa_fieldcatalog2-fieldname = 'POSNR'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'SD ITEM'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD MATNR
wa_fieldcatalog2-col_pos = 3. "position of the column
wa_fieldcatalog2-fieldname = 'MATNR'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'COMPONENT'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD CHARG
wa_fieldcatalog2-col_pos = 4. "position of the column
wa_fieldcatalog2-fieldname = 'CHARG'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'BATCH NUMBER'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD MATKL
wa_fieldcatalog2-col_pos = 5. "position of the column
wa_fieldcatalog2-fieldname = 'MATKL'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'MATERIAL GROUP'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD ARKTX
wa_fieldcatalog2-col_pos = 6. "position of the column
wa_fieldcatalog2-fieldname = 'ARKTX'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'SHORT TEXT'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD KWMENG
wa_fieldcatalog2-col_pos = 7. "position of the column
wa_fieldcatalog2-fieldname = 'KEMENG'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'SALES QUANTITY'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD VRKME
wa_fieldcatalog2-col_pos = 8. "position of the column
wa_fieldcatalog2-fieldname = 'VRKME'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'SALES UNIT'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&-POPULATING THE FIELD NETPR
wa_fieldcatalog2-col_pos = 9. "position of the column
wa_fieldcatalog2-fieldname = 'NETPR'. "field name
wa_fieldcatalog2-tabname = 'IT_VBAP'. "INTERNAL table name
wa_fieldcatalog2-ref_table = 'VBAP'. "FOR REFERENCE
wa_fieldcatalog2-outputlen = 2. "output length of the field.
wa_fieldcatalog2-seltext = 'NET PRICE'.
"long key word
APPEND wa_fieldcatalog2 TO it_fieldcatalog2.
CLEAR wa_fieldcatalog2.
*&--display the alv2
*perform display_alv2.
CREATE OBJECT cc2
EXPORTING
PARENT =
container_name = 'CUSTOMCONTROL2'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT alv2
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = cc2
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
I_FCAT_COMPLETE = SPACE
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD alv2->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
it_outtab = it_vbap
it_fieldcatalog = it_fieldcatalog2
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMETHOD. "handle_hotspot_click
*&--implement the event handler methods for top of page
method handle_top_of_page.
CALL METHOD e_dyndoc_id->display_document
EXPORTING parent = cc1.
*write:/5 'Desc :' , 'Sales Document Header & Items'.
*write:/5 'Date :' , sy-datum.
*write:/5 'Page no :' , sy-pagno.
endmethod.
ENDCLASS. "lcl_event_reciver IMPLEMENTATION
*&--data for event handler in hot spot click
DATA: event_handler TYPE REF TO lcl_event_reciver,
*&--data for event handler in top of page
o_dd_doc TYPE REF TO cl_dd_document.
*&--main logic
START-OF-SELECTION.
*&--vbak.
SELECT vbeln "SD Order
ernam "Name of the person who created
audat "Document Date
vbtyp "SD Document Category
auart "Type of Order
netwr "Net value in sales current doc currency
waerk "SD Document Currency
vkorg "Sales Organization
vtweg "Distribution Chanel
spart "Division
INTO TABLE it_vbak
FROM vbak
WHERE vbeln IN s_vbeln AND
audat IN s_audat.
IF sy-subrc <> 0.
MESSAGE e003 WITH text-003.
ENDIF.
CLEAR wa_fieldcatalog1 .
REFRESH it_fieldcatalog1 .
*&-POPULATING THE FIELD VBELN
wa_fieldcatalog1-col_pos = 1. "position of the column
wa_fieldcatalog1-fieldname = 'VBELN'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-hotspot = 'X'.
wa_fieldcatalog1-outputlen = 10. "output length of the field.
wa_fieldcatalog1-seltext = 'SD ORDER NUMBER'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD ERNAM
wa_fieldcatalog1-col_pos = 2. "position of the column
wa_fieldcatalog1-fieldname = 'ERNAM'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 12. "output length of the field.
wa_fieldcatalog1-seltext = 'NAME OF THE PERSON WHO CREATED'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD AUDAT
wa_fieldcatalog1-col_pos = 3. "position of the column
wa_fieldcatalog1-fieldname = 'AUDAT'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 8. "output length of the field.
wa_fieldcatalog1-seltext = 'DOCUMENT DATE'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD VBTYP
wa_fieldcatalog1-col_pos = 4. "position of the column
wa_fieldcatalog1-fieldname = 'VBTYP'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 1. "output length of the field.
wa_fieldcatalog1-seltext = 'DOCUMENT CATEGORY'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD AUART
wa_fieldcatalog1-col_pos = 5. "position of the column
wa_fieldcatalog1-fieldname = 'AUART'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 4. "output length of the field.
wa_fieldcatalog1-seltext = 'TYPE OF THE ORDER'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD NETWR
wa_fieldcatalog1-col_pos = 6. "position of the column
wa_fieldcatalog1-fieldname = 'NETWR'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 15. "output length of the field.
wa_fieldcatalog1-seltext = 'NET VALUE'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD WAERK
wa_fieldcatalog1-col_pos = 7. "position of the column
wa_fieldcatalog1-fieldname = 'WAERK'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 5. "output length of the field.
wa_fieldcatalog1-seltext = 'DOCUMENT CURRENCY'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD VKORG
wa_fieldcatalog1-col_pos = 8. "position of the column
wa_fieldcatalog1-fieldname = 'VKORG'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 4. "output length of the field.
wa_fieldcatalog1-seltext = 'SALES ORG'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD VTWEG
wa_fieldcatalog1-col_pos = 9. "position of the column
wa_fieldcatalog1-fieldname = 'VTWEG'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 2. "output length of the field.
wa_fieldcatalog1-seltext = 'DISTRIBUTION CHANEL'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
*&-POPULATING THE FIELD SPART
wa_fieldcatalog1-col_pos = 10. "position of the column
wa_fieldcatalog1-fieldname = 'SPART'. "field name
wa_fieldcatalog1-tabname = 'IT_VBAK'. "INTERNAL table name
wa_fieldcatalog1-ref_table = 'VBAK'. "FOR REFERENCE
wa_fieldcatalog1-outputlen = 2. "output length of the field.
wa_fieldcatalog1-seltext = 'DIVISION'.
"long key word
APPEND wa_fieldcatalog1 TO it_fieldcatalog1.
CLEAR wa_fieldcatalog1.
CREATE OBJECT cc1
EXPORTING
PARENT =
container_name = 'CUSTOMCONTROL1'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT alv1
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = cc1
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
I_FCAT_COMPLETE = SPACE
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT event_handler.
*&---set handler for hot spot click
SET HANDLER: event_handler->handle_hotspot_click FOR alv1,
*&---set handler for top of page
event_handler->handle_top_of_page for alv1.
<b>LS_PRINT-RESERVELNS = '3'.</b>
CALL METHOD alv1->set_table_for_first_display
<b> EXPORTING</b>
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT =
<b>IS_PRINT = ls_print</b>
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
it_outtab = it_vbak
it_fieldcatalog = it_fieldcatalog1
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*&--for hot spot click
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = alv1.
*&--for top of page
CALL METHOD alv1->list_processing_events
EXPORTING
i_event_name = 'TOP_OF_PAGE'
I_DYNDOC_ID = o_dd_doc
IS_SUBTOTTXT_INFO =
IP_SUBTOT_LINE =
I_TABLE_INDEX =
CHANGING
C_SUBTOTTXT =
CALL SCREEN 0101.
*& Module STATUS_0101 OUTPUT
text
MODULE status_0101 OUTPUT.
SET PF-STATUS 'Z9D_MENU1_ALV'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0101 OUTPUT
*& Module USER_COMMAND_0101 INPUT
text
MODULE user_command_0101 INPUT.
CASE ok_code_0101.
WHEN 'BCK1'.
LEAVE PROGRAM.
ENDCASE.
i have made the changes and bolded the changes in ur program. pls check .
note: u can see the top of page only in print preview.

Similar Messages

  • I am unable to view videos in youtube using mozilla plz help

    I am unable to view videos in youtube using mozilla plz help
    duplicate of [/questions/1009851]
    edit: for some reason this user shows as deactivated which I did not do.

    Are you still able to view flash videos and games from other sites?
    If so and are from India then youtube videos among many other sites were blocked. https://support.mozilla.org/en-US/forums/contributors/710463

  • Header in ALV using Oops

    I need to display Table header in ALV using Oops.
    I need to data from 8 fields which I get in the run time of the program.
    I am new to Oops ALV, I have done a similar thing in normal ALV but not in oops.
    Detailed info required, Custom container settings as well.
    Thanks in Advance

    see this weblog TOP_OF_PAGE in ALV  Using CL_GUI_ALV_GRID

  • How to get Subtotal text in ALV using OOPS

    hi,
    Can any one pls help me out getting  <b>subtotals text</b> in ALV using OOPS concepts....Pls provide me if any of u have  sample code for that......
    my code:
    data:gr_grid_d0100 type ref to cl_gui_alv_grid.
    data : gr_events_d0100   type ref to lcl_events_d0100.
    classes**********
    class lcl_events_d0100 definition.
      public section.
        methods:
    subtotal_text for event subtotal_text
                        of cl_gui_alv_grid
                        importing es_subtottxt_info
                        ep_subtot_line
                        e_event_data.
    endclass.
    class lcl_events_d0100 implementation.
    method subtotal_text.
        perform d0100_event_subtotal_text using       es_subtottxt_info
    ep_subtot_line
    e_event_data.
      endmethod.                    "subtotal_text
    endclass.
    data : gr_event_handler type ref to lcl_events_d0100.
    SET HANDLER gr_event_handler->subtotal_text FOR wcl_alv_grid_request
    FORM d0100_event_subtotal_text USING
          es_subtottxt_info TYPE LVC_S_STXT
          ep_subtot_line TYPE REF TO data
          e_event_data TYPE REF TO cl_alv_event_data.
      DATA: l_text TYPE string.
      l_text = es_subtottxt_info.
      FIELD-SYMBOLS: <fs> TYPE ANY.
      ASSIGN e_event_data->m_data->* TO <fs>.
                            <fs> = text-007.

    hi vijay
    check this code
    if you want to use field symbols.
    data: total type ref to data,
    subtotal1 type ref to data.
    field-symbols <total> like gt_sflight.
    field-symbols <subtotal1> like gt_sflight.
    call method grid1->get_subtotals
    importing
    ep_collect00 = total
    ep_collect01 = subtotal1.
    assign total->* to <total>.
    assign subtotal1->* to <subtotal1>.
    or u can use
    U have to do the subtotal column wise.In the field catalog specify the following in addition to the corresponding field name(i.e. Column)
    DATA ls_fcat TYPE lvc_s_fcat.
    ls_fcat-do_sum = 'X'.
    Hope this helps u out.
    Thanks & Regards,
    naveen

  • Anyone unable to print from Mac Pro using lion 10.7.2 to HP LaserJet M1319f mfp

    I'm unable to print from Mac Pro using lion 10.7.2 to HP LaserJet M1319f mfp. The HP website says that the HP LaserJet M1319F MFP is compatible with Lion 10.7.2.  Every time I try to perform a Test print I get an Error msg.  I'm using driver version 1.3.0.261

    https://discussions.apple.com/message/23765195#23765195

  • END-OF-PAGE in ALV using OOPS

    Hello ,
    Can anyone let me know how to trigger the END-of-page event in ALV using OOPs.
    Thanks in advance.
    Regards
    Jai

    Hello Pratuysh,
    Thanks for the answer
    I know that report,but that doesn't help me.
    Any other way
    Thanks
    Jai

  • Since I downloaded Adobe Reader 11.0.07 I have been totally unable to print any PDF files using my Dell 1720 laser printer - I just get a blinking "error" light on the printer, no other error messages . I never had a problem printing PDF files before down

    Since I downloaded Adobe Reader 11.0.07 I have been totally unable to print any PDF files using my Dell 1720 laser printer - I just get a blinking "error" light on the printer, no other error messages . I never had a problem printing PDF files before downloading the new Reader version. Suggestions? Thank you.

    Hi,
    Which version of Adobe Reader were you using earlier when printing using Dell printed was working fine?
    Thanks,
    Shakti K

  • HI   ALV USING OOPS CONCEPT

    hi
    i would like to have coding for total and subtotal in alv using oops concept and (not using function module).
    also i would like to have coding for cell color and heading and footer.
    thanx in adv
    rocky

    Hi Rocky,
    please check this link
    http://www.****************/Tutorials/ALV/Total/text.htm
    While modifying field catalog , try the following.
    Field-symbols: <lfs_fieldcat> TYPE lvc_s_fcat.
    LOOP AT i_fieldcat ASSIGNING <lfs_fieldcat>.
    CASE <lfs_fieldcat>-fieldname.
    WHEN 'LOSGR'.
    <lfs_fieldcat>-coltext = text-007.
    <lfs_fieldcat>-do_sum = c_x.
    ENDCASE.
    ENDLOOP.
    Or if you want to use field symbols.
    data: total type ref to data,
    subtotal1 type ref to data.
    field-symbols <total> like gt_sflight.
    field-symbols <subtotal1> like gt_sflight.
    call method grid1->get_subtotals
    importing
    ep_collect00 = total
    ep_collect01 = subtotal1.
    assign total->* to <total>.
    assign subtotal1->* to <subtotal1>.
    Best regards,
    raam

  • Detect rows selection in ALV using oops

    Hi ALL,
    I HAVE An ALV OUTPUT OF RECORDS USING OOPS.
    NOW I CAN SELECT ONE OR MULTIPLE ROWS OF THE OUTPUT AND I HAVE ADDED A DELETE ICON TO MY TOOL BAR.
    I HAVE BACK AND EXIT BUTTON AND I HAVE CODE FOR THE SAME IN PAI.
    FOR DELETE ICON SY-UCOMM IS DELE AND CONTROL COMES TO PAI
    MY QUESTION IS HOW DO YOU KNOW WHICH ROW OR ROWS ARE SELETEd , IN NORMAL ABAP , a field BOX type c has a value X , but what about in ALV using OOPS.
    I have no idea whether my approach is correct or wrong or do i need to something else.
    Thanks

    Hi Darren,
    This is what i have . Iam new oops so i want to just make sure
    method handle_user_command.
    § 3.In event handler method for event USER_COMMAND: Query your
      function codes defined in step 2 and react accordingly.
        data: lt_rows type lvc_t_row.
        case e_ucomm.
          when 'DELETE'.
            call method g_grid->get_selected_rows
                     importing et_index_rows = lt_rows.
    DATA : WA_LT_ROWS LIKE LINE OF LT_ROWS.
    LOOP AT LT_ROWS INTO WA_LT_ROWS.
    DELETE I_ZFINAL INDEX WA_LT_ROWS-INDEX.
    ENDLOOP.
    ENDCASE.
    call method g_grid->set_table_for_first_display
    exporting
       I_BYPASSING_BUFFER            =
       I_BUFFER_ACTIVE               =
       I_CONSISTENCY_CHECK           =
       I_STRUCTURE_NAME              =
       IS_VARIANT                    =
       I_SAVE                        =
       I_DEFAULT                     = 'X'
         is_layout                     = g_layout
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
        it_toolbar_excluding          = pt_exclude
       IT_HYPERLINK                  =
       IT_ALV_GRAPHICS               =
      changing
        it_outtab                     =  i_zFINAL
        it_fieldcatalog               = fieldcat
       IT_SORT                       =
       IT_FILTER                     =
      exceptions
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        others                        = 4
    LET ME KNOW THANKS

  • I want to add an application like winrar useing rar file so i can auto download it all thet i have is a zip fill but i want a rar file too the option to auto download it is gray so i cant use it plz help me.

    i want to add an application like winrar useing rar file so i can auto download it all thet i have is a zip fill but i want a rar file too the option to auto download it is gray so i cant use it plz help me.
    == This happened ==
    Every time Firefox opened
    == all the time

    Here is the answer: Not an add on or plug-in! In fact you can get rid of all those useless plugins and add-ons! Go and get it. Im using the Alpha version right now and it works great. Works better then anything else .......add multiple links for all files sit back and relax. Its all done for you with no more intervention on your part! Check it out!
    http://wordrider.net/freerapid/
    Only one downside to this. No proper installer. You will have to copy the files to your respective programs folder.
    C:\Program Files\FreeRapid or C:\Program Files (x86)\FreeRapid
    Then create shortcuts to your desktop from FRD app. Thats it then start downloading!
    By the way this not an add. I just spent the whole night looking for the solution to this problem because I was so frustrated with the whole thing. I download tons of files and I have lots of other projects going and I dont have time for all this nonsense with RapidShare and Firefox. Hope this helps some other poor souls out there!

  • I buy my ipod touch like 6 months ago it was working very well but yesterday it is not connecting to the internet when i am connect to my internet it said unable to connect can you please tell me plz help me

    i buy my ipod touch like 6 months ago it was working very well but yesterday it is not connecting to the internet when i am connect to my internet it said unable to connect can you please tell me plz help me

    Do other devices successfully connect to the router?
    Does the iPod successfully connect to other networks/routers?
    Does the iPod show wifi bands in the upper left?
    Try:
    - Resetting the iPod:
    Reset iPod touch:  Press and hold the On/Off Sleep/Wake button and the Home
    button at the same time for at least ten seconds, until the Apple logo appears.
    - Powering off and then back on the router
    - Resetting networksettings: Settings>General>Reset>Reet Network Setting
    - The troubleshooting here
    iPhone and iPod touch: Troubleshooting Wi-Fi networks and connections

  • How to print text on container using oop on alv list

    Hello Guru's,
             pl guide me how to print text on container using alv list-display which have interactive events  using     oop classes/methods ...
                    I want to print hard coded text on coantainer , on double clicking it will call another screen.
    Pl Help..
    Message was edited by:
            paresh sonavane

    Hi Paresh,
           1.      Go to the Layout and Create One custom container box and give name it.
            2. Custom Container is the one type of tool and its used for Displaying the Reports 
                with the use of ABAP Objects.
            3. Go to se38 and Write The Following Code.
    tables ZTEAM_GD.
    DATA : OBJ TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
           OBJ1 TYPE REF TO CL_GUI_ALV_GRID.
    DATA IT_TEAM LIKE TABLE OF ZPLAYER_BAT_DET       .
    SELECT * FROM ZPLAYER_BAT_DET INTO TABLE IT_TEAM.
    CREATE OBJECT OBJ
      EXPORTING
        CONTAINER_NAME              = 'ALV'.          -
    > Give ur Container Name
    CREATE OBJECT OBJ1
      EXPORTING
        I_PARENT          = OBJ.
    CALL METHOD OBJ1->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
        I_STRUCTURE_NAME              = 'ZPLAYER_BAT_DET'
      CHANGING
        IT_OUTTAB                     = IT_TEAM.
    *CALL METHOD OBJ1->SET_DROP_DOWN_TABLE
    EXPORTING
       I_STRUCTURE_NAME = 'ZTEAM_GD'
    CHANGING
       IT_OUTTAB        = IT_TEAM.
    CALL SCREEN 9000.
    *&      Module  USER_COMMAND_9000  INPUT
          text
    MODULE USER_COMMAND_9000 INPUT.
    CASE SY-UCOMM.
    WHEN 'EXT'.
      LEAVE PROGRAM.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_9000  INPU     
    Thanks.
    Reward If Helpful.

  • ALV using OOPS class CL_GUI_ALV_GRID, call method SET_TABLE_FOR_FIRST_DISPL

    I NEVER USED OOPS CONCEPT.BUT I GOT A TASK ON ALV REPORT USING class CL_GUI_ALV_GRID, call method SET_TABLE_FOR_FIRST_DISPLAY for ALV . I HAD PASSED THE VALUES FROM INTERNAL TABLE AND GOT OUTPUT IN ALV.
    The problem is When i save an layout(default setting button ).
    iam unable to get the output for all fields.
    if u want i will send screenshots to ur mail
    THANKS IN ADVANCE.

    ok fine,
    In the output (alv grid) there is an icon for layout settings.
    if i want to save layout (as DEFAULT SETTING) i am missing some fields in output
    EX:
    mat no | batch  | proces order | time  |  date |
    when i save layout (as DEFAULT SETTING) i am missing some fields in output
    mat no | batch  |
    the rest of the field were not displayed.
    if u are not clear just ask me. i will send some more examples.

  • Interactive ALV using OOPs

    Hi,
    I want create an ALV report in which when i will double click on record will drill down the report.
    I know interactive ALV report using function module. but now i want to create it using OOPs concept. Please guidme
    thanks and regrds
    abhishek

    methods: double_click for event double_click of cl_gui_alv_grid
                                                     importing e_row e_column es_row_no
    method double_click.
       message s400(00) with 'documents' e_row.                "#EC *
        data : wa_display like line of lt_display.
        if e_column = 'BELNR'.
          read table lt_display index e_row into wa_display.
          if sy-subrc = 0.
            set parameter id 'BLN' field wa_display-belnr.
            set parameter id 'BUK' field wa_display-bukrs.
            set parameter id 'GJR' field wa_display-gjahr.
            call transaction 'FB03' and skip first screen.
          endif.
        endif.
    endmethod.
    see this may help u.
    Regards

  • Hierarchial ALV using OOP

    Hi Friends,
    I have created a Hierarchial ALV report using OOP concept (Class Builder). The output is OK but it is displaying the unwanted columns in the header part.
    The code written is as follows.
    =====================================================
    data: gt_zsd_abcd      type zsd_abcd  occurs 0,      "Output-Table
    data l_hierarchy_header type treev_hhdr.
      perform build_hierarchy_header changing l_hierarchy_header.
      call method g_alv_tree->set_table_for_first_display
        exporting
          i_structure_name    = 'zsd_abcd'
          is_hierarchy_header = l_hierarchy_header
        changing
          it_outtab           = gt_zsd_abcd. "table must be empty !
      perform create_hierarchy.
      call method g_alv_tree->frontend_update.
    =====================================================
    I would like know as to how to display only the required columns in the header part.
    Pls guide me.
    TIA.
    Regards,
    Mark K

    Hi Mark,
    i got it, in your case you will get all the fields present in the structure you mentioned in the method.
    so if you want only Purchase Order then you need to Build the fieldcat only for that field and then pass that fieldcat to the method. and don't pass the structure in this case.
      call method alv_tree_control->set_table_for_first_display
       exporting
                 is_variant           = l_variant
                 i_save               = 'A'
                 i_default            = 'X'
                 is_hierarchy_header  = l_hierarchy_header
                 it_special_groups    = l_special_groups
                 it_toolbar_excluding = l_toolbar_excluding
       changing
              <b>it_fieldcatalog      = l_field_catalog</b>
                 it_outtab            = l_output_tbl.
    Regards
    vijay

Maybe you are looking for

  • Mini DVI - DVI adaptor

    This may be a stupid question but... I have to do a presentation and need to connect my MacBook to an external monitor for the first time. I was told that they have a fifteen pin video cable to plug into my computer. Is a Mini DVI - DVI adaptor what

  • Varinat configuration

    Variant Configuration Variant configuration is for manufacturing complex products in which customer determines the features of the product. Objective of variant configuration is to react quickly to customers' requirements.      Here it needs not to c

  • Does anyone know how to get a hold of someone in charge of QA

       Customer support is dire! I have spent long hours dealing with costumers service <whose only modes of help are sending me out to buy something new or provide me with a hyperlink to help page that was two clicks away anyway> Between thier lack of k

  • SQL Loader and Java

    Hi, I am using a Java Stored Procedure to invoke a SQL Loader process. The RDBMS Version is 8.1.7 on HP-UX 11. I invoke the procedure by calling: exec runcommand('sqlldr user=scott/tiger@orcl control=/home/mydir/ctlfile.ctl log=/home/mydir/logfile.lo

  • Help please deploying Crystal Decisions 10 to Microsoft 2008 R2 IIS 7

    Folks, I need your help please. We've been using Crystal Decisions 10 with MS Server 2003. We're migrating to a VM envirionment with MS Server 2008 R2. I have everything working except for our crystal reports. We are a mostly an ASP Classic enviromen