‎2008 Jan 22 9:58 AM
Hi all..
I got this table contain 5 field. All these fields are output in the ALV.
How can i hide default 2 field instead on screen load. Only display the neccessary 3 field out. But when the user click on the change layout button, he can choose whatever field to be display as he like.
How can i achieve it?
Thks
‎2008 Jan 22 10:08 AM
Hi,
You can do as below :
While building your fieldcatalog for all the fields, for that fields that should be in change layout for that fields you can use the code as gs_fieldcat-no_out = 'X'.
Thanks,
Sriram Ponna.
‎2008 Jan 22 10:01 AM
Hi,
use this logic.
data: variant type disvariant.
start-of-selection.
variant-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy_repid
it_fieldcat = ist_fcat[]
i_save = 'X'
is_variant = variant
TABLES
t_outtab = ist_main[]
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.
regards,
Santosh Thorat
‎2008 Jan 22 10:03 AM
‎2008 Jan 22 10:05 AM
Hi,
USe the following code
fill the defaule variant tab as below with required fields as below.
FORM check_fieldcat_variant_l.
DATA h_fieldcat_wa TYPE slis_fieldcat_alv.
DATA h_index LIKE sy-tabix.
h_index = 1.
DESCRIBE TABLE g_selfields_tab LINES sy-tabix.
IF sy-tabix IS INITIAL.
LOOP AT g_fieldcat_tab INTO h_fieldcat_wa.
CASE h_fieldcat_wa-fieldname.
WHEN 'PM_SELECTED'.
h_fieldcat_wa-no_out = space.
h_fieldcat_wa-col_pos = 1.
WHEN 'Z_RSLID'.
h_fieldcat_wa-no_out = space.
h_fieldcat_wa-col_pos = 2.
WHEN 'Z_FUNLC'.
h_fieldcat_wa-no_out = space.
h_fieldcat_wa-col_pos = 3.
WHEN 'Z_SMPDS'.
h_fieldcat_wa-no_out = space.
h_fieldcat_wa-col_pos = 4.
WHEN 'Z_SCHDT'.
h_fieldcat_wa-no_out = space.
h_fieldcat_wa-col_pos = 5.
WHEN 'Z_SCHTM'.
h_fieldcat_wa-no_out = space.
h_fieldcat_wa-col_pos = 6.
WHEN 'Z_ANLYT'.
h_fieldcat_wa-no_out = space.
h_fieldcat_wa-col_pos = 7.
WHEN OTHERS.
h_fieldcat_wa-no_out = g_x.
ENDCASE.
MODIFY g_fieldcat_tab FROM h_fieldcat_wa.
ENDLOOP.
ENDIF.
ENDFORM. " CHECK_FIELDCAT_VARIANT_L
and pass the that intrnal table in the following FM
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = g_alv_buffer
i_callback_program = g_repid
i_callback_pf_status_set = g_form_set_pf_stat
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
is_layout = g_layout
it_fieldcat = g_fieldcat_tab[]
it_excluding =
it_special_groups = g_fieldgroups_tab[]
it_sort = g_sortfields_tab[]
it_filter =
is_sel_hide =
i_default = g_n
i_save = g_variant_save
i_save = g_a
is_variant = g_variant
it_events = g_events_tab[]
it_event_exit = g_event_exit_tab[]
is_print = g_print
i_screen_start_column = g_screen_start_column
i_screen_start_line = g_screen_start_line
i_screen_end_column = g_screen_end_column
i_screen_end_line = g_screen_end_line
it_except_qinfo = gt_qinf
importing
e_exit_caused_by_caller =
TABLES
t_outtab = object_tab
t_outtab = it_display
EXCEPTIONS
program_error = 1
OTHERS = 2.
Reward points if useful
Thanks,
Nageswar
‎2008 Jan 22 10:08 AM
Hi,
You can do as below :
While building your fieldcatalog for all the fields, for that fields that should be in change layout for that fields you can use the code as gs_fieldcat-no_out = 'X'.
Thanks,
Sriram Ponna.
‎2008 Jan 22 10:11 AM
if i code gs_fieldcat-no_out = 'X', will it affect the user when he want to display that field when he click on the change layout button and choose that field to be shown. Will the field still be shown or not shown?
‎2008 Jan 22 10:18 AM
‎2008 Jan 22 10:19 AM
Hi,
Due to this code, I field will be in the change layout, once the report is displayed you can choose the other fields by selecting change layout, if yuo select those fields in the change layout, that fields will be displayed in the repoer.
Thanks,
Sriram Ponna.