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: 

How to add interactive feature in top of page in ALV .

Former Member
0 Kudos
144

Hi All ,

There is immediate requirement , I have to add interactive feature in top of page in ALV grid .

Can anyone sort this out ?

Reward points will be given.

6 REPLIES 6

Former Member
0 Kudos
69

Hi,

Refer this code sample.

1. u have to metntion a form name

2. write codes in that form with REUSE_ALV_COMMENTRY_WRITE

Jogdand M B

Former Member
0 Kudos
69

hi,

check this example:

REPORT ZSR_ALV_INTERACTIVE2.

TYPE-POOLS: SLIS.

*DATA DECLARATION.

TYPES: BEGIN OF I_VBAK,

VBELN TYPE VBELN_VA,

AUGRU TYPE AUGRU,

END OF I_VBAK.

TYPES: BEGIN OF I_VBAP,

VBELN TYPE VBELN_VA,

AUGRU TYPE AUGRU,

POSNR TYPE POSNR_VA,

MATNR TYPE MATNR,

ZMENG TYPE DZMENG,

END OF I_VBAP.

TYPES: BEGIN OF I_MAKT,

MATNR TYPE MATNR,

MAKTX TYPE MAKTX,

END OF I_MAKT.

TYPES: BEGIN OF I_LIPS,

POSNR TYPE POSNR_VL,

MATNR TYPE MATNR,

LFIMG TYPE LFIMG,

END OF I_LIPS.

TYPES: BEGIN OF I_REASON,

SPRAS TYPE SPRAS,

AUGRU TYPE AUGRU,

BEZEI TYPE BEZEI40,

END OF I_REASON.

TYPES: BEGIN OF I_VBPA,

VBELN TYPE VBELN,

PARVW TYPE PARVW,

KUNNR TYPE KUNNR,

END OF I_VBPA.

TYPES: BEGIN OF I_KNA1,

KUNNR TYPE KUNNR,

NAME1 TYPE NAME1_GP,

END OF I_KNA1.

TYPES: BEGIN OF I_FINAL,

VBELN TYPE VBELN_VA,

POSNR TYPE POSNR_VA,

MATNR TYPE MATNR,

ZMENG TYPE DZMENG,

MAKTX TYPE MAKTX,

LFIMG TYPE LFIMG,

SPRAS TYPE SPRAS,

AUGRU TYPE AUGRU,

BEZEI TYPE BEZEI40,

PARVW TYPE PARVW,

KUNNR TYPE KUNNR,

NAME1 TYPE NAME1_GP,

END OF I_FINAL.

*INTERNAL TABLES

DATA: IT_VBAK TYPE STANDARD TABLE OF I_VBAK.

DATA: IT_VBAP TYPE STANDARD TABLE OF I_VBAP.

DATA: IT_MAKT TYPE STANDARD TABLE OF I_MAKT.

DATA: IT_LIPS TYPE STANDARD TABLE OF I_LIPS.

DATA: IT_VBPA TYPE STANDARD TABLE OF I_VBPA.

DATA: IT_KNA1 TYPE STANDARD TABLE OF I_KNA1.

DATA: IT_FINAL TYPE STANDARD TABLE OF I_FINAL.

DATA: IT_REASON TYPE STANDARD TABLE OF I_REASON.

DATA : V_FLAG.

*WORK AREA

DATA: WA_VBAK TYPE I_VBAK.

DATA: WA_VBAP TYPE I_VBAP.

DATA: WA_MAKT TYPE I_MAKT.

DATA: WA_LIPS TYPE I_LIPS.

DATA: WA_VBPA TYPE I_VBPA.

DATA: WA_KNA1 TYPE I_KNA1.

DATA: WA_FINAL TYPE I_FINAL.

DATA: WA_REASON TYPE I_REASON.

*DATA DECLARATION.

DATA: V_PROGNAME TYPE SY-REPID.

DATA: V_VBELN TYPE VBAK-VBELN.

DATA: V_GRIDTITLE TYPE LVC_TITLE.

***PARAMETERS: D_VARI LIKE DISVARIANT-VARIANT.

*DATA: I_VARIANT LIKE DISVARIANT.

