‎2007 Aug 01 2:56 PM
if i want selection screen before
report zrich .
data: begin of i_alv occurs 0,
matnr type mara-matnr,
mtart type mara-mtart,
matkl type mara-matkl,
groes type mara-groes,
brgew type mara-brgew,
end of i_alv.
data: alv_container type ref to cl_gui_docking_container.
data: alv_grid type ref to cl_gui_alv_grid.
<b>data: sort type lvc_t_sort.</b>
data: fieldcat type lvc_t_fcat.
data: repid type sy-repid.
parameters: p_check.
initialization.
repid = sy-repid.
perform get_data.
at selection-screen output.
check alv_container is initial.
create object alv_container
exporting repid = repid
dynnr = sy-dynnr
side = alv_container->dock_at_left
extension = 1500.
create object alv_grid
exporting
i_parent = alv_container.
Populate Field Catalog
perform get_fieldcatalog.
<b> perform get_sort.</b>
call method alv_grid->set_table_for_first_display
exporting
i_structure_name = 'I_ALV'
changing
it_outtab = i_alv[]
<b> it_sort = sort[]</b>
it_fieldcatalog = fieldcat[].
start-of-selection.
************************************************************************
FORM GET_DATA
************************************************************************
form get_data.
select * into corresponding fields of table i_alv
from mara
up to 100 rows.
sort i_alv ascending by matnr.
endform.
************************************************************************
Form Get_Fieldcatalog - Set Up Columns/Headers
************************************************************************
form get_fieldcatalog.
data: ls_fcat type lvc_s_fcat.
refresh: fieldcat.
clear: ls_fcat.
ls_fcat-reptext = 'Material Number'.
ls_fcat-fieldname = 'MATNR'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '18'.
ls_fcat-fix_column = 'X'.
ls_fcat-key = 'X'.
ls_fcat-col_pos = '1'.
append ls_fcat to fieldcat.
clear: ls_fcat.
ls_fcat-reptext = 'Material Type'.
ls_fcat-fieldname = 'MTART'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '10'.
ls_fcat-fix_column = 'X'.
ls_fcat-key = 'X'.
ls_fcat-col_pos = '2'.
append ls_fcat to fieldcat.
clear: ls_fcat.
ls_fcat-reptext = 'Material Group'.
ls_fcat-fieldname = 'MATKL'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '12'.
ls_fcat-col_pos = '3'.
append ls_fcat to fieldcat.
clear: ls_fcat.
ls_fcat-reptext = 'Size'.
ls_fcat-fieldname = 'GROES'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '30'.
ls_fcat-col_pos = '4'.
append ls_fcat to fieldcat.
clear: ls_fcat.
ls_fcat-reptext = 'Weight'.
ls_fcat-fieldname = 'BRGEW'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '15'.
ls_fcat-col_pos = '5'.
<b> ls_fcat-do_sum = 'X'.
ls_fcat-datatype = 'QUAN'.</b>
append ls_fcat to fieldcat.
endform.
************************************************************************
Form sort
************************************************************************
form get_sort.
<b> data: ls_sort type lvc_s_sort.
refresh sort.
ls_sort-fieldname = 'MATKL'.
ls_sort-up = 'X'.
ls_sort-subtot = 'X'.
append ls_sort to sort.</b>
endform.
‎2007 Aug 01 3:10 PM
Well, this program actually implements the ALV grids in a docking container on the selection screen. If you want to see this selection screen, make the extension on the docking container like 150 instead of 1500
create object alv_container
exporting repid = repid
dynnr = sy-dynnr
side = alv_container->dock_at_left
extension = 150. " <---- RIGHT HERE
Since it is set at 1500, the docking container is stretched the entire way across the screen, if you want it to only take up part of the screen, so that you can see the selection-screen as well, then make the extension less.
Regards,
RIch Heilman