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: 

Events in Interactive ALV

Former Member
0 Kudos
227

Want to display top_of_page in all levels i.e basic list and all secondary list/////

34 REPLIES 34

Former Member
0 Kudos
197

TYPE-POOLS: SLIS .

TABLES : KNA1 .

TYPES : BEGIN OF TY_KNA1  ,

       KUNNR  TYPE KNA1-KUNNR ,

       NAME1  TYPE KNA1-NAME1 ,

       LAND1  TYPE KNA1-LAND1 ,

       END OF TY_KNA1 .

TYPES : BEGIN OF TY_VBAK ,

       VBELN  TYPE VBAK-VBELN ,

       ERDAT  TYPE VBAK-ERDAT ,

       NETWR  TYPE VBAK-NETWR ,

       END OF TY_VBAK .

TYPES : BEGIN OF TY_VBAP  ,

       POSNR TYPE VBAP-POSNR ,

       ARKTX TYPE VBAP-ARKTX ,

       WERKS TYPE VBAP-WERKS ,

       END OF TY_VBAP .

DATA : X TYPE I .

DATA : T_KNA1 TYPE STANDARD TABLE OF TY_KNA1 INITIAL SIZE 1 ,

       T_VBAK TYPE STANDARD TABLE OF TY_VBAK INITIAL SIZE 1 ,

       T_VBAP TYPE STANDARD TABLE OF TY_VBAP INITIAL SIZE 1 .

DATA : W_KNA1 TYPE TY_KNA1 ,

       W_VBAK TYPE TY_VBAK ,

       W_VBAP TYPE TY_VBAP .

DATA : W_FCAT TYPE SLIS_FIELDCAT_ALV .

DATA : T_FCAT TYPE SLIS_T_FIELDCAT_ALV .

DATA : T_FCAT1 TYPE SLIS_T_FIELDCAT_ALV .

DATA : T_FCAT2 TYPE SLIS_T_FIELDCAT_ALV .

DATA : W_COMMENTS TYPE slis_listheader .

DATA:  T_COMMENTS TYPE slis_t_listheader .

DATA : W_EVENTS TYPE SLIS_ALV_EVENT .

DATA : T_EVENTS TYPE SLIS_T_EVENT .

DATA : W_EVENTS1 TYPE SLIS_ALV_EVENT .

DATA : T_EVENTS1 TYPE SLIS_T_EVENT .

DATA : W_EVENTS2 TYPE SLIS_ALV_EVENT .

DATA : T_EVENTS2 TYPE SLIS_T_EVENT .

DATA : V_PROG TYPE SY-REPID .

      V_PROG = SY-REPID .

SELECT-OPTIONS : S_KUNNR FOR KNA1-KUNNR .

W_FCAT-COL_POS = 1 .

W_FCAT-FIELDNAME = 'KUNNR '.

W_FCAT-SELTEXT_M = 'CUST NO'.

APPEND W_FCAT TO T_FCAT .

W_FCAT-COL_POS = 2 .

W_FCAT-FIELDNAME = 'NAME1 '.

W_FCAT-SELTEXT_M = 'CUST NAME'.

APPEND W_FCAT TO T_FCAT .

W_FCAT-COL_POS = 3 .

W_FCAT-FIELDNAME = 'LAND1 '.

W_FCAT-SELTEXT_M = 'CUST COUNTRY'.

APPEND W_FCAT TO T_FCAT .

W_FCAT-COL_POS = 1.

W_FCAT-FIELDNAME = 'VBELN '.

W_FCAT-SELTEXT_M = 'ORDER NO'.

APPEND W_FCAT TO T_FCAT1 .

W_FCAT-COL_POS = 2 .

W_FCAT-FIELDNAME = 'ERDAT '.

W_FCAT-SELTEXT_M = 'ORDER DATA'.

APPEND W_FCAT TO T_FCAT1 .

W_FCAT-COL_POS = 3.

W_FCAT-FIELDNAME = 'NETWR '.

W_FCAT-SELTEXT_M = 'NET VALUE'.

APPEND W_FCAT TO T_FCAT1 .

W_FCAT-COL_POS = 1.

W_FCAT-FIELDNAME = 'POSNR '.

W_FCAT-SELTEXT_M = 'SALES ITEM '.

APPEND W_FCAT TO T_FCAT2 .

W_FCAT-COL_POS = 2.

W_FCAT-FIELDNAME = 'ARKTX '.

W_FCAT-SELTEXT_M = 'SALES DESC'.

APPEND W_FCAT TO T_FCAT2 .

W_FCAT-COL_POS = 3.

W_FCAT-FIELDNAME = 'WERKS '.

W_FCAT-SELTEXT_M = 'PLANT'.

APPEND W_FCAT TO T_FCAT2 .

W_COMMENTS-TYP ='H'.

W_COMMENTS-INFO ='CUSTOMER DATA'.

APPEND W_COMMENTS TO T_COMMENTS .

W_COMMENTS-TYP ='S'.

W_COMMENTS-KEY ='CUST NO'.

W_COMMENTS-INFO ='0000001000'.

APPEND W_COMMENTS TO T_COMMENTS .

*W_EVENTS-NAME ='TOP_OF_PAGE'.

*W_EVENTS-FORM ='SUB'.

*APPEND W_EVENTS2 TO T_EVENTS2 .

W_EVENTS-NAME = 'USER_COMMAND'.

W_EVENTS-FORM = 'SUB1'.

APPEND W_EVENTS TO T_EVENTS .

W_EVENTS1-NAME = 'USER_COMMAND'.

W_EVENTS1-FORM = 'SUB2'.

APPEND W_EVENTS1 TO T_EVENTS1 .

SELECT KUNNR

       NAME1

       LAND1 FROM KNA1 INTO TABLE T_KNA1

             WHERE KUNNR IN S_KUNNR .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

*   I_INTERFACE_CHECK                 = ' '

*   I_BYPASSING_BUFFER                = ' '

*   I_BUFFER_ACTIVE                   = ' '

   I_CALLBACK_PROGRAM                = V_PROG

*   I_CALLBACK_PF_STATUS_SET          = ' '

*   I_CALLBACK_USER_COMMAND           = ' '

*   I_CALLBACK_TOP_OF_PAGE            = ' '

*   I_CALLBACK_HTML_TOP_OF_PAGE       = 'TOP_OF_PAGE'

*   I_CALLBACK_HTML_END_OF_LIST       = ' '

*   I_STRUCTURE_NAME                  =

*   I_BACKGROUND_ID                   = ' '

*   I_GRID_TITLE                      =

*   I_GRID_SETTINGS                   =

*   IS_LAYOUT                         =

   IT_FIELDCAT                       = T_FCAT

*   IT_EXCLUDING                      =

*   IT_SPECIAL_GROUPS                 =

*   IT_SORT                           =

*   IT_FILTER                         =

*   IS_SEL_HIDE                       =

*   I_DEFAULT                         = 'X'

*   I_SAVE                            = ' '

*   IS_VARIANT                        =

   IT_EVENTS                         = T_EVENTS

*   IT_EVENT_EXIT                     =

*   IS_PRINT                          =

*   IS_REPREP_ID                      =

*   I_SCREEN_START_COLUMN             = 0

*   I_SCREEN_START_LINE               = 0

*   I_SCREEN_END_COLUMN               = 0

*   I_SCREEN_END_LINE                 = 0

*   I_HTML_HEIGHT_TOP                 = 0

*   I_HTML_HEIGHT_END                 = 0

*   IT_ALV_GRAPHICS                   =

*   IT_HYPERLINK                      =

*   IT_ADD_FIELDCAT                   =

*   IT_EXCEPT_QINFO                   =

*   IR_SALV_FULLSCREEN_ADAPTER        =

* IMPORTING

*   E_EXIT_CAUSED_BY_CALLER           =

*   ES_EXIT_CAUSED_BY_USER            =

  TABLES

    T_OUTTAB                          = T_KNA1

* EXCEPTIONS

*   PROGRAM_ERROR                     = 1

*   OTHERS                            = 2

          .

*FORM SUB .

*CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

*  EXPORTING

*    IT_LIST_COMMENTARY       = T_COMMENTS

**   I_LOGO                   =

**   I_END_OF_LIST_GRID       =

**   I_ALV_FORM               =

*          .

*ENDFORM .

************************************************************************

*        FIRST DETAILED LIST                                                               *

************************************************************************

FORM SUB1 USING R_UCOMM LIKE SY-UCOMM

                RS_SELFIELD TYPE SLIS_SELFIELD .

*IF FNAME = 'KNA1-KUNNR' .

SELECT VBELN

        ERDAT

        NETWR  FROM VBAK INTO TABLE T_VBAK

               WHERE KUNNR = RS_SELFIELD-VALUE .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

*   I_INTERFACE_CHECK                 = ' '

*   I_BYPASSING_BUFFER                = ' '

*   I_BUFFER_ACTIVE                   = ' '

   I_CALLBACK_PROGRAM                = V_PROG

*   I_CALLBACK_PF_STATUS_SET          = ' '

*   I_CALLBACK_USER_COMMAND           = ' '

*   I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'

*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '

*   I_CALLBACK_HTML_END_OF_LIST       = ' '

*   I_STRUCTURE_NAME                  =

*   I_BACKGROUND_ID                   = ' '

*   I_GRID_TITLE                      =

*   I_GRID_SETTINGS                   =

*   IS_LAYOUT                         =

   IT_FIELDCAT                       = T_FCAT1

*   IT_EXCLUDING                      =

*   IT_SPECIAL_GROUPS                 =

*   IT_SORT                           =

*   IT_FILTER                         =

*   IS_SEL_HIDE                       =

*   I_DEFAULT                         = 'X'

*   I_SAVE                            = ' '

*   IS_VARIANT                        =

   IT_EVENTS                         = T_EVENTS1

*   IT_EVENT_EXIT                     =

*   IS_PRINT                          =

*   IS_REPREP_ID                      =

*   I_SCREEN_START_COLUMN             = 0

*   I_SCREEN_START_LINE               = 0

*   I_SCREEN_END_COLUMN               = 0

*   I_SCREEN_END_LINE                 = 0

*   I_HTML_HEIGHT_TOP                 = 0

*   I_HTML_HEIGHT_END                 = 0

*   IT_ALV_GRAPHICS                   =

*   IT_HYPERLINK                      =

*   IT_ADD_FIELDCAT                   =

*   IT_EXCEPT_QINFO                   =

*   IR_SALV_FULLSCREEN_ADAPTER        =

* IMPORTING

*   E_EXIT_CAUSED_BY_CALLER           =

*   ES_EXIT_CAUSED_BY_USER            =

  TABLES

    T_OUTTAB                          = T_VBAK

* EXCEPTIONS

*   PROGRAM_ERROR                     = 1

*   OTHERS                            = 2

          .

ENDFORM .

FORM SUB2 USING r_ucomm LIKE sy-ucomm

               rs_selfield TYPE slis_selfield.

SELECT POSNR

       ARKTX

       WERKS FROM VBAP INTO TABLE T_VBAP

             WHERE VBELN =  RS_SELFIELD-VALUE .

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

   EXPORTING

*     I_INTERFACE_CHECK                 = ' '

*     I_BYPASSING_BUFFER                = ' '

*     I_BUFFER_ACTIVE                   = ' '

*     I_CALLBACK_PROGRAM                = ' '

*     I_CALLBACK_PF_STATUS_SET          = ' '

*     I_CALLBACK_USER_COMMAND           = ' '

*     I_CALLBACK_TOP_OF_PAGE            = ' TOP_OF_PAGE'

*     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '

*     I_CALLBACK_HTML_END_OF_LIST       = ' '

*     I_STRUCTURE_NAME                  =

*     I_BACKGROUND_ID                   = ' '

*     I_GRID_TITLE                      =

*     I_GRID_SETTINGS                   =

*     IS_LAYOUT                         =

     IT_FIELDCAT                       = T_FCAT2

*     IT_EXCLUDING                      =

*     IT_SPECIAL_GROUPS                 =

*     IT_SORT                           =

*     IT_FILTER                         =

*     IS_SEL_HIDE                       =

*     I_DEFAULT                         = 'X'

*     I_SAVE                            = ' '

*     IS_VARIANT                        =

*     IT_EVENTS                         = T_EVENTS1

*     IT_EVENT_EXIT                     =

*     IS_PRINT                          =

*     IS_REPREP_ID                      =

*     I_SCREEN_START_COLUMN             = 0

*     I_SCREEN_START_LINE               = 0

*     I_SCREEN_END_COLUMN               = 0

*     I_SCREEN_END_LINE                 = 0

*     I_HTML_HEIGHT_TOP                 = 0

*     I_HTML_HEIGHT_END                 = 0

*     IT_ALV_GRAPHICS                   =

*     IT_HYPERLINK                      =

*     IT_ADD_FIELDCAT                   =

*     IT_EXCEPT_QINFO                   =

*     IR_SALV_FULLSCREEN_ADAPTER        =

*   IMPORTING

*     E_EXIT_CAUSED_BY_CALLER           =

*     ES_EXIT_CAUSED_BY_USER            =

    TABLES

      T_OUTTAB                          = T_VBAP

*   EXCEPTIONS

*     PROGRAM_ERROR                     = 1

*     OTHERS                            = 2

            .

ENDFORM .

0 Kudos
197

Did you perform some search on events TOP_OF_LIST  and TOP_OF_PAGE in scn, if yes which problem did you get?

Hint: look also for standard demo program as BALVBT01, etc.

Regards,

Raymond

0 Kudos
197

Hi Anshika,

In your ALV you were passing the "TOP_OF_PAGE" to parameter "i_callback_html_top_of_page", where it has to be passed to "i_callback_top_of_page" parameter.

Than pass the same value (i.e. TOP_OF_PAGE) to the all the FM parameter "i_callback_top_of_page".

Check the below modified code.

TYPE-POOLS: slis .

TABLES : kna1 .

TYPES : BEGIN OF ty_kna1  ,

        kunnr  TYPE kna1-kunnr ,

        name1  TYPE kna1-name1 ,

        land1  TYPE kna1-land1 ,

        END OF ty_kna1 .

