Skip to Content

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

alv grid

hi ,

i want to display 'enjoysap_logo ' on the top of my display.. but tat thing is not coming .. please help me

REPORT YASEC_ALV_TEST.

tables : mara .

type-pools: SLIS.

&----


*& Include YASEC_ALV_TEST_TOP

&----


types : begin of st_mara ,

matnr like mara-matnr ,

mtart like mara-mtart ,

matkl like mara-matkl ,

pstat like mara-pstat ,

NTGEW LIKE MARA-NTGEW ,

end of st_mara .

data : it_tab type standard table of st_mara ,

it_tab1 type SLIS_T_FIELDCAT_ALV,

wa_tab type st_mara,

wa_tab1 like line of it_tab1,

grid1 TYPE REF TO cl_gui_alv_grid.

data : is_varient TYPE disvariant.

DATA: gt_events type slis_t_event,

it_list_top_of_page TYPE slis_t_listheader,

wa_list_top_of_page LIKE LINE OF it_list_top_of_page,

wa_events LIKE LINE OF gt_events,

gd_prntparams type slis_print_alv.

initialization .

wa_tab1-fieldname = 'MATNR'.

wa_tab1-tabname = 'MARA'.

  • WA_TAB1-ref_fieldname ='MATNR'.

WA_TAB1-ref_tabname = 'MARA'.

*WA_TAB1-SELTEXT_L = 'MATERIAL'.

APPEND WA_TAB1 TO IT_TAB1.

wa_tab1-fieldname = 'MTART'.

wa_tab1-tabname = 'MARA'.

*WA_TAB1-SELTEXT_L = 'MTART'.

APPEND WA_TAB1 TO IT_TAB1.

wa_tab1-fieldname = 'MATKL'.

wa_tab1-tabname = 'MARA'.

*WA_TAB1-SELTEXT_L = 'MATKL'.

APPEND WA_TAB1 TO IT_TAB1.

wa_tab1-fieldname = 'PSTAT'.

wa_tab1-tabname = 'MARA'.

*WA_TAB1-SELTEXT_L = 'PSTAT'.

APPEND WA_TAB1 TO IT_TAB1.

wa_tab1-fieldname = 'NTGEW'.

wa_tab1-tabname = 'MARA'.

*WA_TAB1-SELTEXT_L = 'NTGEW'.

APPEND WA_TAB1 TO IT_TAB1.

start-of-selection.

select matnr mtart matkl pstat NTGEW

from mara into table it_tab up to 10 rows .

perform f_is_varient.

PERFORM f_it_list_top_of_page .

PERFORM TOP_OF_PAGE.

perform build_events.

perform build_print_params.

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 = 'END_OF_LIST'

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

IT_FIELDCAT = it_tab1

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

I_SAVE = 'X'

IS_VARIANT = is_varient

IT_EVENTS = gt_events

  • IT_EVENT_EXIT = gt_events

IS_PRINT = gd_prntparams

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 10

  • I_SCREEN_START_LINE = 10

  • I_SCREEN_END_COLUMN = 60

  • I_SCREEN_END_LINE = 30

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

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.

&----


*& Form BUILD_EVENTS

&----


  • Build events table

----


form build_events.

data: ls_event type slis_alv_event.

call function 'REUSE_ALV_EVENTS_GET'

exporting

i_list_type = 0

importing

et_events = gt_events[].

read table gt_events with key name = slis_ev_top_of_page

into ls_event.

if sy-subrc = 0.

move 'TOP_OF_PAGE' to ls_event-form.

append ls_event to gt_events.

endif.

read table gt_events with key name = slis_ev_end_of_list

into ls_event.

if sy-subrc = 0.

move 'END_OF_LIST' to ls_event-form.

append ls_event to gt_events.

endif.

endform. " BUILD_EVENTS

&----


*& Form BUILD_PRINT_PARAMS

&----


  • Setup print parameters

----


form build_print_params.

gd_prntparams-reserve_lines = '3'. "Lines reserved for footer

gd_prntparams-no_coverpage = 'X'.

endform. " BUILD_PRINT_PARAMS

&----


*& Form END_OF_PAGE

&----


