Skip to Content
author's profile photo Former Member
Former Member

how to get top of page & end of page in secondary report

Hey,

I am getting problem to add top of page & end of page code in secondary form in interactive reports. I want to display data in top of page & end of page in the secondary forms. How can i do it.

Thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 20, 2007 at 07:02 AM

    Hi

    http://sap.niraj.tripod.com/id33.html

    Regards

    Subramanian

    Message was edited by:

    Subramanian PL

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 20, 2007 at 07:04 AM

    Hi,

    see below code,

    REPORT  z_alv_so  MESSAGE-ID z7new .
    
    ************************************************************************
    *TABLE DECLARATION*
    ************************************************************************
    TABLES: vbak ,             "Sales Document: Header Data
            vbap ,             "Sales Document: Item Data
            makt ,             "Material Descriptions
            lips .             "SD document: Delivery: Item data
    ************************************************************************
    *DECLARATION OF TYPE-POOL*
    *THIS TYPE-POOL CONTAINS THE EVENTS,
    ************************************************************************
    TYPE-POOLS : slis.
    ************************************************************************
    *DECLARATION OF EVENTS*
    ************************************************************************
    DATA: i_event TYPE slis_t_event.
    DATA: t_event TYPE slis_alv_event.
    ************************************************************************
    *DECLARATION OF LIST HEADER*
    ************************************************************************
    DATA: i_listheader TYPE slis_t_listheader.
    ************************************************************************
    *DECLARATION OF FIELD CATALOG FOR SCREEN 1*
    ************************************************************************
    DATA: i_fldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    ************************************************************************
    *DECLARATION OF FIELD CATALOG FOR SCREEN 2*
    ************************************************************************
    DATA: i_fldcat2 TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    ************************************************************************
    *DECLARATION OF FIELD LAYOUT*
    ************************************************************************
    DATA: i_layout TYPE slis_layout_alv.
    ************************************************************************
    *SORTING OF OUTPUT*
    ************************************************************************
    DATA: i_sort TYPE slis_t_sortinfo_alv.
    ************************************************************************
    *DATA DECLARATION
    ************************************************************************
    DATA: v_auart TYPE tvak-auart,
          v_vkorg TYPE tvko-vkorg,
          v_kunnr TYPE kna1-kunnr,
          v_matnr TYPE mara-matnr ,
          v_spart TYPE tvta-spart .
    
    TYPES: BEGIN OF it_so ,
    
           vbeln TYPE vbeln_va ,          "SALES ORDER NO.
           auart TYPE auart ,             "SALES DOC. TYPE
           vkorg TYPE vkorg ,             "SALES ORG.
           spart TYPE spart ,             "DIVISION
           kunnr TYPE kunag ,             "SOLD TO PARTY
           posnr TYPE posnr_va ,          "SALES DOC. ITEM
           matnr TYPE matnr ,             "MATERIAL NO
           maktx TYPE maktx ,             "DESCRIPTION
           kwmeng TYPE kwmeng ,           "QUANTITY
           vrkme TYPE vrkme ,             "SALES UNIT
           line_color(4) TYPE c ,
    
           END OF it_so .
    
    TYPES: BEGIN OF it_del ,
    
           vbeln TYPE vbeln_vl ,         "SALES ORDER NO.
           posnr TYPE posnr_vl ,         "SALES DOC. ITEM
           matnr TYPE matnr ,            "MATERIAL NO
           werks TYPE werks_d ,          "PLANT
           lgort TYPE lgort_d ,          "STORAGE LOCATION
           charg TYPE charg_d ,          "BATCH NO.
           lfimg TYPE lfimg ,            "ACTUAL DELIVERY QTY.
           vrkme TYPE vrkme ,            "SALES UNIT
    
           END OF it_del .
    
    TYPES: BEGIN OF type_vbfa ,
    
          vbelv TYPE vbeln_von , "Preceding sales and distribution document
          posnv TYPE posnr_von , "Preceding item of an SD document
          vbeln TYPE vbeln_nach, "Subsequent sales and distribution document
          posnn TYPE posnr_nach, "Document category of subsequent document
          vbtyp_n TYPE vbtyp_n ,
    
          END OF type_vbfa .
    
    DATA: it_so1 TYPE STANDARD TABLE OF it_so ,
          it_del1 TYPE STANDARD TABLE OF it_del ,
          it_vbfa TYPE STANDARD TABLE OF type_vbfa,
          it_del_ful TYPE STANDARD TABLE OF it_del.
    
    DATA: wa_so TYPE it_so ,
          wa_del TYPE it_del ,
          wa_vbfa TYPE type_vbfa,
          wa_it_del_ful TYPE it_del.
    
    DATA:  i_title_vbfa TYPE lvc_title VALUE 'SALES ORDER LIST DISPLAYED'.
    DATA:  i_title_vbpa TYPE lvc_title VALUE
    'DELIVERY DETAILS DISPLAYED AGAINST GIVEN SALES ORDER'.
    
    
    ************************************************************************
    *SELECTION SCREEN                                                      *
    ************************************************************************
    
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-004 .
    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln ,
                    s_auart FOR v_auart ,
                    s_vkorg FOR v_vkorg ,
                    s_spart FOR v_spart ,
                    s_kunnr FOR v_kunnr ,
                    s_matnr FOR v_matnr .
    SELECTION-SCREEN END OF BLOCK blk1 .
    
    ************************************************************************
    *AT SELECTION SCREEN                                                   *
    ************************************************************************
    AT SELECTION-SCREEN.
    
      SELECT SINGLE vbeln
                     FROM vbak INTO vbak-vbeln
                     WHERE vbeln IN s_vbeln.
    
      IF sy-subrc <> 0.
        MESSAGE e202.
      ENDIF.
    ************************************************************************
    *START OF SELECTION                                                    *
    ************************************************************************
    START-OF-SELECTION .
    
      PERFORM data_select.
      PERFORM t_sort USING i_sort .
      PERFORM event_cat USING i_event .
      PERFORM fld_cat USING i_fldcat[] .
      PERFORM t_layout USING i_layout .
      PERFORM fld_cat2 USING i_fldcat2[] .
      PERFORM call_alv.
    ************************************************************************
    * DATA SELECT                                                          *
    ************************************************************************
    
    *&---------------------------------------------------------------------*
    *&      Form  DATA_SELECT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *  -->  p1        text
    *  <--  p2        text
    *----------------------------------------------------------------------*
    FORM data_select .
    
      REFRESH: it_vbfa, it_so1, it_del_ful ,it_del1 .
      BREAK-POINT.
      SELECT
            a~vbeln
            a~auart
            a~vkorg
            a~spart
            a~kunnr
            b~posnr
            b~matnr
            c~maktx
            b~kwmeng
            b~vrkme
            INTO TABLE it_so1 FROM vbak AS a
                  JOIN vbap AS b ON b~vbeln = a~vbeln
                  JOIN makt AS c ON c~matnr = b~matnr
                  AND c~spras = sy-langu
                  WHERE a~vbeln IN s_vbeln .
    
    ************************************************************************
    * COLURING DISPLAY                                                     *
    ************************************************************************
    
      DATA: ld_color(1) TYPE  c .
      LOOP AT it_so1 INTO wa_so.
    * Populate color variable with colour properties
    * Char 1 = C (This is a color property)
    * Char 2 = 3 (Color codes: 1 - 7)
    * Char 3 = Intensified on/off ( 1 or 0 )
    * Char 4 = Inverse display on/off ( 1 or 0 )
    *           i.e. wa_ekko-line_color = 'C410'
        ld_color = ld_color + 1.
    
    * Only 7 colours so need to reset color value
        IF ld_color = 8.
          ld_color = 1.
        ENDIF.
        CONCATENATE 'C' ld_color '10' INTO wa_so-line_color.
    *  wa_ekko-line_color = 'C410'.
        MODIFY it_so1 FROM wa_so.
      ENDLOOP .
    
      IF sy-subrc = 0.
    
        SELECT vbelv
               posnv
               vbeln
               posnn
               vbtyp_n
               INTO TABLE it_vbfa
               FROM vbfa
               FOR ALL ENTRIES IN it_so1
               WHERE vbelv = it_so1-vbeln
               AND   posnn = it_so1-posnr
               AND vbtyp_n ='J' .
    
        IF sy-subrc = 0.
    
          SELECT vbeln
                 posnr
                 matnr
                 werks
                 lgort
                 charg
                 lfimg
                 vrkme
                 FROM lips INTO TABLE it_del_ful
                 FOR ALL ENTRIES IN it_vbfa
                 WHERE vbeln = it_vbfa-vbeln
                 AND   posnr = it_vbfa-posnn.
    
        ENDIF.
    
      ENDIF.
    
    ENDFORM.                    " DATA_SELECT
    
    ***********************************************************************
    **************** EVENT CATALOG ****************************************
    ***********************************************************************
    
    *&---------------------------------------------------------------------*
    *&      Form  EVENT_CAT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->P_I_EVENT  text
    *----------------------------------------------------------------------*
    
    FORM event_cat  USING    p_i_event TYPE slis_t_event .
    
      REFRESH p_i_event .
    
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    * EXPORTING
    *   I_LIST_TYPE           = 0
       IMPORTING
          et_events             = p_i_event
    * EXCEPTIONS
    *   LIST_TYPE_WRONG       = 1
    *   OTHERS                = 2
                .
    *  IF sy-subrc <> 0.
    ** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    **         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *  ENDIF.
    
      READ TABLE p_i_event WITH KEY name = slis_ev_top_of_page INTO t_event.
    
      IF sy-subrc = 0.
    
        MOVE 'TOP_OF_PAGE' TO t_event-form.
        MODIFY p_i_event FROM t_event INDEX sy-tabix TRANSPORTING form.
    
      ENDIF.
    
      CLEAR t_event .
    
    ENDFORM.                    " EVENT_CAT
    
    
    **********************************************************************
    **********FORM FOR EVENT TOP_OF_PAGE**********************************
    **********************************************************************
    
    FORM top_of_page .
    
      REFRESH i_listheader.
      DATA: t_header TYPE slis_listheader.
      DATA: v_text(50).
    
      WRITE sy-datum TO v_text.
      CLEAR t_header.
      t_header-typ = 'S'.
      t_header-key = 'Date'.
      t_header-info = v_text.
      APPEND t_header TO i_listheader.
    
      CLEAR t_header.
      CLEAR v_text.
    
    *  WRITE:  'SALES ORDER REPORT  ' TO v_text .
    
    *  t_header-typ = 'S'.
    *  t_header-key = 'TITLE'.
    *  t_header-info = v_text.
    *  APPEND t_header TO i_listheader.
    
    
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = i_listheader.
    *      I_LOGO             = 'ALV_BACKGROUND'.
    *   I_END_OF_LIST_GRID       =
    
    ENDFORM.                    "TOP_OF_PAGE
    
    ************************************************************************
    ********  FIRST ALV GRID DISPLAY ***************************************
    ************************************************************************
    
    *&---------------------------------------------------------------------*
    *&      Form  CALL_ALV
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *  -->  p1        text
    *  <--  p2        text
    *----------------------------------------------------------------------*
    
    FORM call_alv .
    
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    
       EXPORTING
         i_callback_program                = sy-repid
    *    I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'
         i_callback_user_command           = 'USER_COMMAND1'
         i_callback_top_of_page            = 'TOP_OF_PAGE'
         I_BACKGROUND_ID                   = 'ALV_BACKGROUND'
         i_grid_title                      = i_title_vbfa
         is_layout                         = i_layout
         it_fieldcat                       = i_fldcat[]
         it_sort                           = i_sort
         it_events                         = i_event
        TABLES
         t_outtab                          = it_so1
                .
    *  IF sy-subrc <> 0.
    ** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    **         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *  ENDIF.
    
    ENDFORM.                    " CALL_ALV
    ***********************************************************************
    ************** FIRST FIELDCATALOG *************************************
    ***********************************************************************
    *&---------------------------------------------------------------------*
    *&      Form  FLD_CAT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->P_I_FLDCAT[]  text
    *----------------------------------------------------------------------*
    
    FORM fld_cat  USING    p_i_fldcat TYPE slis_t_fieldcat_alv.
    
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'VBELN'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'."TABLE NAME
      i_fldcat-seltext_m   = 'SALES ORDER NO.'.
      i_fldcat-col_pos     = 1.        " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-just(1)     = 'C'.
    
      APPEND i_fldcat.
    
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'AUART'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'."TABLE NAME
      i_fldcat-seltext_m   = 'SALES DOC. TYPE'.
      i_fldcat-col_pos     = 2.        " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 15.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-just(1)     = 'C'.
    
      APPEND i_fldcat.
    
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'VKORG'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'.
      i_fldcat-seltext_m   = 'SALES ORG.'.
      i_fldcat-col_pos     = 3.        " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 12.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-just(1)     = 'C'.
      APPEND i_fldcat.
    
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'SPART'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'.
      i_fldcat-seltext_m   = 'DIVISION'.
      i_fldcat-col_pos     = 4.        " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 10.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-just(1)     = 'C'.
      APPEND i_fldcat.
    
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'KUNNR'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'.
      i_fldcat-seltext_m   = 'SOLD TO PARTY'.
      i_fldcat-col_pos     = 5.        " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 15.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-just(1)     = 'C'.
      APPEND i_fldcat.
    
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'POSNR'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'.
      i_fldcat-seltext_m   = 'SALES DOC. ITEM'.
      i_fldcat-col_pos     = 6.        " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 17.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-just(1)     = 'C'.
      APPEND i_fldcat.
    
      CLEAR i_fldcat.
    
      i_fldcat-fieldname   = 'MATNR'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'.
      i_fldcat-seltext_m   = 'MATERIAL NO.'.
      i_fldcat-col_pos     = 7.        " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-just(1)     = 'C'.
      APPEND i_fldcat.
    
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'MAKTX'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'.
      i_fldcat-seltext_m   = 'DESCRIPTION'.
      i_fldcat-col_pos     = 8.        " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-just(1)     = 'C'.
      APPEND i_fldcat.
    
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'KWMENG'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'.
      i_fldcat-seltext_m   = 'QUANTITY'.
      i_fldcat-col_pos     = 9.        " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 15.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-do_sum    = 'X'.        " For doing "SUM"
      i_fldcat-just(1)     = 'C'.
      APPEND i_fldcat.
    
      CLEAR i_fldcat.
      i_fldcat-fieldname   = 'VRKME'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat-tabname     = 'IT_SO1'.
      i_fldcat-seltext_m   = 'SALES UNIT'.
      i_fldcat-col_pos     = 10.       " POSITION OF THE COLUMN.
      i_fldcat-outputlen   = 10.       " SET THE OUTPUT LENGTH.
      i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat-just(1)     = 'C'.
      APPEND i_fldcat.
    
    ENDFORM.                    " FLD_CAT
    
    ***********************************************************************
    ****************** ALV SORTING  ***************************************
    ***********************************************************************
    *&---------------------------------------------------------------------*
    *&      Form  SORT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->P_I_SORT  text
    *----------------------------------------------------------------------*
    
    FORM t_sort  USING    p_i_sort TYPE slis_t_sortinfo_alv .
    
      DATA: i_sort TYPE slis_sortinfo_alv .
      REFRESH p_i_sort .
    
      CLEAR i_sort.
      i_sort-spos = 1.
      i_sort-tabname = 'IT_SO1'.
      i_sort-fieldname = 'VBELN'.
      i_sort-up = 'X'.
      i_sort-subtot = 'X'.
      i_sort-group = '*'.
      APPEND i_sort TO p_i_sort.
    
    ENDFORM.                    " SORT
    
    *FORM SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
    *  SET PF-STATUS 'ZSTANDARD'.
    *ENDFORM. "Set_pf_status
    
    ***********************************************************************
    ***********FORM FOR EVENT USER_COMMAND1********************************
    ***********************************************************************
    
    FORM user_command1 USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
    
    *CASE R_UCOMM .
    *    WHEN '&IC1' .
    *
    *    IF rs_selfield-FIELDNAME = 'VBELN' .
    *
    *    ENDIF .
    *
    * WHEN OTHERS .
    *
    * ENDCASE .
    
      CLEAR wa_so.
    
      REFRESH: it_del1 .
    
      IF r_ucomm = '&IC1' AND rs_selfield-fieldname = 'VBELN' AND
      rs_selfield-value IS NOT INITIAL.
    
        READ TABLE it_so1 INTO wa_so INDEX rs_selfield-tabindex.
    
        IF sy-subrc = 0.
    
          LOOP AT it_vbfa INTO wa_vbfa WHERE vbelv = wa_so-vbeln
                                       AND   posnv = wa_so-posnr.
            READ TABLE it_del_ful INTO wa_it_del_ful
                 WITH KEY vbeln = wa_vbfa-vbelv
                          posnr = wa_vbfa-posnn.
    
            IF sy-subrc = 0.
    
              CLEAR wa_del.
              MOVE wa_it_del_ful TO wa_del.
              APPEND wa_del TO it_del1.
    
            ENDIF.
    
          ENDLOOP.
        ENDIF.
      ENDIF.
    
    *********************************************************************
    ********* SECOND ALV GRID DISPLAY ***********************************
    *********************************************************************
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    
       EXPORTING
        i_callback_program                = sy-repid
    *   I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'
        i_callback_user_command           = 'USER_COMMAND2'
        i_callback_top_of_page            = 'TOP_OF_PAGE'
        I_BACKGROUND_ID                   = 'ALV_BACKGROUND'
         i_grid_title                      = i_title_vbpa
        it_fieldcat                       = i_fldcat2[]
        it_sort                           = i_sort
        TABLES
        t_outtab                          = it_del_ful
                .
    *  IF sy-subrc <> 0.
    ** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    **         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *  ENDIF.
    
    ENDFORM .                    "USER_COMMAND1
    ***********************************************************************
    ********** FORM FOR EVENT USER_COMMAND 2 ******************************
    ***********************************************************************
    
    FORM user_command2 USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
    
      CLEAR wa_so.
    
      REFRESH: it_del1 .
    
      IF r_ucomm = '&IC1' AND rs_selfield-fieldname = 'VBELN' AND
      rs_selfield-value IS NOT INITIAL.
    
        READ TABLE it_so1 INTO wa_so INDEX rs_selfield-tabindex.
    
    *    IF SY-SUBRC = 0.
    *
    *       LOOP AT it_vbfa INTO wa_vbfa WHERE vbelv = WA_SO-vbeln
    *                                    AND   posnv = WA_SO-posnr.
        READ TABLE it_del_ful INTO wa_it_del_ful
             WITH KEY vbeln = rs_selfield-value
                      posnr = wa_vbfa-posnn.
    
        IF rs_selfield-fieldname = 'VBELN'.
    
          SET PARAMETER ID 'VL' FIELD wa_vbfa-vbeln .
          CALL TRANSACTION 'VL03' AND SKIP FIRST SCREEN.
    
        ENDIF .
    
    *       ENDLOOP.
    *    ENDIF.
      ENDIF.
    ENDFORM .                    "USER_COMMAND2
    
    ************************************************************************
    ********* SECOND FIELDCATALOG ******************************************
    ************************************************************************
    
    *&---------------------------------------------------------------------*
    *&      Form  FLD_CAT2
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->P_I_FLDCAT2[]  text
    *----------------------------------------------------------------------*
    
    FORM fld_cat2  USING    p_i_fldcat2 TYPE slis_t_fieldcat_alv .
    
      CLEAR i_fldcat2.
      i_fldcat2-fieldname   = 'VBELN'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat2-tabname     = 'IT_DEL_FUL'."TABLE NAME
      i_fldcat2-seltext_m   = 'DELIVERY NO.'.
      i_fldcat2-col_pos     = 1.        " POSITION OF THE COLUMN.
      i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat2-hotspot     = 'X'.
      i_fldcat2-just(1)     = 'C'.
      APPEND i_fldcat2.
    
      CLEAR i_fldcat2.
      i_fldcat2-fieldname   = 'POSNR'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat2-seltext_m   = 'DELIVERY ITEM'.
      i_fldcat2-col_pos     = 2.        " POSITION OF THE COLUMN.
      i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat2-just(1)     = 'C'.
      APPEND i_fldcat2.
    
      CLEAR i_fldcat2.
      i_fldcat2-fieldname   = 'MATNR'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat2-seltext_m   = 'MATERIAL NO.'.
      i_fldcat2-col_pos     = 3.        " POSITION OF THE COLUMN.
      i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat2-just(1)     = 'C'.
      APPEND i_fldcat2.
    
      CLEAR i_fldcat2.
      i_fldcat2-fieldname   = 'WERKS'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat2-seltext_m   = 'PLANT.'.
      i_fldcat2-col_pos     = 4.        " POSITION OF THE COLUMN.
      i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat2-just(1)     = 'C'.
      APPEND i_fldcat2.
    
      CLEAR i_fldcat2.
      i_fldcat2-fieldname   = 'LGORT'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat2-seltext_m   = 'ST. LOCATION'.
      i_fldcat2-col_pos     = 5.        " POSITION OF THE COLUMN.
      i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat2-just(1)     = 'C'.
      APPEND i_fldcat2.
    
      CLEAR i_fldcat2.
      i_fldcat2-fieldname   = 'CHARG'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat2-seltext_m   = 'BATCH NO.'.
      i_fldcat2-col_pos     = 6.        " POSITION OF THE COLUMN.
      i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat2-just(1)     = 'C'.
      APPEND i_fldcat2.
    
      CLEAR i_fldcat2.
      i_fldcat2-fieldname   = 'LFIMG'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat2-seltext_m   = 'ACT. DEL. QTY.'.
      i_fldcat2-col_pos     = 7.        " POSITION OF THE COLUMN.
      i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat2-just(1)     = 'C'.
      APPEND i_fldcat2.
    
      CLEAR i_fldcat2.
      i_fldcat2-fieldname   = 'VRKME'. "FIELD FOR WHICH CATALOG ID FILLED
      i_fldcat2-seltext_m   = 'SALES UNIT.'.
      i_fldcat2-col_pos     = 8.        " POSITION OF THE COLUMN.
      i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
      i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
      i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
      "SCROLLABLE AND HIDDABLE.
      i_fldcat2-just(1)     = 'C'.
      APPEND i_fldcat2.
    
    ENDFORM.                                                    " FLD_CAT2
    
    ************************************************************************
    ***************** ALV LAYOUT *******************************************
    ************************************************************************
    *&---------------------------------------------------------------------*
    *&      Form  LAYOUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->P_I_LAYOUT  text
    *----------------------------------------------------------------------*
    
    FORM t_layout  USING    p_i_layout TYPE slis_layout_alv .
    
      p_i_layout-zebra  = 'X'.
      p_i_layout-totals_text = 'GRAND TOTAL ='.
    *  p_i_layout-CONFIRMATION_PROMPT = 'X'.
    *  p_i_layout-DEF_STATUS  = ' '.
      p_i_layout-info_fieldname = 'LINE_COLOR'.
    
    ENDFORM.                    " LAYOUT

    reward if useful.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 20, 2007 at 07:06 AM

    Hi,

    Use TOP-OF-PAGE DURING LINE-SELECTION AND

    END-OF-PAGE DURING LINE-SELECTION.

    REGARDS,

    ANJI

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 20, 2007 at 07:07 AM

    Soory i understand ALV intractive report.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 20, 2007 at 07:07 AM

    Hi

    for ineractive list you can use the events:

    TOP-OF-PAGE DURING LINE SELECTION

    &

    END-OF-PAGE DURING LINE SELECTION

    Regards,

    kumar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 01, 2007 at 09:05 PM

    part of the question is answered

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 01, 2007 at 09:37 PM

    U have write the END-OF-PAGE in all list by using

    <b>END-OF-PAGE</b>

    It will trigger in all the sec. list.

    If u want to write only in sec list the check like this

    IF SY-LISND EQ 2.

    write

    ENDIF.

    if useful reward.

    Vasanth

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.