TYPES : BEGIN OF ty_vbak ,

        vbeln  TYPE vbak-vbeln ,

        erdat  TYPE vbak-erdat ,

        netwr  TYPE vbak-netwr ,

        END OF ty_vbak .

TYPES : BEGIN OF ty_vbap  ,

        posnr TYPE vbap-posnr ,

        arktx TYPE vbap-arktx ,

        werks TYPE vbap-werks ,

        END OF ty_vbap .

DATA : x TYPE i .

DATA : t_kna1 TYPE STANDARD TABLE OF ty_kna1 INITIAL SIZE 1 ,

        t_vbak TYPE STANDARD TABLE OF ty_vbak INITIAL SIZE 1 ,

        t_vbap TYPE STANDARD TABLE OF ty_vbap INITIAL SIZE 1 .

DATA : w_kna1 TYPE ty_kna1 ,

        w_vbak TYPE ty_vbak ,

        w_vbap TYPE ty_vbap .

DATA : w_fcat TYPE slis_fieldcat_alv .

DATA : t_fcat TYPE slis_t_fieldcat_alv .

DATA : t_fcat1 TYPE slis_t_fieldcat_alv .

DATA : t_fcat2 TYPE slis_t_fieldcat_alv .

DATA : w_comments TYPE slis_listheader .

DATAt_comments TYPE slis_t_listheader .

DATA : w_events TYPE slis_alv_event .

DATA : t_events TYPE slis_t_event .

DATA : w_events1 TYPE slis_alv_event .

DATA : t_events1 TYPE slis_t_event .

DATA : w_events2 TYPE slis_alv_event .

DATA : t_events2 TYPE slis_t_event .

DATA : v_prog TYPE sy-repid .

v_prog = sy-repid .

SELECT-OPTIONS : s_kunnr FOR kna1-kunnr .

w_fcat-col_pos = 1 .

w_fcat-fieldname = 'KUNNR '.

w_fcat-seltext_m = 'CUST NO'.

APPEND w_fcat TO t_fcat .

w_fcat-col_pos = 2 .

w_fcat-fieldname = 'NAME1 '.

w_fcat-seltext_m = 'CUST NAME'.

APPEND w_fcat TO t_fcat .

w_fcat-col_pos = 3 .

w_fcat-fieldname = 'LAND1 '.

w_fcat-seltext_m = 'CUST COUNTRY'.

APPEND w_fcat TO t_fcat .

w_fcat-col_pos = 1.

w_fcat-fieldname = 'VBELN '.

w_fcat-seltext_m = 'ORDER NO'.

APPEND w_fcat TO t_fcat1 .

w_fcat-col_pos = 2 .

w_fcat-fieldname = 'ERDAT '.

w_fcat-seltext_m = 'ORDER DATA'.

APPEND w_fcat TO t_fcat1 .

w_fcat-col_pos = 3.

w_fcat-fieldname = 'NETWR '.

w_fcat-seltext_m = 'NET VALUE'.

APPEND w_fcat TO t_fcat1 .

w_fcat-col_pos = 1.

w_fcat-fieldname = 'POSNR '.

w_fcat-seltext_m = 'SALES ITEM '.

APPEND w_fcat TO t_fcat2 .

w_fcat-col_pos = 2.

w_fcat-fieldname = 'ARKTX '.

w_fcat-seltext_m = 'SALES DESC'.

APPEND w_fcat TO t_fcat2 .

w_fcat-col_pos = 3.

w_fcat-fieldname = 'WERKS '.

w_fcat-seltext_m = 'PLANT'.

APPEND w_fcat TO t_fcat2 .

w_comments-typ ='H'.

w_comments-info ='CUSTOMER DATA'.

APPEND w_comments TO t_comments .

w_comments-typ ='S'.

w_comments-key ='CUST NO'.

w_comments-info ='0000001000'.

APPEND w_comments TO t_comments .

*W_EVENTS-NAME ='TOP_OF_PAGE'.

*W_EVENTS-FORM ='SUB'.

*APPEND W_EVENTS2 TO T_EVENTS2 .

w_events-name = 'USER_COMMAND'.

w_events-form = 'SUB1'.

APPEND w_events TO t_events .

w_events1-name = 'USER_COMMAND'.

w_events1-form = 'SUB2'.

APPEND w_events1 TO t_events1 .

DATA: ls_line   TYPE slis_listheader,

       it_top_of_page  TYPE slis_t_listheader.

ls_line-typ  = 'H'.

ls_line-info = 'Customer Detail'.

APPEND ls_line TO it_top_of_page.

CLEAR ls_line.

SELECT kunnr

        name1

        land1 FROM kna1 INTO TABLE t_kna1

              WHERE kunnr IN s_kunnr .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

*   I_INTERFACE_CHECK                 = ' '

*   I_BYPASSING_BUFFER                = ' '

*   I_BUFFER_ACTIVE                   = ' '

    i_callback_program                = v_prog

*   I_CALLBACK_PF_STATUS_SET          = ' '

*   I_CALLBACK_USER_COMMAND           = ' '

    i_callback_top_of_page            = 'TOP_OF_PAGE'

*   i_callback_html_top_of_page       = 'TOP_OF_PAGE'

*   I_CALLBACK_HTML_END_OF_LIST       = ' '

*   I_STRUCTURE_NAME                  =

*   I_BACKGROUND_ID                   = ' '

*   I_GRID_TITLE                      =

*   I_GRID_SETTINGS                   =

*   IS_LAYOUT                         =

    it_fieldcat                       = t_fcat

*   IT_EXCLUDING                      =

*   IT_SPECIAL_GROUPS                 =

*   IT_SORT                           =

*   IT_FILTER                         =

*   IS_SEL_HIDE                       =

*   I_DEFAULT                         = 'X'

*   I_SAVE                            = ' '

*   IS_VARIANT                        =

    it_events                         = t_events

*   IT_EVENT_EXIT                     =

*   IS_PRINT                          =

*   IS_REPREP_ID                      =

*   I_SCREEN_START_COLUMN             = 0

*   I_SCREEN_START_LINE               = 0

*   I_SCREEN_END_COLUMN               = 0

*   I_SCREEN_END_LINE                 = 0

*   I_HTML_HEIGHT_TOP                 = 0

*   I_HTML_HEIGHT_END                 = 0

*   IT_ALV_GRAPHICS                   =

*   IT_HYPERLINK                      =

*   IT_ADD_FIELDCAT                   =

*   IT_EXCEPT_QINFO                   =

*   IR_SALV_FULLSCREEN_ADAPTER        =

* IMPORTING

*   E_EXIT_CAUSED_BY_CALLER           =

*   ES_EXIT_CAUSED_BY_USER            =

   TABLES

     t_outtab                          = t_kna1

* EXCEPTIONS

*   PROGRAM_ERROR                     = 1

*   OTHERS                            = 2

           .

*FORM SUB .

*CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

*  EXPORTING

*    IT_LIST_COMMENTARY       = T_COMMENTS

**   I_LOGO                   =

**   I_END_OF_LIST_GRID       =

**   I_ALV_FORM               =

*          .

*ENDFORM .

************************************************************************

*        FIRST DETAILED LIST                                                               *

************************************************************************

FORM sub1 USING r_ucomm LIKE sy-ucomm

                 rs_selfield TYPE slis_selfield .

*IF FNAME = 'KNA1-KUNNR' .

   SELECT vbeln

           erdat

           netwr  FROM vbak INTO TABLE t_vbak

                  WHERE kunnr = rs_selfield-value .

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

   EXPORTING

*   I_INTERFACE_CHECK                 = ' '

*   I_BYPASSING_BUFFER                = ' '

*   I_BUFFER_ACTIVE                   = ' '

      i_callback_program                = v_prog

*   I_CALLBACK_PF_STATUS_SET          = ' '

*   I_CALLBACK_USER_COMMAND           = ' '

    i_callback_top_of_page            = 'TOP_OF_PAGE'

*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '

*   I_CALLBACK_HTML_END_OF_LIST       = ' '

*   I_STRUCTURE_NAME                  =

*   I_BACKGROUND_ID                   = ' '

*   I_GRID_TITLE                      =

*   I_GRID_SETTINGS                   =

*   IS_LAYOUT                         =

      it_fieldcat                       = t_fcat1

*   IT_EXCLUDING                      =

*   IT_SPECIAL_GROUPS                 =

*   IT_SORT                           =

*   IT_FILTER                         =

*   IS_SEL_HIDE                       =

*   I_DEFAULT                         = 'X'

*   I_SAVE                            = ' '

*   IS_VARIANT                        =

      it_events                         = t_events1

*   IT_EVENT_EXIT                     =

*   IS_PRINT                          =

*   IS_REPREP_ID                      =

*   I_SCREEN_START_COLUMN             = 0

*   I_SCREEN_START_LINE               = 0

*   I_SCREEN_END_COLUMN               = 0

*   I_SCREEN_END_LINE                 = 0

*   I_HTML_HEIGHT_TOP                 = 0

*   I_HTML_HEIGHT_END                 = 0

*   IT_ALV_GRAPHICS                   =

*   IT_HYPERLINK                      =

*   IT_ADD_FIELDCAT                   =

*   IT_EXCEPT_QINFO                   =

*   IR_SALV_FULLSCREEN_ADAPTER        =

* IMPORTING

*   E_EXIT_CAUSED_BY_CALLER           =

*   ES_EXIT_CAUSED_BY_USER            =

     TABLES

       t_outtab                          = t_vbak

* EXCEPTIONS

*   PROGRAM_ERROR                     = 1

*   OTHERS                            = 2

             .

ENDFORM .                    "SUB1

*&---------------------------------------------------------------------*

*&      Form  SUB2

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->R_UCOMM      text

*      -->RS_SELFIELD  text

*----------------------------------------------------------------------*

FORM sub2 USING r_ucomm LIKE sy-ucomm

                rs_selfield TYPE slis_selfield.

   SELECT posnr

          arktx

          werks FROM vbap INTO TABLE t_vbap

                WHERE vbeln rs_selfield-value .

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

*     I_INTERFACE_CHECK                 = ' '

*     I_BYPASSING_BUFFER                = ' '

*     I_BUFFER_ACTIVE                   = ' '

*     I_CALLBACK_PROGRAM                = ' '

*     I_CALLBACK_PF_STATUS_SET          = ' '

*     I_CALLBACK_USER_COMMAND           = ' '

      i_callback_top_of_page            = 'TOP_OF_PAGE'

*     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '

*     I_CALLBACK_HTML_END_OF_LIST       = ' '

*     I_STRUCTURE_NAME                  =

*     I_BACKGROUND_ID                   = ' '

*     I_GRID_TITLE                      =

*     I_GRID_SETTINGS                   =

*     IS_LAYOUT                         =

      it_fieldcat                       = t_fcat2

*     IT_EXCLUDING                      =

*     IT_SPECIAL_GROUPS                 =

*     IT_SORT                           =

*     IT_FILTER                         =

*     IS_SEL_HIDE                       =

*     I_DEFAULT                         = 'X'

*     I_SAVE                            = ' '

*     IS_VARIANT                        =

      it_events                         = t_events1

*     IT_EVENT_EXIT                     =

*     IS_PRINT                          =

*     IS_REPREP_ID                      =

*     I_SCREEN_START_COLUMN             = 0

*     I_SCREEN_START_LINE               = 0

*     I_SCREEN_END_COLUMN               = 0

*     I_SCREEN_END_LINE                 = 0

*     I_HTML_HEIGHT_TOP                 = 0

*     I_HTML_HEIGHT_END                 = 0

*     IT_ALV_GRAPHICS                   =

*     IT_HYPERLINK                      =

*     IT_ADD_FIELDCAT                   =

*     IT_EXCEPT_QINFO                   =

*     IR_SALV_FULLSCREEN_ADAPTER        =

*   IMPORTING

*     E_EXIT_CAUSED_BY_CALLER           =

*     ES_EXIT_CAUSED_BY_USER            =

     TABLES

       t_outtab                          = t_vbap

*   EXCEPTIONS

*     PROGRAM_ERROR                     = 1

*     OTHERS                            = 2

             .

ENDFORM .                    "SUB2

*&---------------------------------------------------------------------*

*&      Form  top_of_page

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

FORM top_of_page.

   CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

     EXPORTING

       it_list_commentary = it_top_of_page

       i_logo             = ''.

ENDFORM.                    "top_of_page




Regards

Abhishe

0 Kudos
197

The HTML top of page callback can be used to provide a dynamic document header:


*Eject
*&---------------------------------------------------------------------*
*&      Form  ALV_GRID_HTML_Top_Of_Page
*&---------------------------------------------------------------------*
*       text  Call back routine for the Alv Grid for top of page
*             processing.
*----------------------------------------------------------------------*
*  -->  pu_Top_Of_Page         Top of Page object.
*
*       Since this is a call back routine,  access to all other
*       variables is global.
*
*       This procedure calls the procedure defined in the
*       HTML_TOP_OF_PAGE Event.  This form must be declared as:
*
*       Form XXXX Changing pu_Top_Of_Page Type Ref to Cl_Dd_Document.
*----------------------------------------------------------------------*
Form ALV_GRID_HTML_Top_Of_Page Using pu_Top_Of_Page Type Dynamic_Document.
*
     Define Move_Field.
            Assign Component '&2' of Structure &1 to <f_Field>.
            If <f_Field> is Assigned.
               Move <f_Field> &3 &4.
               UnAssign <f_Field>.
            Else.
               Move '*' &3 &4.
            EndIf.
     End-Of-Definition.
*
     Field-Symbols: <f_Filter_Table>   Type Standard Table,
                    <f_Filter_Record>,
                    <f_Sort_Table>     Type Standard Table,
                    <f_Sort_Record>,
                    <f_Field_Catalogs> Type Standard Table,
                    <f_Field_Catalog>,
                    <f_Field>.
