10-16-2008 1:48 PM
Dear Friends,
I have recieved a uncommon requirement using ALV grid. Let there be four coloumn in my alv grid say no, name,date, status.
The user wants to display at first to the grid, records having only status = 3
In the associated database table there are plenty of records.
But when they use the filter tab of alv grid, they need to fetch all the records respective of the search conditions they give, not only using the coloumn status but also other columns they ll use for search criteria.
Any suggestions for my development to start.
10-16-2008 1:54 PM
yes it is possible. default you can show the data using the filter this shows only data which is required. if you delete the filter then you can see all the data which you have in internal table.
Just take this example.
report ztest_filter.
data: itab type table of vbak.
data: container type ref to cl_gui_custom_container,
grid type ref to cl_gui_alv_grid.
start-of-selection.
select * from vbak
into table itab
up to 1000 rows.
call screen 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module status_0100 output.
SET PF-STATUS STATUS'.
create object container
exporting
container_name = 'CONT'
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6
.
if sy-subrc ne 0.
endif.
create object grid
exporting
i_parent = container
exceptions
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5
.
if sy-subrc ne 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
data:
gt_filter type lvc_t_filt ,
gs_filter type lvc_s_filt .
gs_filter-fieldname = 'VBELN' .
gs_filter-sign = 'E' .
gs_filter-option = 'BT' .
gs_filter-low = '0000004969' .
gs_filter-high = '0000004980' .
append gs_filter to gt_filter .
call method grid->set_table_for_first_display
exporting
i_structure_name = 'VBAK'
changing
it_outtab = itab
it_filter = gt_filter[].
endmodule. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module user_command_0100 input.
case sy-ucomm.
when 'BACK'.
leave to screen 0.
endcase.
endmodule. " USER_COMMAND_0100 INPUT