*DATA: P_VARI LIKE DISVARIANT-VARIANT.

*DATA DECLARATION FOR CATALOGS LAYOUT SORT EVENTCATALOG TOPOFPAGE.

DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

DATA: I_LAYOUT TYPE SLIS_LAYOUT_ALV.

DATA: I_SORTINFO TYPE SLIS_T_SORTINFO_ALV.

DATA: I_LISTHEADER TYPE SLIS_T_LISTHEADER.

DATA: I_EVENTCAT TYPE SLIS_T_EVENT.

INITIALIZATION.

V_PROGNAME = SY-REPID.

V_FLAG = SPACE.

*SELECTION SCREEN

SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-002.

SELECT-OPTIONS: S_VBELN FOR V_VBELN.

SELECTION-SCREEN END OF BLOCK BLK1.

*AT SLECTION-SCREEN.

AT SELECTION-SCREEN.

PERFORM Z_VALIDATIONS.

*START OF SELECTION.

START-OF-SELECTION.

PERFORM Z_SELECT.

PERFORM CHECK_VALIDATION_FLAG.

PERFORM Z_FIELDCAT USING I_FIELDCAT.

PERFORM Z_LAYOUT.

PERFORM Z_SORTINFO USING I_SORTINFO.

PERFORM Z_EVENTCAT USING I_EVENTCAT.

PERFORM Z_GRIDTITLE.

PERFORM Z_LISTHEADER USING I_LISTHEADER.

PERFORM Z_DISPLAY.

&----


*& Form Z_VALIDATIONS

&----


FORM Z_VALIDATIONS .

SELECT VBELN INTO V_VBELN

UP TO 1 ROWS

FROM VBAK

WHERE VBELN IN S_VBELN.

ENDSELECT.

IF SY-SUBRC <> 0.

MESSAGE I002(SY) WITH 'No Records'.

V_FLAG = 'X'.

ENDIF.

ENDFORM. " Z_VALIDATIONS

&----


*& Form Z_FIELDCAT

&----


FORM Z_FIELDCAT USING P_I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

DATA: I_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

*VBAK-VELN

I_FIELDCAT-COL_POS = '1'. " POSITION OF THE COLUMN.

I_FIELDCAT-FIELDNAME = 'VBELN'. " FIELD FOR WHICH CATALOG ID FILLED.

I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD

*BELONGS TO.

I_FIELDCAT-KEY = 'X'. " SO THAT THIS FIELD IS NOT SCROLLABLE AND

*HIDDABLE.

I_FIELDCAT-JUST = 'C'. " FOR JUSTIFICATION.

I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.

I_FIELDCAT-SELTEXT_L = 'SALES ORDER'. " LONG TEXT FOR HEADER.

I_FIELDCAT-OUTPUTLEN = 15. " SET THE OUTPUT LENGTH.

I_FIELDCAT-REF_TABNAME = 'VBAK'. " FOR F1 & F4 HELP AS REFERNCED TO

*THE DDIC TABLE.

APPEND I_FIELDCAT TO P_I_FIELDCAT.

*VBAP-SPRAS

I_FIELDCAT-COL_POS = '2'. " POSITION OF THE COLUMN.

I_FIELDCAT-FIELDNAME = 'SPRAS'. " FIELD FOR WHICH CATALOG ID FILLED.

I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD

*BELONGS TO.

I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.

I_FIELDCAT-SELTEXT_L = 'LANGUAGE'. " LONG TEXT FOR HEADER.

I_FIELDCAT-OUTPUTLEN = 5. " SET THE OUTPUT LENGTH.

I_FIELDCAT-REF_TABNAME = 'TVAUT'. " FOR F1 & F4 HELP AS REFERNCED TO

*TABLE.

APPEND I_FIELDCAT TO P_I_FIELDCAT.

*VBAP-AUGRU

I_FIELDCAT-COL_POS = '3'. " POSITION OF THE COLUMN.

I_FIELDCAT-FIELDNAME = 'AUGRU'. " FIELD FOR WHICH CATALOG ID FILLED.

I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD

*BELONGS TO.

I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.

I_FIELDCAT-SELTEXT_L = 'REASON'. " LONG TEXT FOR HEADER.