*
     Data: w_text           Type sdydo_text_element,
           w_Key            Type Natural_Text,
           w_Sel_Text       Type Natural_Text,
           o_Sel_Table      Type ref to cl_dd_table_element,
           o_Sort_Table     Type ref to cl_dd_table_element,
           o_Filt_Table     Type ref to cl_dd_table_element,
           o_Col_Parm       Type ref to cl_dd_area,
           o_Col_Value      Type ref to cl_dd_area,
           o_Col_Descr      Type ref to cl_dd_area,
           o_Col_Sort_Field Type ref to cl_dd_area,
           o_Col_Direction  Type ref to cl_dd_area,
           o_Col_Filt_Field Type ref to cl_dd_area,
           o_Col_Filt_Value Type ref to cl_dd_area,
           o_Parms_Area     Type ref to cl_dd_area,
           o_Dept_logo      Type ref to cl_dd_area,
           w_Theme          Type Theme,
           t_Selections     Type Sel_Parms,
           w_Selection      Type Sel_Parm,
           w_Parameter      Type ZTALV_Field_Name,
           t_Filter_Info    Type Ref to Data,
           w_Filter_Info    Type Ref To Data,
           t_Sort_Info      Type Ref to Data,
           w_Sort_Info      Type Ref to Data,
           t_Field_Cat      Type Ref To Data,
           w_Field_Cat      Type Ref To Data,
           w_Program        Type ZTALV_Program_Name,
           w_Form_Name      Type ZTALV_Event_Form,
           w_Sort_Direction Type ZTALV_Boolean.
*
*    Create Work areas and tables dependant on whether this is an ALV Classic
*    or object
*
     If o_Alv_Grid is initial.
        Create Data t_Sort_Info   Type Alv_SortInfo_Table.
        Create Data w_Sort_Info   Type Alv_SortInfo_Record.
*
        Create Data t_Filter_Info Type Alv_FilterInfo_Table.
        Create Data w_Filter_Info Type Alv_FilterInfo_Record.
*
        Create Data t_Field_Cat   Type Field_Catalogs.
        Create Data w_Field_Cat   Type Field_Catalog.
     Else.
        Create Data t_Sort_Info   Type Object_Sort_Infos.
        Create Data w_Sort_Info   Type Object_Sort_Info.
*
        Create Data t_Filter_Info Type Object_Filter_Infos.
        Create Data w_Filter_Info Type Object_Filter_Info.
*
        Create Data t_Field_Cat   Type Object_Field_Catalogs.
        Create Data w_Field_Cat   Type Object_Field_Catalog.

     EndIf.
     Assign t_Sort_Info->*   to <f_Sort_Table>.
     Assign w_Sort_Info->*   to <f_Sort_Record>.
     Assign t_Filter_Info->* to <f_Filter_Table>.
     Assign w_Filter_Info->* to <f_Filter_Record>.
     Assign t_Field_Cat->*   to <f_Field_Catalogs>.
     Assign w_Field_Cat->*   to <f_Field_Catalog>.
*
*    Get the theme back and see if a Selection texts are required.
*
     Perform Global_Get_Theme Changing w_Theme.
*
*    Get the Filter and sort info back.  Use different methods dependant on
*    whether this is an object ALV or not.
*
     If o_Alv_Grid is initial.
        Call Function 'REUSE_ALV_GRID_LAYOUT_INFO_GET'
          Importing
            Et_Filter                 = <f_Filter_Table>
            Et_Sort                   = <f_Sort_Table>
            Et_FieldCat               = <f_Field_Catalogs>
          Exceptions
            No_Infos                  = 1
            Program_Error             = 2
            Others                    = 3.
     Else.
        Call method o_Alv_Grid->Get_Filter_Criteria
          Importing
             et_Filter = <f_Filter_Table>.
        Call method o_Alv_Grid->Get_Sort_Criteria
          Importing
             et_Sort = <f_Sort_Table>.
        Call method o_Alv_Grid->Get_Frontend_FieldCatalog
          Importing
             et_FieldCatalog = <f_Field_Catalogs>.
     EndIf.
*
     Call Method pu_Top_Of_Page->Initialize_Document( ).
     Call Method pu_Top_Of_Page->vertical_split
            Exporting split_area  = pu_Top_Of_Page
                      split_width = '25%'
            Importing right_area  = o_Parms_Area.
     Call Method pu_Top_Of_Page->Add_Picture( c_xxxx_Logo ).
     If w_Theme-Head_Picture is  not initial.
        Call Method pu_Top_Of_Page->vertical_split
               Exporting split_area  = o_Parms_Area
                         split_width = '75%'
               Importing right_area  = o_Dept_Logo.
        Call Method o_Dept_Logo->Add_Picture( w_Theme-Head_Picture ).
     EndIf.
*
*    Selection Criteria
*
     If w_Theme-Get_SelInfos = ZTALV_True.
        Perform Get_Selection_Parameters Changing t_Selections.
        Loop at t_Selections
             Into w_Selection
            Where Low <> ''.
             Exit.
        EndLoop.
        If sy-subrc = 0.
           w_Text = 'Selection Parameters'(001).
           Call Method o_Parms_Area->Add_Text
                  Exporting Text = w_Text.
           Call Method o_Parms_Area->add_table
                  Exporting no_of_columns = 3
                            with_heading  = ' '
                            border        = '1'
                  Importing table         = o_Sel_Table.
           Call Method o_Sel_Table->add_column Importing column = o_Col_Parm.
           Call Method o_Sel_Table->add_column Importing column = o_Col_Value.
           Call Method o_Sel_Table->add_column Importing column = o_Col_Descr.
           w_Text = 'Parameter'(002).
           Call Method o_Col_Parm->Add_Text
             Exporting Text      = w_Text
                       Sap_Style = 'TABLE_HEADING'.
           w_Text = 'Value'(003).
           Call Method o_Col_Value->Add_Text
             Exporting Text      = w_Text
                       Sap_Style = 'TABLE_HEADING'.
           w_Text = 'Description'(004).
           Call Method o_Col_descr->Add_Text
             Exporting Text      = w_Text
                       Sap_Style = 'TABLE_HEADING'.
           Loop at t_Selections into w_Selection.
                If w_Selection-Low is not initial
                   Or w_Selection-High is not initial.
                      Call Method o_Sel_Table->New_Row.
                      If w_Parameter <> w_Selection-SelName.
                         w_Parameter = w_Selection-SelName.
                         w_Text = w_Selection-Entry.
                         Call Method o_Col_Parm->Add_Text
                                Exporting Text      = w_Text
                                          Sap_Style = 'Key'.
                      EndIf.
                      Case w_Selection-Kind.
                           When c_pt_Parameter.
                                w_Text = w_Selection-Low.
                                Call Method o_Col_Value->Add_Text
                                       Exporting Text      = w_Text
                                                 Sap_Style = 'Strong'.
                           When c_pt_Select_Option.
                                Perform Translate_Option using w_Selection-Sign
                                                               w_Selection-Option
                                                               w_Selection-Low
                                                               w_Selection-High
                                                      Changing w_Sel_Text.
                                w_Text = w_Sel_Text.
                                Call Method o_Col_Value->Add_Text
                                       Exporting Text      = w_Text
                                                 Sap_Style = 'Strong'.
                      Endcase.
                      Call Method o_Col_Parm->Add_Gap Exporting Width = 6.
                      Call Method o_Col_Value->Add_Gap Exporting Width = 30.
                      Call Method o_Col_Descr->Add_Gap Exporting Width = 50.
                EndIf.
           EndLoop.
        EndIf.
*
*       Sort Information
*
        Read Table <f_Sort_Table> Index 1 transporting no fields.
        If sy-subrc = 0.
           Call Method o_Parms_Area->New_Line.
           Call Method o_Parms_Area->New_Line.
           w_Text = 'Sort Criteria'(007).
           Call Method o_Parms_Area->Add_Text
                  Exporting Text = w_Text.
           Call Method o_Parms_Area->Add_table
                  Exporting no_of_columns = 2
                            with_heading  = ' '
                            border        = '1'
                  Importing table         = o_Sort_Table.
           Call Method o_Sort_Table->add_column Importing column = o_Col_Sort_Field.
           Call Method o_Sort_Table->add_column Importing column = o_Col_Direction.
           Loop at <f_Sort_Table> into <f_Sort_Record>.
                If sy-TabIx > 1.
                   Call Method o_Sort_Table->New_Row.
                EndIf.
                Move_Field <f_Sort_Record> FieldName To w_Text.
                Loop at <f_Field_Catalogs> Into <f_Field_Catalog>.
                     Move_Field <f_Field_Catalog> FieldName To w_Key.
                     If w_Key = w_Text.
                        Exit.
                     EndIf.
                EndLoop.
                Move_Field <f_Field_Catalog> SelText_l To w_Text.
                Call Method o_Col_Sort_Field->Add_Text
                       Exporting Text      = w_Text
                                 Sap_Style = 'Key'.
                Move_Field <f_Sort_Record> Up To w_Sort_Direction.
                If w_Sort_Direction = ZTALV_True.
                   w_Text = 'Ascending'(008).
                Else.
                   w_text = 'Descending'(009).
                EndIf.
                Call Method o_Col_Direction->Add_Text
                       Exporting Text      = w_Text
                                 Sap_Style = 'Strong'.
                Call Method o_Col_Sort_Field->Add_Gap Exporting Width = 6.
                Call Method o_Col_Direction->Add_Gap Exporting Width = 30.
           EndLoop.
        EndIf.
*
*       Filter Information.
*
        Read Table <f_Filter_Table> Index 1 transporting no fields.
        If sy-subrc = 0.
           Call Method o_Parms_Area->New_Line.
           Call Method o_Parms_Area->New_Line.
           w_Text = 'Filter Criteria'(010).
           Call Method o_Parms_Area->Add_Text
                  Exporting Text = w_Text.
           Call Method o_Parms_Area->Add_table
                  Exporting no_of_columns = 2
                            with_heading  = ' '
                            border        = '1'
                  Importing table         = o_Filt_Table.
           Call Method o_Filt_Table->add_column Importing column = o_Col_Filt_Field.
           Call Method o_Filt_Table->add_column Importing column = o_Col_Filt_Value.
           Loop at <f_Filter_Table> into <f_Filter_Record>.
                If sy-TabIx > 1.
                   Call Method o_Filt_Table->New_Row.
                EndIf.
                Move_Field <f_Filter_Record> Seltext to w_Text.
                Call Method o_Col_Filt_Field->Add_Text
                       Exporting Text      = w_Text
                                 Sap_Style = 'Key'.
                Move_Field <f_Filter_Record> ValuF to w_Text.
                Call Method o_Col_Filt_Value->Add_Text
                       Exporting Text      = w_Text
                                 Sap_Style = 'Strong'.
                Call Method o_Col_Filt_Field->Add_Gap Exporting Width = 6.
                Call Method o_Col_Filt_Value->Add_Gap Exporting Width = 30.
           EndLoop.
        EndIf.
     EndIf.
*
*    Call back.
*
     Perform Get_Event Using ZTALV_Ev_HTML_Top_Of_Page
                    Changing w_Program
                             w_Form_Name.
     If w_Form_Name is not initial.
        Perform (w_Form_Name) in Program (w_Program)
                Changing pu_Top_Of_Page
             If Found.
     EndIf.
     UnAssign <f_Field_Catalog>.
     UnAssign <f_Field_Catalogs>.
     UnAssign <f_Filter_Record>.
     UnAssign <f_Filter_Table>.
     UnAssign <f_Sort_Record>.
     UnAssign <f_Sort_Table>.
EndForm.

0 Kudos
197

cannot be done with code....and how to write contents in top_of_page

0 Kudos
197

when I am using html call back then its not displaying data in secondary list

0 Kudos
197

Hi,

Have the check the code which i have given?

Regards

0 Kudos
197

ya ,,,in that also after declaring top of page in html no displaying data in secondary list

0 Kudos
197

are you defining the top of page in  "I_CALLBACK_HTML_TOP_OF_PAGE" parameter.

if so, than pass top of page to " i_callback_top_of_page " parameter.

When i am executing the code i am getting header on both the basic and secondary list along with the corresponding data in both the list.

Just cut and paste the given code and than try.

0 Kudos
197

Hi Abhishek ,,,,help me out/////

TYPE-POOLS: SLIS .

TABLES : KNA1 .

TYPES : BEGIN OF TY_KNA1  ,

       KUNNR  TYPE KNA1-KUNNR ,

       NAME1  TYPE KNA1-NAME1 ,

       LAND1  TYPE KNA1-LAND1 ,

       END OF TY_KNA1 .

TYPES : BEGIN OF TY_VBAK ,

       VBELN  TYPE VBAK-VBELN ,

       ERDAT  TYPE VBAK-ERDAT ,

       NETWR  TYPE VBAK-NETWR ,

       END OF TY_VBAK .

TYPES : BEGIN OF TY_VBAP  ,

       POSNR TYPE VBAP-POSNR ,

       ARKTX TYPE VBAP-ARKTX ,

       WERKS TYPE VBAP-WERKS ,

       END OF TY_VBAP .

DATA : X TYPE I .

DATA : T_KNA1 TYPE STANDARD TABLE OF TY_KNA1 INITIAL SIZE 1 ,

       T_VBAK TYPE STANDARD TABLE OF TY_VBAK INITIAL SIZE 1 ,

       T_VBAP TYPE STANDARD TABLE OF TY_VBAP INITIAL SIZE 1 .

DATA : W_KNA1 TYPE TY_KNA1 ,

       W_VBAK TYPE TY_VBAK ,

       W_VBAP TYPE TY_VBAP .

DATA : W_FCAT TYPE SLIS_FIELDCAT_ALV .

DATA : T_FCAT TYPE SLIS_T_FIELDCAT_ALV .

DATA : T_FCAT1 TYPE SLIS_T_FIELDCAT_ALV .

DATA : T_FCAT2 TYPE SLIS_T_FIELDCAT_ALV .

DATA : W_COMMENTS TYPE slis_listheader .

DATA:  T_COMMENTS TYPE slis_t_listheader .

DATA : W_EVENTS TYPE SLIS_ALV_EVENT .

DATA : T_EVENTS TYPE SLIS_T_EVENT .

