Professional Documents
Culture Documents
date:-03/01/2007
What Is ALV
Example Output
ALV-ABAP List Viewer
Grid Display
List Display
Back
Another DEFINITION
Back
There are some function modules which will enable to
produce the above reports without much effort.
1. Simple Report
Reuse_alv_list_display
Reuse_alv_fieldcatalog_merge
Reuse_alv_events_get
Reuse_alv_commentary_write
Reuse_alv_grid_display
Common Features of ALV
ALV Gives the Following options Below to the User After Listing
Out put to Screen
Finding Out the Details of specific records
Sorting
Descending
Ascending
Hide Columns
1. Export:
a. I_callback_program : report id
b. I_callback_pf_status_set : routine where a user can set his own pf
status
or change the functionality of the existing pf
status.
c. I_callback_user_command : routine where the function codes are
handled.
SIMPLE REPORT CONTD...
d. I_structure name
: name of the dictionary table
e. Is_Layout : structure to set the layout of the report
f. It_fieldcat : internal table with the list of all fields and their
attributes which are to be printed (this table can
be populated automatically by the function
module
REUSE_ALV_FIELDCATALOG_MERGE)
g. It_events : internal table with a list of all possible events of
ALV
and their corresponding routine names.
2. Tables:
a. t_outtab : internal table with the data to be output
SIMPLE REPORT CONTD...
B. REUSE_ALV_FIELDCATALOG_MERGE:
1. Export:
a. I_program_name : report id
b. I_internal_tabname : the internal output table
c. I_inclname : include or the report name where all the
dynamic
forms are handled.
2. Changing
ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV
which is declared in the type pool SLIS.
SIMPLE REPORT CONTD...
1. Import:
2. Export:
D. REUSE_ALV_COMMENTARY_WRITE : This is
used in the Top-of-page event to print the headings and
other comments for the list.
E. REUSE_ALV_GRID_DISPLAY: A
new function in 4.6 version, to display
the results in grid rather than as a list.
Parameters : same as
reuse_alv_list_display
INTERNAL TABLES IN SLIS
Important Attributes:
a. col_pos : position of the column
b. fieldname : internal fieldname
c. tabname : internal table name
d. ref_fieldname : fieldname (dictionary)
e. ref_tabname : table (dictionary)
f. key(1) : column with key-color
g. icon(1) : icon
h. hotspot(1) : hotspot
i. Symbol(1) : symbol
j. Checkbox(1) : checkbox
k. just(1) : (R)ight (L)eft (C)ent
l. do_sum(1) : sum up
m. no_out(1) : (O)blig. (X)no out
n. outputlen : output length
o. seltext-l : long key word
p. seltext_m : middle key word
q. seltext_s : short key word
r. reptext_ddic : heading(ddic)
s. ddictxt(1) : (S)hort (M)iddle (L)ong
t. datatype : datatype
2. SLIS_T_EVENT :
Internal table for storing all the possible events of the ALV.
This can be populated by the function module
Reuse_alv_events_get
I_CALLBACK_PF_STATUS_SET
Syntax :
FORM set_pf_status USING rt_extab TYPE slis_t_extab
The table RT_EXTAB contains the function codes which are hidden in
the standard interface.
I_CALLBACK_USER_COMMAND
Syntax :
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
The structure rs_selfield has the details about the current cursor
position.
Steps Involved
Back
Example Out Put Screen
I
call function 'REUSE_ALV_GRID_DISPLAY MAINALV FUNCTION(Grid display)
exporting
i_background_id = 'ALV_BACKGROUND Background
i_callback_program = repname Program name
i_structure_name = 'ITAB2 Internal tabl
is_layout = layout layout
it_fieldcat = fieldtab layout Setting
i_default = 'X Default layout
i_save = g_save for to save varient
i_grid_title = text-101 TITLE
is_variant = g_variant Input Varient
it_events = events[] Events
tables
t_outtab = itab2. Outputiing table
if sy-subrc <> 0.
write: 'SY-SUBRC: ', sy-subrc, 'REUSE_ALV_LIST_DISPLAY'.
endif.
Detailing in to POP-UP
form build_layout using p_layout type
slis_layout_alv.
p_layout-f2code = f2code.
p_layout-zebra = 'X'.
p_layout-detail_popup = 'X'.
endform.
Pass F2Code to ALV-Layout Definition F2code is defined by
SAP.
Pop Up Parameter Should be X
l_fieldcat-tabname ='ITAB2'.
l_fieldcat-sp_group = 'A'. Group Specificatio
l_fieldcat-do_sum = 'X'. Setting it to Sum
l_fieldcat-fieldname ='DMBTR'.
l_fieldcat-col_pos = pos.
l_fieldcat-seltext_m ='AMOUNT1'.
l_fieldcat-seltext_l ='AMOUNT1'.
l_fieldcat-seltext_s ='AMOUNT1'.
append l_fieldcat to p_fieldtab.
clear : l_fieldcat.
clear : l_fieldcat.
pos = pos + 1.
l_fieldcat-tabname = 'ITAB2'. Internal Table on
which we Filled The data
l_fieldcat-fix_column = 'X'. Fixing Coloumns
l_fieldcat-no_out = 'O'. Hiding Coloumn
l_fieldcat-fieldname = 'LIFNR'. Field name
l_fieldcat-col_pos = pos. Position
l_fieldcat-seltext_m ='VENDOR'. Header Text
l_fieldcat-seltext_l ='VENDOR'. Header Text
l_fieldcat-seltext_s ='VENDOR'. header text
append l_fieldcat to p_fieldtab.
clear : l_fieldcat. Clearing Fieldcat table
*** Field Cat Table Contains all the Informations abt
Layout Set
Back Code
g_save = 'A'. FOR TO SAVE VARIENT
clear g_variant.
g_variant-report = repname.
gx_variant = g_variant.
call function 'REUSE_ALV_VARIANT_DEFAULT_GET'
exporting
i_save = g_save
changing
cs_variant = gx_variant
exceptions
not_found = 2.
if sy-subrc = 0.
p_vari = gx_variant-variant.
endif. Back
Differentiating Key Fields with Non Key
fields etc
Back
Look with List Display
back
Project Specific-Examples
check box and customized menu bar
Subtotal on Plant column
Grey out a checkbox.
Requirement:Indicates that an open order has been closed
After the open order has been closed, the box appears greyed out. So that
it need not be processed further
Double click on a column in order to navigate to various transactions
How to write the routine?
Coding requirements:-
***************************************************************
*********
* TYPE POOLS DECLARATION REQUIRED FOR ALV DISPLAY
***************************************************************
*********
type-pools: slis.
***************************************************************
*********
DATA DECLARATION REQUIRED FOR alv DISPLAY
clear l_fieldcat.
l_fieldcat-col_pos = 1.
l_fieldcat-tabname = 'T_OUT' .
l_fieldcat-fieldname = 'EBELN'.
l_fieldcat-ref_tabname = 'EKPO'.
l_fieldcat-key = 'X'.
l_fieldcat-seltext_l = 'PO Number'.
l_fieldcat-reptext_ddic = 'Po No'.
append l_fieldcat to i_fieldtab.
clear l_fieldcat.
l_fieldcat-col_pos = 2.
l_fieldcat-tabname = 'T_OUT' .
l_fieldcat-fieldname = 'EBELP'.
l_fieldcat-ref_tabname = 'EKPO'.
l_fieldcat-seltext_l = 'PO Item'.
l_fieldcat-outputlen = 7.
append l_fieldcat to i_fieldtab.
endform. "SET_PF_STATUS
Routine for USER_COMMAND
form excel_download using r_ucomm like sy-ucomm
case r_ucomm.
when '&ZXL'.
perform file_header.
when '&ZRFR'.
rs_selfield-refresh = 'X'.
clear r_ucomm.
BUILD_LAYOUT
form build_layout.
i_layout-box_fieldname = 'CHECK_BOX'.
i_layout-box_tabname = 'T_OUT'.
i_layout-zebra = 'X'.
I_layout-no_input = X.
endform.
How to disable the check-box
if sy-subrc eq 0.
move '2' to w_box.
modify t_out from w_out2 index w_tabix-
value.
else.
clear w_box.
endif.
Report Header Information
What to pass to the FM
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
* I_INTERFACE_CHECK =''
i_callback_program = repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'EXCEL_DOWNLOAD'
* i_structure_name = 'T_OUT'
is_layout = i_layout
it_fieldcat = i_fieldtab
* it_excluding = i_extab
* IT_SPECIAL_GROUPS =
it_sort = i_sort
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE =''
* IS_VARIANT =''
it_events = i_events[]
Using Events
Data: i_events type slis_t_event with header line ,
i_sort type slis_t_sortinfo_alv,
i_extab type slis_t_extab,
i_list_top_of_page type slis_t_listheader with header line.
form events.
data: ls_event type slis_alv_event .
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = i_events[]
exceptions
list_type_wrong = 1
others = 2.
Create Page heading event
read table i_events with key name = slis_ev_top_of_page into
ls_event.
if sy-subrc eq 0.
g_indx1 = sy-tabix.
ls_event-form = 'PAGE_HEADINGS'.
modify i_events from ls_event index g_indx1 transporting form.
endif.
form comment_build using p_i_list_top_of_page
type slis_t_listheader.
clear ls_line.
ls_line-typ = 'S'.
ls_line-key = 'User Name :'.
ls_line-info = sy-uname.
append ls_line to p_i_list_top_of_page.
clear ls_line.
ls_line-typ = 'S'.
ls_line-key = 'Report Name :'.
ls_line-info = sy-repid..
append ls_line to p_i_list_top_of_page.
How to use the variant property
We can only see the key field
key field is mandatory and
cannot be hidden
Questions
THANKYOU !