I_FIELDCAT-OUTPUTLEN = 5. " SET THE OUTPUT LENGTH.

I_FIELDCAT-REF_TABNAME = 'VBAK'. " FOR F1 & F4 HELP AS REFERNCED TO

*TABLE.

APPEND I_FIELDCAT TO P_I_FIELDCAT.

*VBAP-bezei

I_FIELDCAT-COL_POS = '4'. " POSITION OF THE COLUMN.

I_FIELDCAT-FIELDNAME = 'BEZEI'. " FIELD FOR WHICH CATALOG ID FILLED.

I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD

*BELONGS TO.

I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.

I_FIELDCAT-SELTEXT_L = 'DESCRIPTION'. " LONG TEXT FOR HEADER.

I_FIELDCAT-OUTPUTLEN = 20. " SET THE OUTPUT LENGTH.

I_FIELDCAT-REF_TABNAME = 'TVAUT'. " FOR F1 & F4 HELP AS REFERNCED TO

*TABLE.

APPEND I_FIELDCAT TO P_I_FIELDCAT.

*VBAP-POSNR

I_FIELDCAT-COL_POS = '5'. " POSITION OF THE COLUMN.

I_FIELDCAT-FIELDNAME = 'POSNR'. " FIELD FOR WHICH CATALOG ID FILLED.

I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD

*BELONGS TO.

I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.

I_FIELDCAT-SELTEXT_L = 'ITEM'. " LONG TEXT FOR HEADER.

I_FIELDCAT-OUTPUTLEN = 8. " SET THE OUTPUT LENGTH.

I_FIELDCAT-REF_TABNAME = 'VBAP'. " FOR F1 & F4 HELP AS REFERNCED TO

*TABLE.

APPEND I_FIELDCAT TO P_I_FIELDCAT.

*VBAP-MATNR.

I_FIELDCAT-COL_POS = '6'. " POSITION OF THE COLUMN.

I_FIELDCAT-FIELDNAME = 'MATNR'. " FIELD FOR WHICH CATALOG ID FILLED.

I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD

*BELONGS TO.

I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.

I_FIELDCAT-SELTEXT_L = 'MATERIAL'. " LONG TEXT FOR HEADER.

I_FIELDCAT-OUTPUTLEN = 10. " SET THE OUTPUT LENGTH.

I_FIELDCAT-REF_TABNAME = 'VBAP'. " FOR F1 & F4 HELP AS REFERNCED TO

*TABLE.

APPEND I_FIELDCAT TO P_I_FIELDCAT.

*VBAP-ZMENG

I_FIELDCAT-COL_POS = '7'. " POSITION OF THE COLUMN.

I_FIELDCAT-FIELDNAME = 'ZMENG'. " FIELD FOR WHICH CATALOG ID FILLED.

I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD

*BELONGS TO.

I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.

I_FIELDCAT-SELTEXT_L = 'QUANT'. " LONG TEXT FOR HEADER.

I_FIELDCAT-OUTPUTLEN = 10. " SET THE OUTPUT LENGTH.

I_FIELDCAT-REF_TABNAME = 'VBAP'. " FOR F1 & F4 HELP AS REFERNCED TO

*TABLE.

APPEND I_FIELDCAT TO P_I_FIELDCAT.

*MAKT-MAKTX

I_FIELDCAT-COL_POS = '8'. " POSITION OF THE COLUMN.

I_FIELDCAT-FIELDNAME = 'MAKTX'. " FIELD FOR WHICH CATALOG ID FILLED.

I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD

*BELONGS TO.

I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.

I_FIELDCAT-SELTEXT_L = 'DESCRIPTION'. " LONG TEXT FOR HEADER.

I_FIELDCAT-OUTPUTLEN = 20. " SET THE OUTPUT LENGTH.

I_FIELDCAT-REF_TABNAME = 'MAKT'. " FOR F1 & F4 HELP AS REFERNCED TO

*TABLE.

APPEND I_FIELDCAT TO P_I_FIELDCAT.

*LIPS-VBELN

I_FIELDCAT-COL_POS = '9'. " POSITION OF THE COLUMN.