DATA : W_EVENTS1 TYPE SLIS_ALV_EVENT .

DATA : T_EVENTS1 TYPE SLIS_T_EVENT .

DATA : W_EVENTS2 TYPE SLIS_ALV_EVENT .

DATA : T_EVENTS2 TYPE SLIS_T_EVENT .

DATA : V_PROG TYPE SY-REPID .

      V_PROG = SY-REPID .

SELECT-OPTIONS : S_KUNNR FOR KNA1-KUNNR .

W_FCAT-COL_POS = 1 .

W_FCAT-FIELDNAME = 'KUNNR '.

W_FCAT-SELTEXT_M = 'CUST NO'.

APPEND W_FCAT TO T_FCAT .

W_FCAT-COL_POS = 2 .

W_FCAT-FIELDNAME = 'NAME1 '.

W_FCAT-SELTEXT_M = 'CUST NAME'.

APPEND W_FCAT TO T_FCAT .

W_FCAT-COL_POS = 3 .

W_FCAT-FIELDNAME = 'LAND1 '.

W_FCAT-SELTEXT_M = 'CUST COUNTRY'.

APPEND W_FCAT TO T_FCAT .

W_FCAT-COL_POS = 1.

W_FCAT-FIELDNAME = 'VBELN '.

W_FCAT-SELTEXT_M = 'ORDER NO'.

APPEND W_FCAT TO T_FCAT1 .

W_FCAT-COL_POS = 2 .

W_FCAT-FIELDNAME = 'ERDAT '.

W_FCAT-SELTEXT_M = 'ORDER DATA'.

APPEND W_FCAT TO T_FCAT1 .

W_FCAT-COL_POS = 3.

W_FCAT-FIELDNAME = 'NETWR '.

W_FCAT-SELTEXT_M = 'NET VALUE'.

APPEND W_FCAT TO T_FCAT1 .

W_FCAT-COL_POS = 1.

W_FCAT-FIELDNAME = 'POSNR '.

W_FCAT-SELTEXT_M = 'SALES ITEM '.

APPEND W_FCAT TO T_FCAT2 .

W_FCAT-COL_POS = 2.

W_FCAT-FIELDNAME = 'ARKTX '.

W_FCAT-SELTEXT_M = 'SALES DESC'.

APPEND W_FCAT TO T_FCAT2 .

W_FCAT-COL_POS = 3.

W_FCAT-FIELDNAME = 'WERKS '.

W_FCAT-SELTEXT_M = 'PLANT'.

APPEND W_FCAT TO T_FCAT2 .

W_COMMENTS-TYP ='H'.

W_COMMENTS-INFO ='CUSTOMER DATA'.

APPEND W_COMMENTS TO T_COMMENTS .

W_COMMENTS-TYP ='S'.

W_COMMENTS-KEY ='CUST NO'.

W_COMMENTS-INFO ='0000001000'.

APPEND W_COMMENTS TO T_COMMENTS .

W_EVENTS-NAME ='TOP_OF_PAGE'.

W_EVENTS-FORM ='SUB'.

APPEND W_EVENTS2 TO T_EVENTS2 .

W_EVENTS-NAME = 'USER_COMMAND'.

W_EVENTS-FORM = 'SUB1'.

APPEND W_EVENTS TO T_EVENTS .

W_EVENTS1-NAME = 'USER_COMMAND'.

W_EVENTS1-FORM = 'SUB2'.

APPEND W_EVENTS1 TO T_EVENTS1 .

DATA: ls_line   TYPE slis_listheader,

       it_top_of_page  TYPE slis_t_listheader.

*ls_line-typ  = 'H'.

*ls_line-info = 'Customer Detail'.

*APPEND ls_line TO it_top_of_page.

*CLEAR ls_line.

SELECT KUNNR

       NAME1

       LAND1 FROM KNA1 INTO TABLE T_KNA1

             WHERE KUNNR IN S_KUNNR .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

*   I_INTERFACE_CHECK                 = ' '

*   I_BYPASSING_BUFFER                = ' '

*   I_BUFFER_ACTIVE                   = ' '

   I_CALLBACK_PROGRAM                = V_PROG

*   I_CALLBACK_PF_STATUS_SET          = ' '

*   I_CALLBACK_USER_COMMAND           = ' '

   I_CALLBACK_TOP_OF_PAGE            = ' top_of_page'

*   I_CALLBACK_HTML_TOP_OF_PAGE       = 'TOP_OF_PAGE'

*   I_CALLBACK_HTML_END_OF_LIST       = ' '

*   I_STRUCTURE_NAME                  =

*   I_BACKGROUND_ID                   = ' '

*   I_GRID_TITLE                      =

*   I_GRID_SETTINGS                   =

*   IS_LAYOUT                         =

   IT_FIELDCAT                       = T_FCAT

*   IT_EXCLUDING                      =

*   IT_SPECIAL_GROUPS                 =

*   IT_SORT                           =

*   IT_FILTER                         =

*   IS_SEL_HIDE                       =

*   I_DEFAULT                         = 'X'

*   I_SAVE                            = ' '

*   IS_VARIANT                        =

   IT_EVENTS                         = T_EVENTS

*   IT_EVENT_EXIT                     =

*   IS_PRINT                          =

*   IS_REPREP_ID                      =

*   I_SCREEN_START_COLUMN             = 0

*   I_SCREEN_START_LINE               = 0

*   I_SCREEN_END_COLUMN               = 0

*   I_SCREEN_END_LINE                 = 0

*   I_HTML_HEIGHT_TOP                 = 0

*   I_HTML_HEIGHT_END                 = 0

*   IT_ALV_GRAPHICS                   =

*   IT_HYPERLINK                      =

*   IT_ADD_FIELDCAT                   =

*   IT_EXCEPT_QINFO                   =

*   IR_SALV_FULLSCREEN_ADAPTER        =

* IMPORTING

*   E_EXIT_CAUSED_BY_CALLER           =

*   ES_EXIT_CAUSED_BY_USER            =

  TABLES

    T_OUTTAB                          = T_KNA1

* EXCEPTIONS

*   PROGRAM_ERROR                     = 1

*   OTHERS                            = 2

          .

FORM SUB .

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

  EXPORTING

    IT_LIST_COMMENTARY       = T_COMMENTS

*   I_LOGO                   =

*   I_END_OF_LIST_GRID       =

*   I_ALV_FORM               =

          .

ENDFORM .

************************************************************************

*        FIRST DETAILED LIST                                                               *

************************************************************************

FORM SUB1 USING R_UCOMM LIKE SY-UCOMM

                RS_SELFIELD TYPE SLIS_SELFIELD .

*IF FNAME = 'KNA1-KUNNR' .

SELECT VBELN

        ERDAT

        NETWR  FROM VBAK INTO TABLE T_VBAK

               WHERE KUNNR = RS_SELFIELD-VALUE .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

*   I_INTERFACE_CHECK                 = ' '

*   I_BYPASSING_BUFFER                = ' '

*   I_BUFFER_ACTIVE                   = ' '

   I_CALLBACK_PROGRAM                = V_PROG

*   I_CALLBACK_PF_STATUS_SET          = ' '

*   I_CALLBACK_USER_COMMAND           = ' '

   I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'

*   I_CALLBACK_HTML_TOP_OF_PAGE       = 'top_of_page '

*   I_CALLBACK_HTML_END_OF_LIST       = ' '

*   I_STRUCTURE_NAME                  =

*   I_BACKGROUND_ID                   = ' '

*   I_GRID_TITLE                      =

*   I_GRID_SETTINGS                   =

*   IS_LAYOUT                         =

   IT_FIELDCAT                       = T_FCAT1

*   IT_EXCLUDING                      =

*   IT_SPECIAL_GROUPS                 =

*   IT_SORT                           =

*   IT_FILTER                         =

*   IS_SEL_HIDE                       =

*   I_DEFAULT                         = 'X'

*   I_SAVE                            = ' '

*   IS_VARIANT                        =

   IT_EVENTS                         = T_EVENTS1

*   IT_EVENT_EXIT                     =

*   IS_PRINT                          =

*   IS_REPREP_ID                      =

*   I_SCREEN_START_COLUMN             = 0

*   I_SCREEN_START_LINE               = 0

*   I_SCREEN_END_COLUMN               = 0

*   I_SCREEN_END_LINE                 = 0

*   I_HTML_HEIGHT_TOP                 = 0

*   I_HTML_HEIGHT_END                 = 0

*   IT_ALV_GRAPHICS                   =

*   IT_HYPERLINK                      =

*   IT_ADD_FIELDCAT                   =

*   IT_EXCEPT_QINFO                   =

*   IR_SALV_FULLSCREEN_ADAPTER        =

* IMPORTING

*   E_EXIT_CAUSED_BY_CALLER           =

*   ES_EXIT_CAUSED_BY_USER            =

  TABLES

    T_OUTTAB                          = T_VBAK

* EXCEPTIONS

*   PROGRAM_ERROR                     = 1

*   OTHERS                            = 2

          .

ENDFORM .

FORM SUB2 USING r_ucomm LIKE sy-ucomm

               rs_selfield TYPE slis_selfield.

SELECT POSNR

       ARKTX

       WERKS FROM VBAP INTO TABLE T_VBAP

             WHERE VBELN =  RS_SELFIELD-VALUE .

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

   EXPORTING

*     I_INTERFACE_CHECK                 = ' '

*     I_BYPASSING_BUFFER                = ' '

*     I_BUFFER_ACTIVE                   = '1111111111111 '

*     I_CALLBACK_PROGRAM                = ' '

*     I_CALLBACK_PF_STATUS_SET          = ' '

*     I_CALLBACK_USER_COMMAND           = ' '

     I_CALLBACK_TOP_OF_PAGE            = ' TOP_OF_PAGE'

*     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '

*     I_CALLBACK_HTML_END_OF_LIST       = ' '

*     I_STRUCTURE_NAME                  =

*     I_BACKGROUND_ID                   = ' '

*     I_GRID_TITLE                      =

*     I_GRID_SETTINGS                   =

*     IS_LAYOUT                         =

     IT_FIELDCAT                       = T_FCAT2

*     IT_EXCLUDING                      =

*     IT_SPECIAL_GROUPS                 =

*     IT_SORT                           =

*     IT_FILTER                         =

*     IS_SEL_HIDE                       =

*     I_DEFAULT                         = 'X'

*     I_SAVE                            = ' '

*     IS_VARIANT                        =

*     IT_EVENTS                         = T_EVENTS1

*     IT_EVENT_EXIT                     =

*     IS_PRINT                          =

*     IS_REPREP_ID                      =

*     I_SCREEN_START_COLUMN             = 0

*     I_SCREEN_START_LINE               = 0

*     I_SCREEN_END_COLUMN               = 0

*     I_SCREEN_END_LINE                 = 0

*     I_HTML_HEIGHT_TOP                 = 0

*     I_HTML_HEIGHT_END                 = 0

*     IT_ALV_GRAPHICS                   =

*     IT_HYPERLINK                      =

*     IT_ADD_FIELDCAT                   =

*     IT_EXCEPT_QINFO                   =

*     IR_SALV_FULLSCREEN_ADAPTER        =

*   IMPORTING

*     E_EXIT_CAUSED_BY_CALLER           =

*     ES_EXIT_CAUSED_BY_USER            =

    TABLES

      T_OUTTAB                          = T_VBAP

*   EXCEPTIONS

*     PROGRAM_ERROR                     = 1

*     OTHERS                            = 2

            .

ENDFORM .

0 Kudos
197

In your code you have define the flowing:-

W_EVENTS-NAME ='TOP_OF_PAGE'.

W_EVENTS-FORM ='SUB'.

APPEND W_EVENTS2 TO T_EVENTS2 .

where as in the parameter I_CALLBACK_TOP_OF_PAGE you are passing 'TOP_OF_PAGE. it should be 'SUB' as you have define the form name as 'SUB.

The form name and the value passed to the parameter should always be same..

Check the code:-

TYPE-POOLS: slis .

TABLES : kna1 .

  

TYPES : BEGIN OF ty_kna1  ,

        kunnr  TYPE kna1-kunnr ,

        name1  TYPE kna1-name1 ,

        land1  TYPE kna1-land1 ,

        END OF ty_kna1 .

TYPES : BEGIN OF ty_vbak ,

        vbeln  TYPE vbak-vbeln ,

        erdat  TYPE vbak-erdat ,

        netwr  TYPE vbak-netwr ,

        END OF ty_vbak .

TYPES : BEGIN OF ty_vbap  ,

        posnr TYPE vbap-posnr ,

        arktx TYPE vbap-arktx ,

        werks TYPE vbap-werks ,

        END OF ty_vbap .

DATA : x TYPE i .

DATA : t_kna1 TYPE STANDARD TABLE OF ty_kna1 INITIAL SIZE 1 ,

        t_vbak TYPE STANDARD TABLE OF ty_vbak INITIAL SIZE 1 ,

        t_vbap TYPE STANDARD TABLE OF ty_vbap INITIAL SIZE 1 .

DATA : w_kna1 TYPE ty_kna1 ,

        w_vbak TYPE ty_vbak ,

        w_vbap TYPE ty_vbap .

DATA : w_fcat TYPE slis_fieldcat_alv .

DATA : t_fcat TYPE slis_t_fieldcat_alv .

DATA : t_fcat1 TYPE slis_t_fieldcat_alv .

DATA : t_fcat2 TYPE slis_t_fieldcat_alv .

DATA : w_comments TYPE slis_listheader .

DATAt_comments TYPE slis_t_listheader .

DATA : w_events TYPE slis_alv_event .

DATA : t_events TYPE slis_t_event .

DATA : w_events1 TYPE slis_alv_event .

DATA : t_events1 TYPE slis_t_event .

DATA : w_events2 TYPE slis_alv_event .

DATA : t_events2 TYPE slis_t_event .

DATA : v_prog TYPE sy-repid .

v_prog = sy-repid .

SELECT-OPTIONS : s_kunnr FOR kna1-kunnr .

w_fcat-col_pos = 1 .

w_fcat-fieldname = 'KUNNR '.

w_fcat-seltext_m = 'CUST NO'.

