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: 

ALV logo and footer

Former Member
0 Kudos

Hi Group,

Can any body help me how to add logo and footers for this code.I uploaded the logo using OAER tansaction

when I am using REUSE_ALV_COMMENTARY_WRITE to upload

logo its termination error.

REPORT ZTEMPLET .

type-pools: slis.

data: x_fieldcat type slis_fieldcat_alv,

it_fieldcat type slis_t_fieldcat_alv,

x_events type slis_alv_event,

it_events type SLIS_T_EVENT,

gd_layout type slis_layout_alv.

data: v_lines type i.

data : BEGIN OF it_marav occurs 100,

matnr like marav-matnr,

maktx like marav-maktx,

matkl like marav-matkl,

ntgew like marav-ntgew,

gewei like marav-gewei,

END OF it_marav.

select matnr maktx matkl ntgew gewei

up to 10 rows

from marav

into table it_marav.

x_events-name = 'TOP_OF_PAGE'.

x_events-form = 'TOP_OF_PAGE'.

append x_events to it_events.

clear x_events.

gd_layout-no_input = 'X'.

gd_layout-colwidth_optimize = 'X'.

gd_layout-totals_text = 'Totals'(201).

call function 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = sy-repid

I_INTERNAL_TABNAME = 'IT_MARAV'

I_INCLNAME = sy-repid

CHANGING

ct_fieldcat = IT_FIELDCAT

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3.

if sy-subrc <> 0.

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

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

endif.

describe table it_marav lines v_lines.

call function 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = sy-repid

I_CALLBACK_PF_STATUS_SET = 'STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

is_layout = gd_layout

IT_FIELDCAT = IT_FIELDCAT

IT_EVENTS = IT_EVENTS

TABLES

t_outtab = IT_MARAV[]

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

WRITE:/ 'Report', 30 SY-REPID, 40 SY-DATUM.

1 REPLY 1

LucianoBentiveg
Active Contributor
0 Kudos

Try this one:

*----


  • Program: ZZ_ALV_REPORT_STUB

  • Author :

  • Date :

*

  • Purpose: Report using ALV function

*

  • Notes:

  • 1) Logos & wallpapers can be found in table BDS_CONN05

  • with class = PICTURES

*

  • 2) Transaction OAER can be used to create PICTURES.

  • Run transaction OAER with class name = PICTURES, Class type = OT,

  • and Object key with whatever name you want to create. In the

  • next screen, right clicking on screen and import

*

*----


  • Revisions

*----


  • Name :

  • Date :

  • Comments:

*----


report zz_alv_report_stub

no standard page heading

line-size 200

line-count 65

message-id zz.

*----


  • Tables

*----


tables:

ekpo,

trdir.

*----


  • Global Types

*----


type-pools: slis.

*----


  • Global Internal Tables

*----


data:

i_fieldcat_alv type slis_t_fieldcat_alv,

i_events type slis_t_event,

i_event_exit type slis_t_event_exit,

i_list_comments type slis_t_listheader,

i_excluding type slis_t_extab.

  • Display data

data: begin of i_data occurs 0,

name like trdir-name,

clas like trdir-clas,

subc like trdir-subc,

cnam like trdir-cnam,

cdat like trdir-cdat,

myfield(1) type c,

end of i_data.

*----


  • Global Variables

*----


data:

w_variant like disvariant,

wx_variant like disvariant,

w_variant_save(1) type c,

w_exit(1) type c,

w_repid like sy-repid,

w_user_specific(1) type c,

w_callback_ucomm type slis_formname,

w_print type slis_print_alv,

w_layout type slis_layout_alv,

w_html_top_of_page type slis_formname,

w_fieldcat_alv like line of i_fieldcat_alv,

w_excluding like line of i_excluding,

w_events like line of i_events,

w_event_exit like line of i_event_exit,

w_list_comments like line of i_list_comments.

*----


  • Global Constants

*----


*constants:

*----


  • Selection Screen

*----


selection-screen begin of block blk_criteria with frame title text-f01.

select-options:

s_name for trdir-name.

selection-screen end of block blk_criteria.

selection-screen begin of block blk_params with frame title text-f02.

parameters:

p_vari like disvariant-variant.

selection-screen skip 1.

parameters:

p_grid radiobutton group rb01 default 'X',

p_html as checkbox.

selection-screen skip 1.

parameters:

p_list radiobutton group rb01.

selection-screen end of block blk_params.

*----


  • Initialization

*----


initialization.

perform init_variant.

perform variant_default using p_vari.

clear: s_name[].

s_name-sign = 'I'.

s_name-option = 'CP'.

s_name-low = 'Z*'.

append s_name.

*----


  • At Selection Screen PBO

*----


at selection-screen output.

*----


  • At Selection Screen Value Request

*----


at selection-screen on value-request for p_vari.

perform variant_f4 using p_vari.

*----


  • At Selection Screen

*----


at selection-screen.

perform variant_fill.

*----


  • Start of Selection

*----


start-of-selection.

perform get_data.

end-of-selection.

perform fieldcat_build.

perform event_build.

perform event_exit_build.

perform exclude_build.