I_FIELDCAT-FIELDNAME = 'VBELN'. " FIELD FOR WHICH CATALOG ID FILLED.

I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD

*BELONGS TO.

I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.

I_FIELDCAT-SELTEXT_L = 'DELIVERY'. " LONG TEXT FOR HEADER.

I_FIELDCAT-OUTPUTLEN = 15. " SET THE OUTPUT LENGTH.

I_FIELDCAT-REF_TABNAME = 'LIPS'. " FOR F1 & F4 HELP AS REFERNCED TO

*TABLE.

APPEND I_FIELDCAT TO P_I_FIELDCAT.

*LIPS-LFIMG

I_FIELDCAT-COL_POS = '10'. " POSITION OF THE COLUMN.

I_FIELDCAT-FIELDNAME = 'LFIMG'. " FIELD FOR WHICH CATALOG ID FILLED.

I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD

*BELONGS TO.

I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.

I_FIELDCAT-DO_SUM = 'X'.

I_FIELDCAT-SELTEXT_L = 'LFIMG'. " LONG TEXT FOR HEADER.

I_FIELDCAT-OUTPUTLEN = 18. " SET THE OUTPUT LENGTH.

I_FIELDCAT-REF_TABNAME = 'LIPS'. " FOR F1 & F4 HELP AS REFERNCED TO

*TABLE.

APPEND I_FIELDCAT TO P_I_FIELDCAT.

*parvw

I_FIELDCAT-COL_POS = '11'. " POSITION OF THE COLUMN.

I_FIELDCAT-FIELDNAME = 'PARVW'. " FIELD FOR WHICH CATALOG ID FILLED.

I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD

*BELONGS TO.

I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.

I_FIELDCAT-SELTEXT_L = 'PARTNER FUN'. " LONG TEXT FOR HEADER.

I_FIELDCAT-OUTPUTLEN = 18. " SET THE OUTPUT LENGTH.

I_FIELDCAT-REF_TABNAME = 'VBPA'. " FOR F1 & F4 HELP AS REFERNCED TO

*TABLE.

APPEND I_FIELDCAT TO P_I_FIELDCAT.

*KUNNR

I_FIELDCAT-COL_POS = '12'. " POSITION OF THE COLUMN.

I_FIELDCAT-FIELDNAME = 'KUNNR'. " FIELD FOR WHICH CATALOG ID FILLED.

I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD

*BELONGS TO.

I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.

I_FIELDCAT-SELTEXT_L = 'SHIP'. " LONG TEXT FOR HEADER.

I_FIELDCAT-OUTPUTLEN = 18. " SET THE OUTPUT LENGTH.

I_FIELDCAT-REF_TABNAME = 'VBPA'. " FOR F1 & F4 HELP AS REFERNCED TO

*TABLE.

APPEND I_FIELDCAT TO P_I_FIELDCAT.

*NAME1

I_FIELDCAT-COL_POS = '13'. " POSITION OF THE COLUMN.

I_FIELDCAT-FIELDNAME = 'NAME1'. " FIELD FOR WHICH CATALOG ID FILLED.

I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD

*BELONGS TO.

I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.

I_FIELDCAT-SELTEXT_L = 'NAME'. " LONG TEXT FOR HEADER.

I_FIELDCAT-OUTPUTLEN = 18. " SET THE OUTPUT LENGTH.

I_FIELDCAT-REF_TABNAME = 'KNA1'. " FOR F1 & F4 HELP AS REFERNCED TO

*TABLE.

APPEND I_FIELDCAT TO P_I_FIELDCAT.

ENDFORM. " Z_FIELDCAT

&----


*& Form Z_SELECT

&----


FORM Z_SELECT .

SELECT VBELN

AUGRU INTO CORRESPONDING FIELDS OF TABLE IT_VBAK

FROM VBAK

WHERE VBELN IN S_VBELN.

IF SY-SUBRC = 0.

SELECT VBELN

POSNR

MATNR

ZMENG INTO CORRESPONDING FIELDS OF TABLE IT_VBAP

FROM VBAP

FOR ALL ENTRIES IN IT_VBAK

WHERE VBELN = IT_VBAK-VBELN.

IF SY-SUBRC = 0.