APPEND w_fcat TO t_fcat .

w_fcat-col_pos = 2 .

w_fcat-fieldname = 'NAME1 '.

w_fcat-seltext_m = 'CUST NAME'.

APPEND w_fcat TO t_fcat .

w_fcat-col_pos = 3 .

w_fcat-fieldname = 'LAND1 '.

w_fcat-seltext_m = 'CUST COUNTRY'.

APPEND w_fcat TO t_fcat .

w_fcat-col_pos = 1.

w_fcat-fieldname = 'VBELN '.

w_fcat-seltext_m = 'ORDER NO'.

APPEND w_fcat TO t_fcat1 .

w_fcat-col_pos = 2 .

w_fcat-fieldname = 'ERDAT '.

w_fcat-seltext_m = 'ORDER DATA'.

APPEND w_fcat TO t_fcat1 .

w_fcat-col_pos = 3.

w_fcat-fieldname = 'NETWR '.

w_fcat-seltext_m = 'NET VALUE'.

APPEND w_fcat TO t_fcat1 .

w_fcat-col_pos = 1.

w_fcat-fieldname = 'POSNR '.

w_fcat-seltext_m = 'SALES ITEM '.

APPEND w_fcat TO t_fcat2 .

w_fcat-col_pos = 2.

w_fcat-fieldname = 'ARKTX '.

w_fcat-seltext_m = 'SALES DESC'.

APPEND w_fcat TO t_fcat2 .

w_fcat-col_pos = 3.

w_fcat-fieldname = 'WERKS '.

w_fcat-seltext_m = 'PLANT'.

APPEND w_fcat TO t_fcat2 .

w_comments-typ ='H'.

w_comments-info ='CUSTOMER DATA'.

APPEND w_comments TO t_comments .

w_comments-typ ='S'.

w_comments-key ='CUST NO'.

w_comments-info ='0000001000'.

APPEND w_comments TO t_comments .

w_events-name ='TOP_OF_PAGE'.

w_events-form ='SUB'.

APPEND w_events2 TO t_events2 .

w_events-name = 'USER_COMMAND'.

w_events-form = 'SUB1'.

APPEND w_events TO t_events .

w_events1-name = 'USER_COMMAND'.

w_events1-form = 'SUB2'.

APPEND w_events1 TO t_events1 .

DATA: ls_line   TYPE slis_listheader,

        it_top_of_page  TYPE slis_t_listheader.

*ls_line-typ  = 'H'.

*ls_line-info = 'Customer Detail'.

*APPEND ls_line TO it_top_of_page.

*CLEAR ls_line.

SELECT kunnr

        name1

        land1 FROM kna1 INTO TABLE t_kna1

              WHERE kunnr IN s_kunnr .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

*   I_INTERFACE_CHECK                 = ' '

*   I_BYPASSING_BUFFER                = ' '

*   I_BUFFER_ACTIVE                   = ' '

    i_callback_program                = v_prog

*   I_CALLBACK_PF_STATUS_SET          = ' '

*   I_CALLBACK_USER_COMMAND           = ' '

*   i_callback_top_of_page            = 'TOP_OF_PAGE'

    i_callback_top_of_page            = 'SUB'

*   I_CALLBACK_HTML_TOP_OF_PAGE       = 'TOP_OF_PAGE'

*   I_CALLBACK_HTML_END_OF_LIST       = ' '

*   I_STRUCTURE_NAME                  =

*   I_BACKGROUND_ID                   = ' '

*   I_GRID_TITLE                      =

*   I_GRID_SETTINGS                   =

*   IS_LAYOUT                         =

    it_fieldcat                       = t_fcat

*   IT_EXCLUDING                      =

*   IT_SPECIAL_GROUPS                 =

*   IT_SORT                           =

*   IT_FILTER                         =

*   IS_SEL_HIDE                       =

*   I_DEFAULT                         = 'X'

*   I_SAVE                            = ' '

*   IS_VARIANT                        =

    it_events                         = t_events

*   IT_EVENT_EXIT                     =

*   IS_PRINT                          =

*   IS_REPREP_ID                      =

*   I_SCREEN_START_COLUMN             = 0

*   I_SCREEN_START_LINE               = 0

*   I_SCREEN_END_COLUMN               = 0

*   I_SCREEN_END_LINE                 = 0

*   I_HTML_HEIGHT_TOP                 = 0

*   I_HTML_HEIGHT_END                 = 0

*   IT_ALV_GRAPHICS                   =

*   IT_HYPERLINK                      =

*   IT_ADD_FIELDCAT                   =

*   IT_EXCEPT_QINFO                   =

*   IR_SALV_FULLSCREEN_ADAPTER        =

* IMPORTING

*   E_EXIT_CAUSED_BY_CALLER           =

*   ES_EXIT_CAUSED_BY_USER            =

   TABLES

     t_outtab                          = t_kna1

* EXCEPTIONS

*   PROGRAM_ERROR                     = 1

*   OTHERS                            = 2

           .

*&---------------------------------------------------------------------*

*&      Form  SUB

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

FORM sub .

   CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

     EXPORTING

       it_list_commentary       = t_comments

*   I_LOGO                   =

*   I_END_OF_LIST_GRID       =

*   I_ALV_FORM               =

             .

ENDFORM .                    "SUB

************************************************************************

*        FIRST DETAILED LIST                                                               *

************************************************************************

FORM sub1 USING r_ucomm LIKE sy-ucomm

                 rs_selfield TYPE slis_selfield .

*IF FNAME = 'KNA1-KUNNR' .

   SELECT vbeln

           erdat

           netwr  FROM vbak INTO TABLE t_vbak

                  WHERE kunnr = rs_selfield-value .

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

   EXPORTING

*   I_INTERFACE_CHECK                 = ' '

*   I_BYPASSING_BUFFER                = ' '

*   I_BUFFER_ACTIVE                   = ' '

      i_callback_program                = v_prog

*   I_CALLBACK_PF_STATUS_SET          = ' '

*   I_CALLBACK_USER_COMMAND           = ' '

*     i_callback_top_of_page            = 'TOP_OF_PAGE'

      i_callback_top_of_page            = 'SUB'

*   I_CALLBACK_HTML_TOP_OF_PAGE       = 'top_of_page '

*   I_CALLBACK_HTML_END_OF_LIST       = ' '

*   I_STRUCTURE_NAME                  =

*   I_BACKGROUND_ID                   = ' '

*   I_GRID_TITLE                      =

*   I_GRID_SETTINGS                   =

*   IS_LAYOUT                         =

      it_fieldcat                       = t_fcat1

*   IT_EXCLUDING                      =

*   IT_SPECIAL_GROUPS                 =

*   IT_SORT                           =

*   IT_FILTER                         =

*   IS_SEL_HIDE                       =

*   I_DEFAULT                         = 'X'

*   I_SAVE                            = ' '

*   IS_VARIANT                        =

      it_events                         = t_events1

*   IT_EVENT_EXIT                     =

*   IS_PRINT                          =

*   IS_REPREP_ID                      =

*   I_SCREEN_START_COLUMN             = 0

*   I_SCREEN_START_LINE               = 0

*   I_SCREEN_END_COLUMN               = 0

*   I_SCREEN_END_LINE                 = 0

*   I_HTML_HEIGHT_TOP                 = 0

*   I_HTML_HEIGHT_END                 = 0

*   IT_ALV_GRAPHICS                   =

*   IT_HYPERLINK                      =

*   IT_ADD_FIELDCAT                   =

*   IT_EXCEPT_QINFO                   =

*   IR_SALV_FULLSCREEN_ADAPTER        =

* IMPORTING

*   E_EXIT_CAUSED_BY_CALLER           =

*   ES_EXIT_CAUSED_BY_USER            =

     TABLES

       t_outtab                          = t_vbak

* EXCEPTIONS

*   PROGRAM_ERROR                     = 1

*   OTHERS                            = 2

             .

ENDFORM .                    "SUB1

*&---------------------------------------------------------------------*

*&      Form  SUB2

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->R_UCOMM      text

*      -->RS_SELFIELD  text

*----------------------------------------------------------------------*

FORM sub2 USING r_ucomm LIKE sy-ucomm

                rs_selfield TYPE slis_selfield.

   SELECT posnr

          arktx

          werks FROM vbap INTO TABLE t_vbap

                WHERE vbeln rs_selfield-value .

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

*     I_INTERFACE_CHECK                 = ' '

*     I_BYPASSING_BUFFER                = ' '

*     I_BUFFER_ACTIVE                   = '1111111111111 '

*     I_CALLBACK_PROGRAM                = ' '

*     I_CALLBACK_PF_STATUS_SET          = ' '

*     I_CALLBACK_USER_COMMAND           = ' '

*     i_callback_top_of_page            = ' TOP_OF_PAGE'

      i_callback_top_of_page            = 'SUB'

*     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '

*     I_CALLBACK_HTML_END_OF_LIST       = ' '

*     I_STRUCTURE_NAME                  =

*     I_BACKGROUND_ID                   = ' '

*     I_GRID_TITLE                      =

*     I_GRID_SETTINGS                   =

*     IS_LAYOUT                         =

      it_fieldcat                       = t_fcat2

*     IT_EXCLUDING                      =

*     IT_SPECIAL_GROUPS                 =

*     IT_SORT                           =

*     IT_FILTER                         =

*     IS_SEL_HIDE                       =

*     I_DEFAULT                         = 'X'

*     I_SAVE                            = ' '

*     IS_VARIANT                        =

*     IT_EVENTS                         = T_EVENTS1

*     IT_EVENT_EXIT                     =

*     IS_PRINT                          =

*     IS_REPREP_ID                      =

*     I_SCREEN_START_COLUMN             = 0

*     I_SCREEN_START_LINE               = 0

*     I_SCREEN_END_COLUMN               = 0

*     I_SCREEN_END_LINE                 = 0

*     I_HTML_HEIGHT_TOP                 = 0

*     I_HTML_HEIGHT_END                 = 0

*     IT_ALV_GRAPHICS                   =

*     IT_HYPERLINK                      =

*     IT_ADD_FIELDCAT                   =

*     IT_EXCEPT_QINFO                   =

*     IR_SALV_FULLSCREEN_ADAPTER        =

*   IMPORTING

*     E_EXIT_CAUSED_BY_CALLER           =

*     ES_EXIT_CAUSED_BY_USER            =

     TABLES

       t_outtab                          = t_vbap

*   EXCEPTIONS

*     PROGRAM_ERROR                     = 1

*     OTHERS                            = 2

             .

ENDFORM .                    "SUB2

0 Kudos
197

By this it is displaying top of page but now my error is not displaying in secondary list....

0 Kudos
197

What error are you displaying in the secondary list?

0 Kudos
197

blank list with no data.....if i comment callback top of page then data is displaying

0 Kudos
197

no data is displaying in secondary list when using callback for top of page

0 Kudos
197

Why do you want to display blank list as error. If there is no data found for the selected customer than secondary list should not be displayed This will also mean that there is no data found for the selected customer.

When i am executing the same code I am able to display the blank screen with top of page and along with the data also, if any exists.

0 Kudos
197

share the code that is displaying top of page and secondary list data as well....But in my code when using callback for top of page den not showing data in secondary list even if the data exist

0 Kudos
197

are you using the same code which i have pasted or you are modifying your own code taking reference from the given code.

If this is the case I would suggest you just cut and paste the given code without and execute the same without any modification.

hope this will help you out.

0 Kudos
197

can u pls share ur code dat u have executed

0 Kudos
197

TYPE-POOLS: SLIS .

TABLES : KNA1 .

TYPES : BEGIN OF TY_KNA1  ,

       KUNNR  TYPE KNA1-KUNNR ,

       NAME1  TYPE KNA1-NAME1 ,

       LAND1  TYPE KNA1-LAND1 ,

       END OF TY_KNA1 .

TYPES : BEGIN OF TY_VBAK ,

       VBELN  TYPE VBAK-VBELN ,

       ERDAT  TYPE VBAK-ERDAT ,

       NETWR  TYPE VBAK-NETWR ,

       END OF TY_VBAK .

TYPES : BEGIN OF TY_VBAP  ,

       POSNR TYPE VBAP-POSNR ,

       ARKTX TYPE VBAP-ARKTX ,

       WERKS TYPE VBAP-WERKS ,

       END OF TY_VBAP .

DATA : X TYPE I .

DATA : T_KNA1 TYPE STANDARD TABLE OF TY_KNA1 INITIAL SIZE 1 ,

       T_VBAK TYPE STANDARD TABLE OF TY_VBAK INITIAL SIZE 1 ,

       T_VBAP TYPE STANDARD TABLE OF TY_VBAP INITIAL SIZE 1 .

DATA : W_KNA1 TYPE TY_KNA1 ,

       W_VBAK TYPE TY_VBAK ,

       W_VBAP TYPE TY_VBAP .

DATA : W_FCAT TYPE SLIS_FIELDCAT_ALV .

DATA : T_FCAT TYPE SLIS_T_FIELDCAT_ALV .

DATA : T_FCAT1 TYPE SLIS_T_FIELDCAT_ALV .

DATA : T_FCAT2 TYPE SLIS_T_FIELDCAT_ALV .

DATA : W_COMMENTS TYPE slis_listheader .

DATA:  T_COMMENTS TYPE slis_t_listheader .

DATA : W_EVENTS TYPE SLIS_ALV_EVENT .

DATA : T_EVENTS TYPE SLIS_T_EVENT .

DATA : W_EVENTS1 TYPE SLIS_ALV_EVENT .

DATA : T_EVENTS1 TYPE SLIS_T_EVENT .

DATA : W_EVENTS2 TYPE SLIS_ALV_EVENT .

DATA : T_EVENTS2 TYPE SLIS_T_EVENT .

DATA : V_PROG TYPE SY-REPID .

      V_PROG = SY-REPID .

SELECT-OPTIONS : S_KUNNR FOR KNA1-KUNNR .

W_FCAT-COL_POS = 1 .

W_FCAT-FIELDNAME = 'KUNNR '.

W_FCAT-SELTEXT_M = 'CUST NO'.

