Posted: Sun Mar 02, 2008 12:26 pm Post subject: Using Logos & wallpapers in ALV report
Code:
*----------------------------------------------------------------------
* Program: ZZ_ALV_REPORT_STUB
* Author : Clayton Mergen
* 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.
*--------------------------------
* 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.
*--------------------------------
* 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.
*----------------------------------------------------------------------
* Forms
*----------------------------------------------------------------------
*&---------------------------------------------------------------------*
*& Form variant_f4
*&---------------------------------------------------------------------*
form variant_f4 using p_variant.
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.
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.
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.
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.
* 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.
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.
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.
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.
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.
endform.
*&---------------------------------------------------------------------*
*& Form event_exit_build
*&---------------------------------------------------------------------*
form event_exit_build.
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.
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'.
endform.
*&---------------------------------------------------------------------*
*& Form exclude_build
*&---------------------------------------------------------------------*
form exclude_build.
w_excluding = '&GRAPH'. "Graphic
append w_excluding to i_excluding.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.