Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ALV report in ECC 6.0 'TOP-OF-PAGE'

Hi Friends,

Please, Kindly help me on below issue with Alv report for 'TOP-OF-PAGE' in ECC 6.0.

I have written the following code for "top-of-page' which is not getting the text given on this event, please help me if i committed any mistake in code.

type-pools : slis.

TABLES : KNA1,VBAK.

TYPES: BEGIN OF ty_kna1,

kunnr TYPE kna1-kunnr,

land1 TYPE kna1-land1,

name1 TYPE kna1-name1,

ort01 TYPE kna1-ort01,

END OF ty_kna1.

TYPES: BEGIN OF ty_vbak,

vbeln TYPE vbak-vbeln,

erdat TYPE vbak-erdat,

ernam TYPE vbak-ernam,

netwr TYPE vbak-netwr,

END OF ty_vbak.

DATA : W_KNA1 TYPE TY_KNA1,

W_VBAK TYPE TY_VBAK,

I_KNA1 TYPE STANDARD TABLE OF TY_KNA1,

I_VBAK TYPE STANDARD TABLE OF TY_VBAK.

DATA : W_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

DATA : V_REPID LIKE SY-REPID.

DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.

DATA: V_EVENTS TYPE SLIS_T_EVENT,

WA_EVENT TYPE SLIS_ALV_EVENT.

  • declartion for layout

DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.

SELECT-OPTIONS : S_KUNNR FOR KNA1-KUNNR.

INITIALIZATION.

V_REPID = SY-REPID.

PERFORM BUILD_FIELDCAT.

PERFORM EVENT_CALL.

PERFORM POPULATE_EVENT.

START-OF-SELECTION.

PERFORM DATA_RETRIEVAL.

PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.

END-OF-SELECTION.

PERFORM DISPLAY_DATA.

&----


*& Form BUILD_FIELDCAT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form BUILD_FIELDCAT .

W_FIELDCAT-TABNAME = 'I_KNA1'.

W_FIELDCAT-FIELDNAME = 'KUNNR'.

W_FIELDCAT-SELTEXT_M = 'CUST NAME'.

APPEND W_FIELDCAT TO I_FIELDCAT.

CLEAR W_FIELDCAT.

W_FIELDCAT-TABNAME = 'I_KNA1'.

W_FIELDCAT-FIELDNAME = 'LAND1'.

W_FIELDCAT-SELTEXT_M = 'COUNTRY'.

APPEND W_FIELDCAT TO I_FIELDCAT.

CLEAR W_FIELDCAT.

W_FIELDCAT-TABNAME = 'I_KNA1'.

W_FIELDCAT-FIELDNAME = 'NAME1'.

W_FIELDCAT-SELTEXT_M = 'NAME'.

APPEND W_FIELDCAT TO I_FIELDCAT.

CLEAR W_FIELDCAT.

W_FIELDCAT-TABNAME = 'I_KNA1'.

W_FIELDCAT-FIELDNAME = 'ORT01'.

W_FIELDCAT-SELTEXT_M = 'CITY'.

APPEND W_FIELDCAT TO I_FIELDCAT.

CLEAR W_FIELDCAT.

endform. " BUILD_FIELDCAT

&----


*& Form DATA_RETRIEVAL

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form DATA_RETRIEVAL .

SELECT KUNNR LAND1 NAME1 ORT01 FROM KNA1

INTO TABLE I_KNA1

WHERE KUNNR IN S_KUNNR.

endform. " DATA_RETRIEVAL

&----


*& Form DISPLAY_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form DISPLAY_DATA .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = V_REPID

  • 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 = ALV_LAYOUT

IT_FIELDCAT = I_FIELDCAT[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = V_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 = I_KNA1

  • 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. " DISPLAY_DATA

&----


*& Form BUILD_LISTHEADER

&----


  • text

----


  • -->P_IT_LISTHEADER text

----


form BUILD_LISTHEADER using i_listheader TYPE SLIS_T_LISTHEADER.

DATA HLINE TYPE SLIS_LISTHEADER.

HLINE-INFO = 'CUSTOMER DETAILS'.

HLINE-TYP = 'H'.

append hline to it_listheader.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = I_LISTHEADER

  • i_logo =

  • I_END_OF_LIST_GRID =

.

endform. " BUILD_LISTHEADER

&----


*& Form EVENT_CALL

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form EVENT_CALL .

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = V_EVENTS

  • 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.

endform. " EVENT_CALL

&----


*& Form POPULATE_EVENT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form POPULATE_EVENT .

READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.

IF SY-SUBRC EQ 0.

WA_EVENT-FORM = 'TOP_OF_PAGE'.

MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =

WA_EVENT-FORM.

ENDIF.

Thanks in Advance,

Chandra.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question