APPEND W_FCAT TO T_FCAT .

W_FCAT-COL_POS = 2 .

W_FCAT-FIELDNAME = 'NAME1 '.

W_FCAT-SELTEXT_M = 'CUST NAME'.

APPEND W_FCAT TO T_FCAT .

W_FCAT-COL_POS = 3 .

W_FCAT-FIELDNAME = 'LAND1 '.

W_FCAT-SELTEXT_M = 'CUST COUNTRY'.

APPEND W_FCAT TO T_FCAT .

W_FCAT-COL_POS = 1.

W_FCAT-FIELDNAME = 'VBELN '.

W_FCAT-SELTEXT_M = 'ORDER NO'.

APPEND W_FCAT TO T_FCAT1 .

W_FCAT-COL_POS = 2 .

W_FCAT-FIELDNAME = 'ERDAT '.

W_FCAT-SELTEXT_M = 'ORDER DATA'.

APPEND W_FCAT TO T_FCAT1 .

W_FCAT-COL_POS = 3.

W_FCAT-FIELDNAME = 'NETWR '.

W_FCAT-SELTEXT_M = 'NET VALUE'.

APPEND W_FCAT TO T_FCAT1 .

W_FCAT-COL_POS = 1.

W_FCAT-FIELDNAME = 'POSNR '.

W_FCAT-SELTEXT_M = 'SALES ITEM '.

APPEND W_FCAT TO T_FCAT2 .

W_FCAT-COL_POS = 2.

W_FCAT-FIELDNAME = 'ARKTX '.

W_FCAT-SELTEXT_M = 'SALES DESC'.

APPEND W_FCAT TO T_FCAT2 .

W_FCAT-COL_POS = 3.

W_FCAT-FIELDNAME = 'WERKS '.

W_FCAT-SELTEXT_M = 'PLANT'.

APPEND W_FCAT TO T_FCAT2 .

W_COMMENTS-TYP ='H'.

W_COMMENTS-INFO ='CUSTOMER DATA'.

APPEND W_COMMENTS TO T_COMMENTS .

W_COMMENTS-TYP ='S'.

W_COMMENTS-KEY ='CUST NO'.

W_COMMENTS-INFO ='0000001000'.

APPEND W_COMMENTS TO T_COMMENTS .

W_EVENTS-NAME ='TOP_OF_PAGE'.

W_EVENTS-FORM ='SUB'.

APPEND W_EVENTS2 TO T_EVENTS2 .

W_EVENTS-NAME = 'USER_COMMAND'.

W_EVENTS-FORM = 'SUB1'.

APPEND W_EVENTS TO T_EVENTS .

*W_EVENTS1-NAME = 'USER_COMMAND'.

*W_EVENTS1-FORM = 'SUB2'.

*

*APPEND W_EVENTS1 TO T_EVENTS1 .

*DATA: ls_line   TYPE slis_listheader,

*       it_top_of_page  TYPE slis_t_listheader.

*ls_line-typ  = 'H'.

*ls_line-info = 'Customer Detail'.

*APPEND ls_line TO it_top_of_page.

*CLEAR ls_line.

SELECT KUNNR

       NAME1

       LAND1 FROM KNA1 INTO TABLE T_KNA1

             WHERE KUNNR IN S_KUNNR .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

*   I_INTERFACE_CHECK                 = ' '

*   I_BYPASSING_BUFFER                = ' '

*   I_BUFFER_ACTIVE                   = ' '

   I_CALLBACK_PROGRAM                = V_PROG

*   I_CALLBACK_PF_STATUS_SET          = ' '

*   I_CALLBACK_USER_COMMAND           = ' '

   I_CALLBACK_TOP_OF_PAGE            = 'subccc'

*   I_CALLBACK_HTML_TOP_OF_PAGE       = 'top_of_page'

*   I_CALLBACK_HTML_END_OF_LIST       = ' '

*   I_STRUCTURE_NAME                  =

*   I_BACKGROUND_ID                   = ' '

*   I_GRID_TITLE                      =

*   I_GRID_SETTINGS                   =

*   IS_LAYOUT                         =

   IT_FIELDCAT                       = T_FCAT

*   IT_EXCLUDING                      =

*   IT_SPECIAL_GROUPS                 =

*   IT_SORT                           =

*   IT_FILTER                         =

*   IS_SEL_HIDE                       =

*   I_DEFAULT                         = 'X'

*   I_SAVE                            = ' '

*   IS_VARIANT                        =

   IT_EVENTS                         = T_EVENTS

*   IT_EVENT_EXIT                     =

*   IS_PRINT                          =

*   IS_REPREP_ID                      =

*   I_SCREEN_START_COLUMN             = 0

*   I_SCREEN_START_LINE               = 0

*   I_SCREEN_END_COLUMN               = 0

*   I_SCREEN_END_LINE                 = 0

*   I_HTML_HEIGHT_TOP                 = 0

*   I_HTML_HEIGHT_END                 = 0

*   IT_ALV_GRAPHICS                   =

*   IT_HYPERLINK                      =

*   IT_ADD_FIELDCAT                   =

*   IT_EXCEPT_QINFO                   =

*   IR_SALV_FULLSCREEN_ADAPTER        =

* IMPORTING

*   E_EXIT_CAUSED_BY_CALLER           =

*   ES_EXIT_CAUSED_BY_USER            =

  TABLES

    T_OUTTAB                          = T_KNA1

* EXCEPTIONS

*   PROGRAM_ERROR                     = 1

*   OTHERS                            = 2

          .

*FORM SUB .

*CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

*  EXPORTING

*    IT_LIST_COMMENTARY       = T_COMMENTS

**   I_LOGO                   =

**   I_END_OF_LIST_GRID       =

**   I_ALV_FORM               =

*          .

*ENDFORM .

************************************************************************

*        FIRST DETAILED LIST                                                               *

************************************************************************

FORM SUB1 USING R_UCOMM LIKE SY-UCOMM

                RS_SELFIELD TYPE SLIS_SELFIELD .

*IF FNAME = 'KNA1-KUNNR' .

SELECT VBELN

        ERDAT

        NETWR  FROM VBAK INTO TABLE T_VBAK

               WHERE KUNNR = RS_SELFIELD-VALUE .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

*   I_INTERFACE_CHECK                 = ' '

*   I_BYPASSING_BUFFER                = ' '

*   I_BUFFER_ACTIVE                   = ' '

   I_CALLBACK_PROGRAM                = V_PROG

*   I_CALLBACK_PF_STATUS_SET          = ' '

*   I_CALLBACK_USER_COMMAND           = ' '

   I_CALLBACK_TOP_OF_PAGE            = 'sub'

*   I_CALLBACK_HTML_TOP_OF_PAGE       = 'top_of_page '

*   I_CALLBACK_HTML_END_OF_LIST       = ' '

*   I_STRUCTURE_NAME                  =

*   I_BACKGROUND_ID                   = ' '

*   I_GRID_TITLE                      =

*   I_GRID_SETTINGS                   =

*   IS_LAYOUT                         =

   IT_FIELDCAT                       = T_FCAT1

*   IT_EXCLUDING                      =

*   IT_SPECIAL_GROUPS                 =

*   IT_SORT                           =

*   IT_FILTER                         =

*   IS_SEL_HIDE                       =

*   I_DEFAULT                         = 'X'

*   I_SAVE                            = ' '

*   IS_VARIANT                        =

   IT_EVENTS                         = T_EVENTS1

*   IT_EVENT_EXIT                     =

*   IS_PRINT                          =

*   IS_REPREP_ID                      =

*   I_SCREEN_START_COLUMN             = 0

*   I_SCREEN_START_LINE               = 0

*   I_SCREEN_END_COLUMN               = 0

*   I_SCREEN_END_LINE                 = 0

*   I_HTML_HEIGHT_TOP                 = 0

*   I_HTML_HEIGHT_END                 = 0

*   IT_ALV_GRAPHICS                   =

*   IT_HYPERLINK                      =

*   IT_ADD_FIELDCAT                   =

*   IT_EXCEPT_QINFO                   =

*   IR_SALV_FULLSCREEN_ADAPTER        =

* IMPORTING

*   E_EXIT_CAUSED_BY_CALLER           =

*   ES_EXIT_CAUSED_BY_USER            =

  TABLES

    T_OUTTAB                          = T_VBAK

* EXCEPTIONS

*   PROGRAM_ERROR                     = 1

*   OTHERS                            = 2

          .

ENDFORM .

FORM SUB2 USING r_ucomm LIKE sy-ucomm

               rs_selfield TYPE slis_selfield.

SELECT POSNR

       ARKTX

       WERKS FROM VBAP INTO TABLE T_VBAP

             WHERE VBELN =  RS_SELFIELD-VALUE .

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

   EXPORTING

*     I_INTERFACE_CHECK                 = ' '

*     I_BYPASSING_BUFFER                = ' '

*     I_BUFFER_ACTIVE                   = '1111111111111 '

*     I_CALLBACK_PROGRAM                = ' '

*     I_CALLBACK_PF_STATUS_SET          = ' '

*     I_CALLBACK_USER_COMMAND           = ' '

     I_CALLBACK_TOP_OF_PAGE            = ' sub'

*     I_CALLBACK_HTML_TOP_OF_PAGE       = 'top_of_page '

     I_CALLBACK_HTML_END_OF_LIST       = ' '

*     I_STRUCTURE_NAME                  =

*     I_BACKGROUND_ID                   = ' '

*     I_GRID_TITLE                      =

*     I_GRID_SETTINGS                   =

*     IS_LAYOUT                         =

     IT_FIELDCAT                       = T_FCAT2

*     IT_EXCLUDING                      =

*     IT_SPECIAL_GROUPS                 =

*     IT_SORT                           =

*     IT_FILTER                         =

*     IS_SEL_HIDE                       =

*     I_DEFAULT                         = 'X'

*     I_SAVE                            = ' '

*     IS_VARIANT                        =

*     IT_EVENTS                         = T_EVENTS1

*     IT_EVENT_EXIT                     =

*     IS_PRINT                          =

*     IS_REPREP_ID                      =

*     I_SCREEN_START_COLUMN             = 0

*     I_SCREEN_START_LINE               = 0

*     I_SCREEN_END_COLUMN               = 0

*     I_SCREEN_END_LINE                 = 0

*     I_HTML_HEIGHT_TOP                 = 0

*     I_HTML_HEIGHT_END                 = 0

*     IT_ALV_GRAPHICS                   =

*     IT_HYPERLINK                      =

*     IT_ADD_FIELDCAT                   =

*     IT_EXCEPT_QINFO                   =

*     IR_SALV_FULLSCREEN_ADAPTER        =

*   IMPORTING

*     E_EXIT_CAUSED_BY_CALLER           =

*     ES_EXIT_CAUSED_BY_USER            =

    TABLES

      T_OUTTAB                          = T_VBAP

*   EXCEPTIONS

*     PROGRAM_ERROR                     = 1

*     OTHERS                            = 2

            .

ENDFORM .

0 Kudos
197

Just cut and paste. Do not modify any thing and than execute.

TYPE-POOLS: slis .

TABLES : kna1 .

TYPES : BEGIN OF ty_kna1  ,

         kunnr  TYPE kna1-kunnr ,

         name1  TYPE kna1-name1 ,

         land1  TYPE kna1-land1 ,

         END OF ty_kna1 .

TYPES : BEGIN OF ty_vbak ,

         vbeln  TYPE vbak-vbeln ,

         erdat  TYPE vbak-erdat ,

         netwr  TYPE vbak-netwr ,

         END OF ty_vbak .

TYPES : BEGIN OF ty_vbap  ,

         posnr TYPE vbap-posnr ,

         arktx TYPE vbap-arktx ,

         werks TYPE vbap-werks ,

         END OF ty_vbap .

DATA : x TYPE i .

DATA : t_kna1 TYPE STANDARD TABLE OF ty_kna1 INITIAL SIZE 1 ,

         t_vbak TYPE STANDARD TABLE OF ty_vbak INITIAL SIZE 1 ,

         t_vbap TYPE STANDARD TABLE OF ty_vbap INITIAL SIZE 1 .

DATA : w_kna1 TYPE ty_kna1 ,

         w_vbak TYPE ty_vbak ,

         w_vbap TYPE ty_vbap .

DATA : w_fcat TYPE slis_fieldcat_alv .

DATA : t_fcat TYPE slis_t_fieldcat_alv .

DATA : t_fcat1 TYPE slis_t_fieldcat_alv .

DATA : t_fcat2 TYPE slis_t_fieldcat_alv .

DATA : w_comments TYPE slis_listheader .

DATAt_comments TYPE slis_t_listheader .

DATA : w_events TYPE slis_alv_event .

DATA : t_events TYPE slis_t_event .

DATA : w_events1 TYPE slis_alv_event .

DATA : t_events1 TYPE slis_t_event .

DATA : w_events2 TYPE slis_alv_event .

DATA : t_events2 TYPE slis_t_event .

DATA : v_prog TYPE sy-repid .

v_prog = sy-repid .

SELECT-OPTIONS : s_kunnr FOR kna1-kunnr .

w_fcat-col_pos = 1 .

w_fcat-fieldname = 'KUNNR '.

w_fcat-seltext_m = 'CUST NO'.

APPEND w_fcat TO t_fcat .

w_fcat-col_pos = 2 .

w_fcat-fieldname = 'NAME1 '.

w_fcat-seltext_m = 'CUST NAME'.

APPEND w_fcat TO t_fcat .

w_fcat-col_pos = 3 .

w_fcat-fieldname = 'LAND1 '.

w_fcat-seltext_m = 'CUST COUNTRY'.

APPEND w_fcat TO t_fcat .

w_fcat-col_pos = 1.

w_fcat-fieldname = 'VBELN '.

w_fcat-seltext_m = 'ORDER NO'.

APPEND w_fcat TO t_fcat1 .

w_fcat-col_pos = 2 .

w_fcat-fieldname = 'ERDAT '.

w_fcat-seltext_m = 'ORDER DATA'.

APPEND w_fcat TO t_fcat1 .

w_fcat-col_pos = 3.