SELECT SPRAS

AUGRU

BEZEI INTO CORRESPONDING FIELDS OF TABLE IT_REASON

FROM TVAUT

FOR ALL ENTRIES IN IT_VBAK

WHERE AUGRU = IT_VBAK-AUGRU.

IF SY-SUBRC = 0.

SELECT VBELN

PARVW

KUNNR INTO CORRESPONDING FIELDS OF TABLE IT_VBPA

FROM VBPA

FOR ALL ENTRIES IN IT_VBAK

WHERE VBELN = IT_VBAK-VBELN.

IF SY-SUBRC = 0.

SELECT KUNNR

NAME1 INTO CORRESPONDING FIELDS OF TABLE IT_KNA1

FROM KNA1

FOR ALL ENTRIES IN IT_VBPA

WHERE KUNNR = IT_VBPA-KUNNR.

IF SY-SUBRC = 0.

SELECT POSNR

MATNR

LFIMG INTO CORRESPONDING FIELDS OF TABLE IT_LIPS

FROM LIPS

FOR ALL ENTRIES IN IT_VBAP

WHERE POSNR = IT_VBAP-POSNR.

IF SY-SUBRC = 0.

SELECT MATNR

MAKTX INTO CORRESPONDING FIELDS OF TABLE IT_MAKT

FROM MAKT

FOR ALL ENTRIES IN IT_VBAP

WHERE MATNR = IT_VBAP-MATNR.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ELSE.

MESSAGE I002(SY) WITH 'No Data found'.

LEAVE LIST-PROCESSING.

ENDIF.

IF SY-SUBRC = 0.

LOOP AT IT_VBAP INTO WA_VBAP.

READ TABLE IT_VBAK INTO WA_VBAK WITH KEY VBELN = WA_VBAP-VBELN

BINARY SEARCH.

IF SY-SUBRC = 0.

*MOVE DATA INTO IT_FINAL.

MOVE: WA_VBAK-VBELN TO WA_FINAL-VBELN,

WA_VBAK-AUGRU TO WA_FINAL-AUGRU,

WA_VBAP-POSNR TO WA_FINAL-POSNR,

WA_VBAP-MATNR TO WA_FINAL-MATNR,

WA_VBAP-ZMENG TO WA_FINAL-ZMENG.

ENDIF.

READ TABLE IT_LIPS INTO WA_LIPS WITH KEY POSNR = WA_FINAL-POSNR

BINARY SEARCH.

IF SY-SUBRC = 0.

MOVE: WA_LIPS-LFIMG TO WA_FINAL-LFIMG.

ENDIF.

READ TABLE IT_REASON INTO WA_REASON WITH KEY AUGRU =

WA_FINAL-AUGRU BINARY SEARCH.

IF SY-SUBRC = 0.

MOVE: WA_REASON-SPRAS TO WA_FINAL-SPRAS,

WA_REASON-BEZEI TO WA_FINAL-BEZEI.

ENDIF.

READ TABLE IT_MAKT INTO WA_MAKT WITH KEY MATNR = WA_FINAL-MATNR

BINARY SEARCH.

IF SY-SUBRC = 0.

MOVE: WA_MAKT-MAKTX TO WA_FINAL-MAKTX.

ENDIF.

READ TABLE IT_VBPA INTO WA_VBPA WITH KEY VBELN = WA_FINAL-VBELN

BINARY SEARCH.

IF SY-SUBRC = 0.

MOVE: WA_VBPA-PARVW TO WA_FINAL-PARVW,

WA_VBPA-KUNNR TO WA_FINAL-KUNNR.

ENDIF.

READ TABLE IT_KNA1 INTO WA_KNA1 WITH KEY KUNNR = WA_FINAL-KUNNR

BINARY SEARCH.

IF SY-SUBRC = 0.

MOVE: WA_KNA1-NAME1 TO WA_FINAL-NAME1.

ENDIF.

APPEND WA_FINAL TO IT_FINAL.

CLEAR WA_FINAL.

ENDLOOP.

ENDIF.

ENDFORM. " Z_SELECT

&----


*& Form Z_LAYOUT

&----


FORM Z_LAYOUT .