perform print_build.

perform layout_build.

perform display_data.

*----


  • Top of Page

*----


top-of-page.

*----


  • Top of Page During Line Sel

*----


top-of-page during line-selection.

*----


  • At User Command

*----


at user-command.

*----


  • At Line Selection

*----


at line-selection.

*----


  • Macros

*----


define skip_1.

write: /001 sy-vline,

at sy-linsz sy-vline.

end-of-definition.

*----


  • Forms

*----


&----


*& Form variant_f4

&----


form variant_f4 using p_variant.

call function 'LVC_VARIANT_F4'

exporting

is_variant = w_variant

i_save = w_variant_save

importing

e_exit = w_exit

es_variant = wx_variant

exceptions

not_found = 1

program_error = 2

others = 3.

if sy-subrc <> 0.

message i000(zz) with text-g01.

endif.

if w_exit is initial.

w_variant-variant = wx_variant-variant.

p_variant = wx_variant-variant.

endif.

endform.

&----


*& Form init_variant

&----


form init_variant.

clear: w_variant.

w_repid = sy-repid.

w_variant-report = w_repid.

w_variant-username = sy-uname.

w_variant_save = 'A'. "All types

endform.

&----


*& Form variant_default

&----


form variant_default using p_variant.

wx_variant = w_variant.

if not p_variant is initial.

wx_variant-variant = p_variant.

endif.

call function 'LVC_VARIANT_DEFAULT_GET'

exporting

i_save = w_variant_save

changing

cs_variant = wx_variant

exceptions

wrong_input = 1

not_found = 2

program_error = 3

others = 4.

case sy-subrc.

when 0.

p_variant = wx_variant-variant.

when 2.

clear: p_variant.

endcase.

endform.

&----


*& Form variant_fill

&----


form variant_fill.

clear: w_variant.

if p_vari is initial.

w_variant-variant = 'STANDARD'.

w_variant-report = w_repid.

else.

w_variant-variant = p_vari.

w_variant-report = w_repid.

call function 'LVC_VARIANT_EXISTENCE_CHECK'

exporting

i_save = w_variant_save

changing

cs_variant = w_variant

exceptions

others = 01.

if sy-subrc ne 0.

message i000(zz) with text-g02.

endif.

endif.

endform.

&----


*& Form fieldcat_build

&----


form fieldcat_build.

call function 'REUSE_ALV_FIELDCATALOG_MERGE'

exporting

i_program_name = w_repid

  • i_structure_name = 'TRDIR'

i_internal_tabname = 'I_DATA'

i_inclname = w_repid

changing

ct_fieldcat = i_fieldcat_alv.

  • Modify displayed fields

loop at i_fieldcat_alv into w_fieldcat_alv.

case w_fieldcat_alv-fieldname.

when 'NAME'.

w_fieldcat_alv-hotspot = 'X'.

when 'MYFIELD'.

w_fieldcat_alv-checkbox = 'X'.

w_fieldcat_alv-seltext_s = 'MyChkBox'.

when others.

endcase.

modify i_fieldcat_alv from w_fieldcat_alv.

endloop.

endform.

&----


*& Form display_data

&----


form display_data.

w_callback_ucomm = 'CALLBACK_UCOMM'.

case 'X'.

when p_grid.

if p_html = 'X'.

w_html_top_of_page = 'HTML_TOP_OF_PAGE'.

endif.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

  • i_background_id = 'SIWB_WALLPAPER'

i_background_id = 'SIWB_WALLPAPER'

i_callback_program = w_repid

i_callback_html_top_of_page = w_html_top_of_page

  • i_structure_name = 'TRDIR'

i_default = 'X'

i_save = 'A'

is_variant = w_variant

is_layout = w_layout

i_callback_user_command = w_callback_ucomm

it_fieldcat = i_fieldcat_alv

it_events = i_events

it_event_exit = i_event_exit

it_excluding = i_excluding

is_print = w_print

  • i_screen_start_column = 1

  • i_screen_start_line = 1

  • i_screen_end_column = 70

  • i_screen_end_line = 30

tables

t_outtab = i_data.

when p_list.

call function 'REUSE_ALV_LIST_DISPLAY'

exporting

i_background_id = 'ALV_BACKGROUND'

i_callback_program = w_repid

i_default = 'X'

i_save = 'A'

is_variant = w_variant

is_layout = w_layout

i_callback_user_command = w_callback_ucomm

it_fieldcat = i_fieldcat_alv

it_events = i_events

it_event_exit = i_event_exit

is_print = w_print

tables

t_outtab = i_data.

endcase.

endform.

----


  • FORM user_command *

----


form callback_ucomm using r_ucomm like sy-ucomm

rs_selfield type slis_selfield.

message i000(zz) with r_ucomm.

case r_ucomm.

when '&IC1'.

set parameter id 'RID' field rs_selfield-value.

call transaction 'SE38'.

when others.

endcase.

endform.

&----


*& Form get_data

&----


form get_data.

select * up to 15 rows from trdir

into corresponding fields of table i_data

where name in s_name.

endform.

----


  • FORM ALV_TOP_OF_PAGE *

----