w_fcat-fieldname = 'NETWR '.

w_fcat-seltext_m = 'NET VALUE'.

APPEND w_fcat TO t_fcat1 .

w_fcat-col_pos = 1.

w_fcat-fieldname = 'POSNR '.

w_fcat-seltext_m = 'SALES ITEM '.

APPEND w_fcat TO t_fcat2 .

w_fcat-col_pos = 2.

w_fcat-fieldname = 'ARKTX '.

w_fcat-seltext_m = 'SALES DESC'.

APPEND w_fcat TO t_fcat2 .

w_fcat-col_pos = 3.

w_fcat-fieldname = 'WERKS '.

w_fcat-seltext_m = 'PLANT'.

APPEND w_fcat TO t_fcat2 .

w_comments-typ ='H'.

w_comments-info ='CUSTOMER DATA'.

APPEND w_comments TO t_comments .

w_comments-typ ='S'.

w_comments-key ='CUST NO'.

w_comments-info ='0000001000'.

APPEND w_comments TO t_comments .

w_events-name ='TOP_OF_PAGE'.

w_events-form ='SUB'.

APPEND w_events2 TO t_events2 .

w_events-name = 'USER_COMMAND'.

w_events-form = 'SUB1'.

APPEND w_events TO t_events .

w_events1-name = 'USER_COMMAND'.

w_events1-form = 'SUB2'.

APPEND w_events1 TO t_events1 .

DATA: ls_line   TYPE slis_listheader,

         it_top_of_page  TYPE slis_t_listheader.

*ls_line-typ  = 'H'.

*ls_line-info = 'Customer Detail'.

*APPEND ls_line TO it_top_of_page.

*CLEAR ls_line.

SELECT kunnr

         name1

         land1 FROM kna1 INTO TABLE t_kna1

               WHERE kunnr IN s_kunnr .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

*   I_INTERFACE_CHECK                 = ' '

*   I_BYPASSING_BUFFER                = ' '

*   I_BUFFER_ACTIVE                   = ' '

     i_callback_program                = v_prog

*   I_CALLBACK_PF_STATUS_SET          = ' '

*   I_CALLBACK_USER_COMMAND           = ' '

*   i_callback_top_of_page            = 'TOP_OF_PAGE'

     i_callback_top_of_page            = 'SUB'

*   I_CALLBACK_HTML_TOP_OF_PAGE       = 'TOP_OF_PAGE'

*   I_CALLBACK_HTML_END_OF_LIST       = ' '

*   I_STRUCTURE_NAME                  =

*   I_BACKGROUND_ID                   = ' '

*   I_GRID_TITLE                      =

*   I_GRID_SETTINGS                   =

*   IS_LAYOUT                         =

     it_fieldcat                       = t_fcat

*   IT_EXCLUDING                      =

*   IT_SPECIAL_GROUPS                 =

*   IT_SORT                           =

*   IT_FILTER                         =

*   IS_SEL_HIDE                       =

*   I_DEFAULT                         = 'X'

*   I_SAVE                            = ' '

*   IS_VARIANT                        =

     it_events                         = t_events

*   IT_EVENT_EXIT                     =

*   IS_PRINT                          =

*   IS_REPREP_ID                      =

*   I_SCREEN_START_COLUMN             = 0

*   I_SCREEN_START_LINE               = 0

*   I_SCREEN_END_COLUMN               = 0

*   I_SCREEN_END_LINE                 = 0

*   I_HTML_HEIGHT_TOP                 = 0

*   I_HTML_HEIGHT_END                 = 0

*   IT_ALV_GRAPHICS                   =

*   IT_HYPERLINK                      =

*   IT_ADD_FIELDCAT                   =

*   IT_EXCEPT_QINFO                   =

*   IR_SALV_FULLSCREEN_ADAPTER        =

* IMPORTING

*   E_EXIT_CAUSED_BY_CALLER           =

*   ES_EXIT_CAUSED_BY_USER            =

    TABLES

      t_outtab                          = t_kna1

* EXCEPTIONS

*   PROGRAM_ERROR                     = 1

*   OTHERS                            = 2

            .

*&---------------------------------------------------------------------*

*&      Form  SUB

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

FORM sub .

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

      EXPORTING

        it_list_commentary       = t_comments

*   I_LOGO                   =

*   I_END_OF_LIST_GRID       =

*   I_ALV_FORM               =

              .

ENDFORM .                    "SUB

************************************************************************

*        FIRST DETAILED LIST                                                               *

************************************************************************

FORM sub1 USING r_ucomm LIKE sy-ucomm

                  rs_selfield TYPE slis_selfield .

*IF FNAME = 'KNA1-KUNNR' .

    SELECT vbeln

            erdat

            netwr  FROM vbak INTO TABLE t_vbak

                   WHERE kunnr = rs_selfield-value .

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

*   I_INTERFACE_CHECK                 = ' '

*   I_BYPASSING_BUFFER                = ' '

*   I_BUFFER_ACTIVE                   = ' '

       i_callback_program                = v_prog

*   I_CALLBACK_PF_STATUS_SET          = ' '

*   I_CALLBACK_USER_COMMAND           = ' '

*     i_callback_top_of_page            = 'TOP_OF_PAGE'

       i_callback_top_of_page            = 'SUB'

*   I_CALLBACK_HTML_TOP_OF_PAGE       = 'top_of_page '

*   I_CALLBACK_HTML_END_OF_LIST       = ' '

*   I_STRUCTURE_NAME                  =

*   I_BACKGROUND_ID                   = ' '

*   I_GRID_TITLE                      =

*   I_GRID_SETTINGS                   =

*   IS_LAYOUT                         =

       it_fieldcat                       = t_fcat1

*   IT_EXCLUDING                      =

*   IT_SPECIAL_GROUPS                 =

*   IT_SORT                           =

*   IT_FILTER                         =

*   IS_SEL_HIDE                       =

*   I_DEFAULT                         = 'X'

*   I_SAVE                            = ' '

*   IS_VARIANT                        =

       it_events                         = t_events1

*   IT_EVENT_EXIT                     =

*   IS_PRINT                          =

*   IS_REPREP_ID                      =

*   I_SCREEN_START_COLUMN             = 0

*   I_SCREEN_START_LINE               = 0

*   I_SCREEN_END_COLUMN               = 0

*   I_SCREEN_END_LINE                 = 0

*   I_HTML_HEIGHT_TOP                 = 0

*   I_HTML_HEIGHT_END                 = 0

*   IT_ALV_GRAPHICS                   =

*   IT_HYPERLINK                      =

*   IT_ADD_FIELDCAT                   =

*   IT_EXCEPT_QINFO                   =

*   IR_SALV_FULLSCREEN_ADAPTER        =

* IMPORTING

*   E_EXIT_CAUSED_BY_CALLER           =

*   ES_EXIT_CAUSED_BY_USER            =

      TABLES

        t_outtab                          = t_vbak

* EXCEPTIONS

*   PROGRAM_ERROR                     = 1

*   OTHERS                            = 2

              .

ENDFORM .                    "SUB1

*&---------------------------------------------------------------------*

*&      Form  SUB2

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->R_UCOMM      text

*      -->RS_SELFIELD  text

*----------------------------------------------------------------------*

FORM sub2 USING r_ucomm LIKE sy-ucomm

                 rs_selfield TYPE slis_selfield.

    SELECT posnr

           arktx

           werks FROM vbap INTO TABLE t_vbap

                 WHERE vbeln rs_selfield-value .

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

     EXPORTING

*     I_INTERFACE_CHECK                 = ' '

*     I_BYPASSING_BUFFER                = ' '

*     I_BUFFER_ACTIVE                   = '1111111111111 '

*     I_CALLBACK_PROGRAM                = ' '

*     I_CALLBACK_PF_STATUS_SET          = ' '

*     I_CALLBACK_USER_COMMAND           = ' '

*     i_callback_top_of_page            = ' TOP_OF_PAGE'

       i_callback_top_of_page            = 'SUB'

*     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '

*     I_CALLBACK_HTML_END_OF_LIST       = ' '

*     I_STRUCTURE_NAME                  =

*     I_BACKGROUND_ID                   = ' '

*     I_GRID_TITLE                      =

*     I_GRID_SETTINGS                   =

*     IS_LAYOUT                         =

       it_fieldcat                       = t_fcat2

*     IT_EXCLUDING                      =

*     IT_SPECIAL_GROUPS                 =

*     IT_SORT                           =

*     IT_FILTER                         =

*     IS_SEL_HIDE                       =

*     I_DEFAULT                         = 'X'

*     I_SAVE                            = ' '

*     IS_VARIANT                        =

*     IT_EVENTS                         = T_EVENTS1

*     IT_EVENT_EXIT                     =

*     IS_PRINT                          =

*     IS_REPREP_ID                      =

*     I_SCREEN_START_COLUMN             = 0

*     I_SCREEN_START_LINE               = 0

*     I_SCREEN_END_COLUMN               = 0

*     I_SCREEN_END_LINE                 = 0

*     I_HTML_HEIGHT_TOP                 = 0

*     I_HTML_HEIGHT_END                 = 0

*     IT_ALV_GRAPHICS                   =

*     IT_HYPERLINK                      =

*     IT_ADD_FIELDCAT                   =

*     IT_EXCEPT_QINFO                   =

*     IR_SALV_FULLSCREEN_ADAPTER        =

*   IMPORTING

*     E_EXIT_CAUSED_BY_CALLER           =

*     ES_EXIT_CAUSED_BY_USER            =

      TABLES

        t_outtab                          = t_vbap

*   EXCEPTIONS

*     PROGRAM_ERROR                     = 1

*     OTHERS                            = 2

              .

ENDFORM .                    "SUB2

0 Kudos
197

Thanks .....but what is the error in m code 

0 Kudos
197

Below points i have noted in your code

1. you have commented the subroutine SUB

2. you have passed  I_CALLBACK_TOP_OF_PAGE = 'subccc'  where as it has to be  I_CALLBACK_TOP_OF_PAGE  = 'SUB' in all the FM.


Rewards if it was helpful...


Regards


0 Kudos
197

ya thanks.....

0 Kudos
197

Below points i have noted in your code

1. You have commented the subroutine SUB

2. You have passed  I_CALLBACK_TOP_OF_PAGE  = 'subccc' where as it has to be  I_CALLBACK_TOP_OF_PAGE  = 'SUB' in all the FM.

Reward if it was helpful....

Regards

0 Kudos
197

i basic list I want conyent in top of page : cust no , cust name

first secondary list cust no ,cust name , order no ,,,all should be dynamic

0 Kudos
197

can you please explain with example..your exact requirement.

0 Kudos
197

I need to use hide statement o taht its displays cust name , cust no , in first detail list at top of page box

0 Kudos
197

For this you need to create one more subroutine, for ex., SUB3 and pass this to the secondary list FM parameter. And fill this subroutine with the selected customer, customer name.

0 Kudos
197

but that has to be dynamic if i click on cust 1002 must display this cust no 1002 in first detail list ..as we use hide technique in classical interactive report

0 Kudos
197

check the below code...

TYPE-POOLS: slis .

TABLES : kna1 .

TYPES : BEGIN OF ty_kna1  ,

          kunnr  TYPE kna1-kunnr ,

          name1  TYPE kna1-name1 ,

          land1  TYPE kna1-land1 ,

          END OF ty_kna1 .

TYPES : BEGIN OF ty_vbak ,

          vbeln  TYPE vbak-vbeln ,

          erdat  TYPE vbak-erdat ,

          netwr  TYPE vbak-netwr ,

          END OF ty_vbak .

TYPES : BEGIN OF ty_vbap  ,

          posnr TYPE vbap-posnr ,

          arktx TYPE vbap-arktx ,

          werks TYPE vbap-werks ,

          END OF ty_vbap .

DATA : x TYPE i .

DATA : t_kna1 TYPE STANDARD TABLE OF ty_kna1 INITIAL SIZE 1 ,

          t_vbak TYPE STANDARD TABLE OF ty_vbak INITIAL SIZE 1 ,

          t_vbap TYPE STANDARD TABLE OF ty_vbap INITIAL SIZE 1 .

DATA : w_kna1 TYPE ty_kna1 ,

          w_vbak TYPE ty_vbak ,

          w_vbap TYPE ty_vbap .

DATA: lv_cust TYPE kna1-kunnr.

DATA : w_fcat TYPE slis_fieldcat_alv .

DATA : t_fcat TYPE slis_t_fieldcat_alv .

DATA : t_fcat1 TYPE slis_t_fieldcat_alv .

DATA : t_fcat2 TYPE slis_t_fieldcat_alv .

DATA : w_comments TYPE slis_listheader .

DATAt_comments TYPE slis_t_listheader .

DATAt_comments1 TYPE slis_t_listheader .

DATA : w_events TYPE slis_alv_event .

DATA : t_events TYPE slis_t_event .

DATA : w_events1 TYPE slis_alv_event .

DATA : t_events1 TYPE slis_t_event .

DATA : w_events2 TYPE slis_alv_event .

DATA : t_events2 TYPE slis_t_event .

DATA : v_prog TYPE sy-repid .

v_prog = sy-repid .

SELECT-OPTIONS : s_kunnr FOR kna1-kunnr .

w_fcat-col_pos = 1 .

w_fcat-fieldname = 'KUNNR '.

w_fcat-seltext_m = 'CUST NO'.

APPEND w_fcat TO t_fcat .

w_fcat-col_pos = 2 .

w_fcat-fieldname = 'NAME1 '.

w_fcat-seltext_m = 'CUST NAME'.

APPEND w_fcat TO t_fcat .

w_fcat-col_pos = 3 .

w_fcat-fieldname = 'LAND1 '.

w_fcat-seltext_m = 'CUST COUNTRY'.

APPEND w_fcat TO t_fcat .

w_fcat-col_pos = 1.

w_fcat-fieldname = 'VBELN '.

w_fcat-seltext_m = 'ORDER NO'.

APPEND w_fcat TO t_fcat1 .

w_fcat-col_pos = 2 .

w_fcat-fieldname = 'ERDAT '.