I_LAYOUT-ZEBRA = 'X'.

I_LAYOUT-TOTALS_TEXT = 'Total'(A00).

I_LAYOUT-SUBTOTALS_TEXT = 'SubTotal'(A01).

I_LAYOUT-BOX_TABNAME = 'IT_FINAL'.

ENDFORM. " Z_LAYOUT

&----


*& Form Z_SORTINFO

&----


FORM Z_SORTINFO USING P_I_SORTINFO TYPE SLIS_T_SORTINFO_ALV.

DATA: I_SORTINFO TYPE SLIS_SORTINFO_ALV.

CLEAR I_SORTINFO.

I_SORTINFO-SPOS = '1'.

I_SORTINFO-FIELDNAME = 'VBELN'.

I_SORTINFO-TABNAME = 'IT_FINAL'.

I_SORTINFO-UP = 'X'.

I_SORTINFO-GROUP = 'UL'. " I.E UNDERLINE AFTER EVERY GROUP

I_SORTINFO-SUBTOT = 'X'.

APPEND I_SORTINFO TO P_I_SORTINFO.

ENDFORM. " Z_SORTINFO

&----


*& Form Z_EVENTCAT

&----


FORM Z_EVENTCAT USING P_I_EVENTCAT TYPE SLIS_T_EVENT.

DATA: I_EVENT TYPE SLIS_ALV_EVENT.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = P_I_EVENTCAT

EXCEPTIONS

LIST_TYPE_WRONG = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CLEAR I_EVENT.

READ TABLE P_I_EVENTCAT WITH KEY NAME = SLIS_EV_TOP_OF_PAGE INTO

I_EVENT.

IF SY-SUBRC = 0.

MOVE 'TOP_OF_PAGE' TO I_EVENT-FORM.

APPEND I_EVENT TO P_I_EVENTCAT.

ENDIF.

READ TABLE P_I_EVENTCAT WITH KEY NAME = SLIS_EV_PF_STATUS_SET INTO

I_EVENT.

IF SY-SUBRC = 0.

MOVE 'SET_PF_STATUS' TO I_EVENT-FORM.

APPEND I_EVENT TO P_I_EVENTCAT.

ENDIF.

CLEAR I_EVENT.

READ TABLE P_I_EVENTCAT INTO I_EVENT WITH KEY NAME =

SLIS_EV_USER_COMMAND .

IF SY-SUBRC = 0.

MOVE 'USER_COMMAND' TO I_EVENT-FORM.

APPEND I_EVENT TO P_I_EVENTCAT.

ENDIF.

ENDFORM. " Z_EVENTCAT

&----


*& Form Z_DISPLAY

&----


FORM Z_DISPLAY .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = V_PROGNAME

*I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'

I_GRID_TITLE = V_GRIDTITLE

I_SAVE = 'A'

IS_LAYOUT = I_LAYOUT

IT_FIELDCAT = I_FIELDCAT[]

IT_SORT = I_SORTINFO

IT_EVENTS = I_EVENTCAT

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = IT_FINAL

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " Z_DISPLAY

&----


*& Form Z_GRIDTITLE

&----


FORM Z_GRIDTITLE .

V_GRIDTITLE = 'ALV FOR SALES ORDER DISPLAY'.

ENDFORM. " Z_GRIDTITLE

*TOP OF PAGE.

FORM TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = I_LISTHEADER.

ENDFORM. "TOP_OF_PAGE

*MENU SETTINGS.

FORM SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.

SET PF-STATUS 'ALV_MENU'.

ENDFORM. "SET_PF_STATUS

*USER-COMMAND

FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

DATA : VBELN TYPE VBELN_VA.

CASE P_UCOMM.

WHEN 'BACK'.

LEAVE PROGRAM.

WHEN '&IC1'.

CLEAR : VBELN.

VBELN = RS_SELFIELD-VALUE.

SET PARAMETER ID: 'AUN' FIELD VBELN.

CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

ENDCASE.

ENDFORM. " USER_COMMAND

&----


*& Form Z_LISTHEADER

&----


FORM Z_LISTHEADER USING P_I_LISTHEADER TYPE SLIS_T_LISTHEADER.