form alv_top_of_page.

clear: i_list_comments[].

w_list_comments-typ = 'H'. "H=Header, S=Selection, A=Action

w_list_comments-key = ''.

w_list_comments-info = 'Info 1'.

append w_list_comments to i_list_comments.

w_list_comments-typ = 'A'. " H = Header, S = Selection, A = Action

w_list_comments-key = ''.

w_list_comments-info = 'Begin of list'.

append w_list_comments to i_list_comments.

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

i_logo = 'ENJOYSAP_LOGO'

it_list_commentary = i_list_comments.

endform.

&----


*& Form event_build

&----


form event_build.

call function 'REUSE_ALV_EVENTS_GET'

exporting

i_list_type = 0

importing

et_events = i_events.

read table i_events

with key name = slis_ev_top_of_page

into w_events.

if sy-subrc = 0.

move 'ALV_TOP_OF_PAGE' to w_events-form.

modify i_events from w_events index sy-tabix.

endif.

read table i_events

with key name = slis_ev_end_of_list

into w_events.

if sy-subrc = 0.

move 'ALV_END_OF_LIST' to w_events-form.

modify i_events from w_events index sy-tabix.

endif.

read table i_events

with key name = slis_ev_end_of_page

into w_events.

if sy-subrc = 0.

move 'ALV_END_OF_PAGE' to w_events-form.

modify i_events from w_events index sy-tabix.

endif.

endform.

----


  • FORM alv_end_of_list *

----


form alv_end_of_list.

clear: i_list_comments[].

w_list_comments-typ = 'A'. "H = Header, S = Selection, A = Action

w_list_comments-key = ''.

w_list_comments-info = 'End of list'.

append w_list_comments to i_list_comments.

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = i_list_comments

i_logo = 'ZMYOBJECTKEY'

i_end_of_list_grid = 'X'.

endform.

----


  • FORM alv_end_of_page *

----


form alv_end_of_page.

endform.

&----


*& Form print_build

&----


form print_build.

w_print-no_print_listinfos = 'X'.

endform.

&----


*& Form layout_build

&----


form layout_build.

w_layout-zebra = 'X'.

w_layout-no_vline = 'X'.

w_layout-colwidth_optimize = 'X'.

w_layout-detail_popup = 'X'.

w_layout-detail_initial_lines = 'X'.

w_layout-detail_titlebar = 'Detail Title Bar'.

endform.

&----


*& Form event_exit_build

&----


form event_exit_build.

clear: i_event_exit[].

  • Pick

w_event_exit-ucomm = '&ETA'.

w_event_exit-before = ' '.

w_event_exit-after = 'X'.

append w_event_exit to i_event_exit.

endform.

----


  • FORM HTML_TOP_OF_PAGE *

----


form html_top_of_page using r_top type ref to cl_dd_document.

data:

text type sdydo_text_element,

s_table type ref to cl_dd_table_element,

col_key type ref to cl_dd_area,

col_info type ref to cl_dd_area,

a_logo type ref to cl_dd_area.

  • Split TOP-Document

call method r_top->vertical_split

exporting split_area = r_top

split_width = '30%'

importing right_area = a_logo.

  • Fill TOP-Document

call method r_top->add_text

exporting text = 'Example of a Heading'

sap_style = 'HEADING'.

call method r_top->new_line.

call method r_top->new_line.

call method r_top->add_table

exporting no_of_columns = 2

with_heading = ' '

border = '1'

importing table = s_table.

call method s_table->add_column importing column = col_key.

call method s_table->add_column importing column = col_info.

text = 'A key value marked'.

call method col_key->add_text

exporting text = text

sap_emphasis = 'Strong'.

call method col_info->add_gap exporting width = 6.

text = '600' .

call method col_info->add_text

exporting text = text

sap_style = 'Key'.

call method col_info->add_gap exporting width = 3.

text = 'Block brick units'.

call method col_info->add_text exporting text = text.

call method s_table->new_row.

text = 'Storage Bin'.

call method col_key->add_text

exporting text = text

sap_emphasis = 'Strong'.

call method col_info->add_gap exporting width = 7.

text = 'C-A-004'.

call method col_info->add_text exporting text = text.

call method s_table->new_row.

text = 'Warehouse number' .

call method col_key->add_text

exporting text = text

sap_emphasis = 'Strong'.

call method col_info->add_gap exporting width = 6.

text = '200' .

call method col_info->add_text

exporting text = text

sap_style = 'Success'.

call method col_info->add_gap exporting width = 3.

text = 'marked success'.

call method col_info->add_text exporting text = text.

call method s_table->new_row.

call method r_top->new_line.

text = 'This last line is a comment in italics.'.

call method r_top->add_text

exporting text = text

sap_emphasis = 'EMPHASIS'.

call method r_top->new_line.

call method a_logo->add_picture

  • exporting picture_id = 'ZZTESTBMP'.

exporting picture_id = 'ENJOYSAP_LOGO'.

endform.

&----


*& Form exclude_build

&----


form exclude_build.

w_excluding = '&GRAPH'. "Graphic

append w_excluding to i_excluding.

endform. " exclude_build