form TOP_OF_PAGE.

  • data: listwidth type i,

  • ld_pagepos(10) type c,

  • ld_page(10) type c.

  • write: sy-uline(50).

  • skip.

  • write:/40 'Page:', sy-pagno .

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = it_list_top_of_page

i_logo = 'ENJOYSAP_LOGO'.

endform.

&----


*& Form END_OF_LIST

&----


form END_OF_LIST.

data: listwidth type i,

ld_pagepos(10) type c,

ld_page(10) type c.

skip.

write:/40 'Page:', sy-pagno .

write :/ 'this is the end of list'.

  • CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

  • EXPORTING

    • it_list_commentary = it_list_top_of_page

  • i_logo = 'ENJOYSAP_LOGO' .

endform.

form f_is_varient.

is_varient-report = 'varient'.

is_varient-username = 'nikesh'.

is_varient-text = 'anytext'.

endform.

FORM f_it_list_top_of_page .

wa_list_top_of_page-typ = 'H'.

wa_list_top_of_page-info = 'PROGRAM ON ALV'.

APPEND wa_list_top_of_page TO it_list_top_of_page.

ENDFORM.

Tags:
Former Member replied

Hi Nikesh,

Have a look at this sample code.

&----


*& Report ZFM_ALV_LOGO

*&

&----


*&

*&

&----


REPORT ZFM_ALV_LOGO.

DATA ITAB LIKE TABLE OF mara.

TYPE-POOLS SLIS.

***********DECLARATIONS********************************

DATA LIST_TOP TYPE SLIS_T_LISTHEADER.

DATA LIST_LINE TYPE SLIS_LISTHEADER.

DATA EVENTS TYPE SLIS_T_EVENT.

DATA FORMNAME_E_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.

DATA PTESTRUN(1).

DATA REPNAME LIKE SY-REPID.

CONSTANTS: FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.

DATA LAYOUT TYPE SLIS_LAYOUT_ALV.

*************INITIALIZATION**************************

INITIALIZATION.

REPNAME = SY-REPID.

PERFORM BUILD_EVENTTAB USING EVENTS[].

CLEAR LIST_LINE.

LIST_LINE-TYP = 'H'.

LIST_LINE-INFO = SY-TITLE.

APPEND LIST_LINE TO LIST_TOP.

CLEAR LIST_LINE.

LIST_LINE-TYP = 'S'.

LIST_LINE-KEY = 'PROGRAM NAME'.

LIST_LINE-INFO = SY-REPID.

APPEND LIST_LINE TO LIST_TOP.

CLEAR LIST_LINE.

LIST_LINE-TYP = 'S'.

LIST_LINE-KEY = 'USER'.

LIST_LINE-INFO = SY-UNAME.

APPEND LIST_LINE TO LIST_TOP.

CLEAR LIST_LINE.

LIST_LINE-TYP = 'S'.

LIST_LINE-KEY = 'DATE'.

LIST_LINE-INFO = SY-DATUM.

APPEND LIST_LINE TO LIST_TOP.

CLEAR LIST_LINE.

LIST_LINE-TYP = 'S'.

LIST_LINE-KEY = 'TIME'.

LIST_LINE-INFO = sy-uzeit.

APPEND LIST_LINE TO LIST_TOP.

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

SELECT * FROM mara INTO TABLE ITAB.

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

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = REPNAME

I_STRUCTURE_NAME = 'mara'

IT_EVENTS = EVENTS[]

TABLES

T_OUTTAB = ITAB.

*****FORM FOR TOP OF PAGE******************

FORM TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

I_LOGO = 'ENJOYSAP_LOGO'

IT_LIST_COMMENTARY = LIST_TOP.

ENDFORM.

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

****************FORM EVENT***********************

FORM BUILD_EVENTTAB USING P1_EVENTS TYPE SLIS_T_EVENT.

DATA: LS_EVENT TYPE SLIS_ALV_EVENT.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = P1_EVENTS.

READ TABLE P1_EVENTS WITH KEY NAME = FORMNAME_TOP_OF_PAGE

INTO LS_EVENT.

IF SY-SUBRC = 0.

MOVE FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.

APPEND LS_EVENT TO P1_EVENTS.

ENDIF.

ENDFORM.

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

Reward if Useful.

Regards,

Chitra

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question