DATA: L_LISTHEADER TYPE SLIS_LISTHEADER.

REFRESH P_I_LISTHEADER.

CLEAR L_LISTHEADER.

L_LISTHEADER-TYP = 'H'.

L_LISTHEADER-INFO = TEXT-001.

APPEND L_LISTHEADER TO P_I_LISTHEADER.

CLEAR L_LISTHEADER.

L_LISTHEADER-TYP = 'H'.

L_LISTHEADER-INFO = TEXT-002.

APPEND L_LISTHEADER TO P_I_LISTHEADER.

ENDFORM. " Z_LISTHEADER

&----


*& Form check_validation_flag

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM CHECK_VALIDATION_FLAG .

IF NOT V_FLAG IS INITIAL.

LEAVE LIST-PROCESSING.

ENDIF.

ENDFORM. " check_validation_flag

Former Member
0 Kudos
69

hi,

try this out

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = gd_repid

I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'

  • 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 = 'EMPLOYEE DETAILS'

  • I_GRID_SETTINGS =

IS_LAYOUT = gd_layout

IT_FIELDCAT = d_fieldcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_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 = itab_final

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • set pf_status for creating client specified icons.

form set_pf_status using rt_extab type slis_t_extab.

set pf-status 'NEWSTATUS'.

endform.

  • populating data into header using top_of_page

form top_of_page.

wa_header-typ = 'H'.

wa_header-info = 'ALV REPORT'.

append wa_header to t_header.

clear wa_header.

wa_header-typ = 'S'.

wa_header-key = 'Date :'.

Concatenate sy-datum+6(2) '.'

sy-datum+4(2) '.'

sy-datum(4) into wa_header-info.

append wa_header to t_header.

clear wa_header.

wa_header-typ = 'S'.

wa_header-key = 'Time :'.

Concatenate sy-Uzeit(2) '.'

sy-datum+2(2) '.'

sy-datum+4(2) into wa_header-info.

append wa_header to t_header.

clear wa_header.

describe table itab_final lines line.

wa_header-typ = 'A'.

linecount = line.

Concatenate 'Total number of records :' linecount into wa_header-info separated by space.

append wa_header to t_header.

clear wa_header.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = t_header

I_LOGO = 'VMCADMIN'

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM =

.

endform.

Reward with points if helpful.

Former Member
0 Kudos
69

hello all ,

I am not asking how to add top of page but how to make it interactive top of the page. e.g Contract Account : 8900000012 then when double click on the CA then it open the transaction CAA2.

Please help me out .

0 Kudos
69

Hi Rahul. I assume that you are using the REUSE function? If so, I really doubt that this functionality is offered using this function. But if you were using the CL_GUI_ALV_GRID for you grid, this would force you to have a separate container(HTML container) for your top-of-page, then maybe using the HTML container you could do some slick coding to do what you want. Check out the examples of the HTML control in transaction DWDM, specifically the one about event processing.

Again, I don't think you are going to get this functionality out of the box with the REUSE function.

Regards,

RIch Heilman

0 Kudos
69

Hi

U can manage it in the same way used to manage the double click in a record of the table.

The TOP-OF-PAGE belongs to the ALV list so it's sensible to doubleclick.

Try this example:

TYPE-POOLS: SLIS.

TABLES: BKPF, BSEG.

PARAMETERS: P_BUKRS LIKE BKPF-BUKRS,
            P_BELNR LIKE BKPF-BELNR,
            P_GJAHR LIKE BKPF-GJAHR.

* ALV
DATA: GT_FIELDCAT   TYPE SLIS_T_FIELDCAT_ALV,
      GT_SORT       TYPE  SLIS_T_SORTINFO_ALV,
      GT_LAYOUT     TYPE SLIS_LAYOUT_ALV,
      GT_EVENTS     TYPE SLIS_T_EVENT,
*      GT_EVENT_EXIT TYPE  SLIS_T_EVENT_EXIT,
      GT_VARIANT  LIKE DISVARIANT,
      GX_VARIANT  LIKE DISVARIANT,
      GT_REPID    LIKE SY-REPID,
      GT_EXIT.