w_fcat-seltext_m = 'ORDER DATA'.

APPEND w_fcat TO t_fcat1 .

w_fcat-col_pos = 3.

w_fcat-fieldname = 'NETWR '.

w_fcat-seltext_m = 'NET VALUE'.

APPEND w_fcat TO t_fcat1 .

w_fcat-col_pos = 1.

w_fcat-fieldname = 'POSNR '.

w_fcat-seltext_m = 'SALES ITEM '.

APPEND w_fcat TO t_fcat2 .

w_fcat-col_pos = 2.

w_fcat-fieldname = 'ARKTX '.

w_fcat-seltext_m = 'SALES DESC'.

APPEND w_fcat TO t_fcat2 .

w_fcat-col_pos = 3.

w_fcat-fieldname = 'WERKS '.

w_fcat-seltext_m = 'PLANT'.

APPEND w_fcat TO t_fcat2 .

w_comments-typ ='H'.

w_comments-info ='CUSTOMER DATA'.

APPEND w_comments TO t_comments .

w_comments-typ ='S'.

w_comments-key ='CUST NO'.

w_comments-info ='0000001000'.

APPEND w_comments TO t_comments .

w_events-name ='TOP_OF_PAGE'.

w_events-form ='SUB'.

APPEND w_events2 TO t_events2 .

w_events-name = 'USER_COMMAND'.

w_events-form = 'SUB1'.

APPEND w_events TO t_events .

w_events1-name = 'USER_COMMAND'.

w_events1-form = 'SUB2'.

APPEND w_events1 TO t_events1 .

DATA: ls_line   TYPE slis_listheader,

          it_top_of_page  TYPE slis_t_listheader.

*ls_line-typ  = 'H'.

*ls_line-info = 'Customer Detail'.

*APPEND ls_line TO it_top_of_page.

*CLEAR ls_line.

SELECT kunnr

          name1

          land1 FROM kna1 INTO TABLE t_kna1

                WHERE kunnr IN s_kunnr .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

*   I_INTERFACE_CHECK                 = ' '

*   I_BYPASSING_BUFFER                = ' '

*   I_BUFFER_ACTIVE                   = ' '

      i_callback_program                = v_prog

*   I_CALLBACK_PF_STATUS_SET          = ' '

*   I_CALLBACK_USER_COMMAND           = ' '

*   i_callback_top_of_page            = 'TOP_OF_PAGE'

      i_callback_top_of_page            = 'SUB'

*   I_CALLBACK_HTML_TOP_OF_PAGE       = 'TOP_OF_PAGE'

*   I_CALLBACK_HTML_END_OF_LIST       = ' '

*   I_STRUCTURE_NAME                  =

*   I_BACKGROUND_ID                   = ' '

*   I_GRID_TITLE                      =

*   I_GRID_SETTINGS                   =

*   IS_LAYOUT                         =

      it_fieldcat                       = t_fcat

*   IT_EXCLUDING                      =

*   IT_SPECIAL_GROUPS                 =

*   IT_SORT                           =

*   IT_FILTER                         =

*   IS_SEL_HIDE                       =

*   I_DEFAULT                         = 'X'

*   I_SAVE                            = ' '

*   IS_VARIANT                        =

      it_events                         = t_events

*   IT_EVENT_EXIT                     =

*   IS_PRINT                          =

*   IS_REPREP_ID                      =

*   I_SCREEN_START_COLUMN             = 0

*   I_SCREEN_START_LINE               = 0

*   I_SCREEN_END_COLUMN               = 0

*   I_SCREEN_END_LINE                 = 0

*   I_HTML_HEIGHT_TOP                 = 0

*   I_HTML_HEIGHT_END                 = 0

*   IT_ALV_GRAPHICS                   =

*   IT_HYPERLINK                      =

*   IT_ADD_FIELDCAT                   =

*   IT_EXCEPT_QINFO                   =

*   IR_SALV_FULLSCREEN_ADAPTER        =

* IMPORTING

*   E_EXIT_CAUSED_BY_CALLER           =

*   ES_EXIT_CAUSED_BY_USER            =

     TABLES

       t_outtab                          = t_kna1

* EXCEPTIONS

*   PROGRAM_ERROR                     = 1

*   OTHERS                            = 2

             .

*&---------------------------------------------------------------------*

*&      Form  SUB

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

FORM sub .

     CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

       EXPORTING

         it_list_commentary       = t_comments

*   I_LOGO                   =

*   I_END_OF_LIST_GRID       =

*   I_ALV_FORM               =

               .

ENDFORM .                    "SUB

************************************************************************

*        FIRST DETAILED LIST                                                               *

************************************************************************

FORM sub1 USING r_ucomm LIKE sy-ucomm

                   rs_selfield TYPE slis_selfield .

*IF FNAME = 'KNA1-KUNNR' .

     SELECT vbeln

             erdat

             netwr  FROM vbak INTO TABLE t_vbak

                    WHERE kunnr = rs_selfield-value .

     lv_cust = rs_selfield-value.

     CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

     EXPORTING

*   I_INTERFACE_CHECK                 = ' '

*   I_BYPASSING_BUFFER                = ' '

*   I_BUFFER_ACTIVE                   = ' '

        i_callback_program                = v_prog

*   I_CALLBACK_PF_STATUS_SET          = ' '

*   I_CALLBACK_USER_COMMAND           = ' '

*     i_callback_top_of_page            = 'TOP_OF_PAGE'

        i_callback_top_of_page            = 'SUB3'

*   I_CALLBACK_HTML_TOP_OF_PAGE       = 'top_of_page '

*   I_CALLBACK_HTML_END_OF_LIST       = ' '

*   I_STRUCTURE_NAME                  =

*   I_BACKGROUND_ID                   = ' '

*   I_GRID_TITLE                      =

*   I_GRID_SETTINGS                   =

*   IS_LAYOUT                         =

        it_fieldcat                       = t_fcat1

*   IT_EXCLUDING                      =

*   IT_SPECIAL_GROUPS                 =

*   IT_SORT                           =

*   IT_FILTER                         =

*   IS_SEL_HIDE                       =

*   I_DEFAULT                         = 'X'

*   I_SAVE                            = ' '

*   IS_VARIANT                        =

        it_events                         = t_events1

*   IT_EVENT_EXIT                     =

*   IS_PRINT                          =

*   IS_REPREP_ID                      =

*   I_SCREEN_START_COLUMN             = 0

*   I_SCREEN_START_LINE               = 0

*   I_SCREEN_END_COLUMN               = 0

*   I_SCREEN_END_LINE                 = 0

*   I_HTML_HEIGHT_TOP                 = 0

*   I_HTML_HEIGHT_END                 = 0

*   IT_ALV_GRAPHICS                   =

*   IT_HYPERLINK                      =

*   IT_ADD_FIELDCAT                   =

*   IT_EXCEPT_QINFO                   =

*   IR_SALV_FULLSCREEN_ADAPTER        =

* IMPORTING

*   E_EXIT_CAUSED_BY_CALLER           =

*   ES_EXIT_CAUSED_BY_USER            =

       TABLES

         t_outtab                          = t_vbak

* EXCEPTIONS

*   PROGRAM_ERROR                     = 1

*   OTHERS                            = 2

               .

ENDFORM .                    "SUB1

*&---------------------------------------------------------------------*

*&      Form  SUB2

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->R_UCOMM      text

*      -->RS_SELFIELD  text

*----------------------------------------------------------------------*

FORM sub2 USING r_ucomm LIKE sy-ucomm

                  rs_selfield TYPE slis_selfield.

     SELECT posnr

            arktx

            werks FROM vbap INTO TABLE t_vbap

                  WHERE vbeln rs_selfield-value .

     CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

      EXPORTING

*     I_INTERFACE_CHECK                 = ' '

*     I_BYPASSING_BUFFER                = ' '

*     I_BUFFER_ACTIVE                   = '1111111111111 '

*     I_CALLBACK_PROGRAM                = ' '

*     I_CALLBACK_PF_STATUS_SET          = ' '

*     I_CALLBACK_USER_COMMAND           = ' '

*     i_callback_top_of_page            = ' TOP_OF_PAGE'

        i_callback_top_of_page            = 'SUB'

*     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '

*     I_CALLBACK_HTML_END_OF_LIST       = ' '

*     I_STRUCTURE_NAME                  =

*     I_BACKGROUND_ID                   = ' '

*     I_GRID_TITLE                      =

*     I_GRID_SETTINGS                   =

*     IS_LAYOUT                         =

        it_fieldcat                       = t_fcat2

*     IT_EXCLUDING                      =

*     IT_SPECIAL_GROUPS                 =

*     IT_SORT                           =

*     IT_FILTER                         =

*     IS_SEL_HIDE                       =

*     I_DEFAULT                         = 'X'

*     I_SAVE                            = ' '

*     IS_VARIANT                        =

*     IT_EVENTS                         = T_EVENTS1

*     IT_EVENT_EXIT                     =

*     IS_PRINT                          =

*     IS_REPREP_ID                      =

*     I_SCREEN_START_COLUMN             = 0

*     I_SCREEN_START_LINE               = 0

*     I_SCREEN_END_COLUMN               = 0

*     I_SCREEN_END_LINE                 = 0

*     I_HTML_HEIGHT_TOP                 = 0

*     I_HTML_HEIGHT_END                 = 0

*     IT_ALV_GRAPHICS                   =

*     IT_HYPERLINK                      =

*     IT_ADD_FIELDCAT                   =

*     IT_EXCEPT_QINFO                   =

*     IR_SALV_FULLSCREEN_ADAPTER        =

*   IMPORTING

*     E_EXIT_CAUSED_BY_CALLER           =

*     ES_EXIT_CAUSED_BY_USER            =

       TABLES

         t_outtab                          = t_vbap

*   EXCEPTIONS

*     PROGRAM_ERROR                     = 1

*     OTHERS                            = 2

               .

ENDFORM .                    "SUB2

*&---------------------------------------------------------------------*

*&      Form  SUB

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

FORM sub3 .

   CLEAR t_comments1.

w_comments-typ ='H'.

w_comments-info ='CUSTOMER DATA'.

APPEND w_comments TO t_comments1.

w_comments-typ ='S'.

w_comments-key ='CUST NO'.

w_comments-info = lv_cust.

APPEND w_comments TO t_comments1 .

     CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

       EXPORTING

         it_list_commentary       = t_comments1

*   I_LOGO                   =

*   I_END_OF_LIST_GRID       =

*   I_ALV_FORM               =

               .

ENDFORM .                    "SUB

former_member204556
Participant
0 Kudos
197

Hi Anshika,

Try dis,

*--------------------------------------------------------------------*

* declaring the internal table and structure for spfli and sbook

*--------------------------------------------------------------------*

DATA lt_flight TYPE TABLE OF spfli.

DATA ls_flight TYPE spfli.

DATA lt_book TYPE TABLE OF sbook.

DATA ls_book TYPE  sbook.

*--------------------------------------------------------------------*

*declaring local type variables

*--------------------------------------------------------------------*

DATA lv_carrid TYPE c LENGTH 2.

DATA lv_con TYPE c LENGTH 4.

*--------------------------------------------------------------------*

*accessing values from spfli table

*--------------------------------------------------------------------*

SELECT *

   FROM spfli INTO TABLE lt_flight ORDER BY carrid DESCENDING.

SELECT * FROM sbook INTO TABLE lt_book.

LOOP AT lt_flight INTO ls_flight.

   AT NEW carrid.

     WRITE : /'the airline id is ', ls_flight-carrid.

   ENDAT.

   LOOP AT lt_book INTO ls_book.

     IF ls_flight-carrid = ls_book-carrid AND

        ls_flight-connid = ls_book-connid.

       WRITE: /35 'booking information available for carrier and connection id', ls_flight-carrid COLOR 2 , ls_flight-connid COLOR 3 .

       HIDE: ls_flight-carrid, ls_flight-connid.

     ENDIF.

   ENDLOOP.

ENDLOOP.

CLEAR lt_book.

TOP-OF-PAGE.

   IF sy-pagno = 1.

     WRITE: 'list of flights' ,sy-pagno.

     ULINE.

   ELSE.

     WRITE: 'you are on page ',sy-pagno.

     ULINE.

   ENDIF.

END-OF-PAGE.

   WRITE : /'end of page',sy-pagno.

AT LINE-SELECTION.

   CHECK ls_flight-carrid IS NOT INITIAL AND ls_flight-connid IS NOT INITIAL.

   SELECT * FROM sbook INTO TABLE lt_book WHERE

         carrid = ls_flight-carrid AND

         connid = ls_flight-connid.

   WRITE:/ 'book details for the carrier id and connection id'.

   ULINE AT /1(80).

   LOOP AT lt_book INTO ls_book." WHERE

     WRITE:/1 sy-vline, 'Carrier Id-',ls_book-carrid, 25 sy-vline, 'Connection Id-',ls_book-connid, 50 sy-vline, 'Booking Id-' ,ls_book-bookid,80 sy-vline.

     ULINE AT /1(80).

   ENDLOOP.

   CLEAR ls_flight.

Chintu6august
Contributor
0 Kudos
197

hi,

there are events 'TOP_OF_PAGE' and 'END_OF_LIST' out of 17 alv events for creating header and footer.

use FM REUSE_ALV_EVENTS_GET it will give the table of events.

now create the form/subroutine for the events like you have done for user-command.

use FM REUSE_ALV_COMMENTARY_WRITE in that form to display top of page and end of page .

example..

FORM FORM_END_OF_LIST .

  REFRESH IT_HEAD .  "type  slis_t_listheader

  CLEAR WA_HEAD .   " slis_listheader

  WA_HEAD-TYP = 'S' .    typ can be S A and H.

  WA_HEAD-INFO = 'SAP SCN example' .

  APPEND WA_HEAD TO It_HEAD .

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

  EXPORTING

  IT_LIST_COMMENTARY = IT_HEAD

  I_END_OF_LIST_GRID = 'X' << for end of the list uncomment it.

  .

ENDFORM .

thanks!!

0 Kudos
197

sorry ,,unable to understand can u pls specify i m code