DATA: BEGIN OF T_OUTPUT OCCURS 0,
        BUZEI  LIKE BSEG-BUZEI,
        HKONT  LIKE BSEG-HKONT,
        WRBTR  LIKE BSEG-WRBTR,
        WAERS  LIKE BKPF-WAERS,
      END   OF T_OUTPUT.

START-OF-SELECTION.

  SELECT SINGLE * FROM BKPF WHERE BUKRS = P_BUKRS
                              AND BELNR = P_BELNR
                              AND GJAHR = P_GJAHR.

  SELECT * FROM BSEG WHERE BUKRS = P_BUKRS
                       AND BELNR = P_BELNR
                       AND GJAHR = P_GJAHR.
    T_OUTPUT-BUZEI  = BSEG-BUZEI.
    T_OUTPUT-WRBTR  = BSEG-WRBTR.
    T_OUTPUT-WAERS  = BKPF-WAERS.
    CASE BSEG-KOART.
      WHEN 'K'.
        T_OUTPUT-HKONT  = BSEG-LIFNR.
      WHEN 'D'.
        T_OUTPUT-HKONT  = BSEG-KUNNR.
      WHEN 'S'.
        T_OUTPUT-HKONT  = BSEG-HKONT.
    ENDCASE.
    APPEND T_OUTPUT.
  ENDSELECT.

END-OF-SELECTION.
  GT_LAYOUT-ZEBRA           = 'X'.
  GT_LAYOUT-F2CODE          = 'DETA'.

  GT_REPID = SY-REPID.

  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
            I_PROGRAM_NAME     = GT_REPID
            I_INTERNAL_TABNAME = 'T_OUTPUT'
            I_INCLNAME         = GT_REPID
       CHANGING
            CT_FIELDCAT        = GT_FIELDCAT[].

  DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
  LS_EVENT-NAME = 'TOP_OF_PAGE'.
  LS_EVENT-FORM  = 'TOP-OF-PAGE'.
  APPEND LS_EVENT TO GT_EVENTS.


  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
            I_CALLBACK_PROGRAM      = GT_REPID
            I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
            IS_LAYOUT               = GT_LAYOUT
            IT_FIELDCAT             = GT_FIELDCAT
            IT_EVENTS               = GT_EVENTS
       TABLES
            T_OUTTAB                = T_OUTPUT.

*---------------------------------------------------------------------*
*       FORM USER_COMMAND                                             *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  R_UCOMM                                                       *
*  -->  RS_SELFIELD                                                   *
*---------------------------------------------------------------------*
FORM USER_COMMAND USING R_UCOMM     LIKE SY-UCOMM
                        RS_SELFIELD TYPE SLIS_SELFIELD.

  DATA: T_PARAM LIKE STANDARD TABLE OF RFC_SPAGPA WITH HEADER LINE.

  IF R_UCOMM = 'DETA'.
    IF RS_SELFIELD-SEL_TAB_FIELD = 'BKPF-BELNR'.
      T_PARAM-PARID  = 'BLN'.
      T_PARAM-PARVAL = BKPF-BELNR.
      APPEND T_PARAM.

      T_PARAM-PARID  = 'BUK'.
      T_PARAM-PARVAL = BKPF-BUKRS.
      APPEND T_PARAM.

      T_PARAM-PARID  = 'GJR'.
      T_PARAM-PARVAL = BKPF-GJAHR.
      APPEND T_PARAM.

      CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
           EXPORTING
                TCODE                   = 'FB03'
                SKIP_SCREEN             = 'X'
           TABLES
                SPAGPA_TAB              = T_PARAM
           EXCEPTIONS
                CALL_TRANSACTION_DENIED = 1
                TCODE_INVALID           = 2
                OTHERS                  = 3.
      IF SY-SUBRC <> 0.
        MESSAGE I208(00)
                 WITH 'No authorition'.
      ENDIF.
    ENDIF.
  ENDIF.
ENDFORM.

*---------------------------------------------------------------------*
*       FORM TOP-OF-PAGE                                              *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM TOP-OF-PAGE.
  WRITE: / BKPF-BUKRS,
         / BKPF-BELNR HOTSPOT,
         / BKPF-GJAHR.
  SKIP.
ENDFORM.

Max