Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ALV

Former Member
0 Likes
1,000

How to deactivate any one of the fields in the context menu of the ALV grid list o/p ?

suppose if i need to deactivate the menu buttons like ascending button and descending button how can i do that?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
970

Hi Sriram,

Write this code before calling the method 'set_table_for_first_display'.

If it is useful then please reward points.

DATA ls_exclude TYPE ui_func.

DATA gt_exclude TYPE ui_functions.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_print.

APPEND ls_exclude TO gt_exclude.

regards ,

Rajesh.

How to deactivate any one of the fields in the context menu of the ALV grid list o/p ?

suppose if i need to deactivate the menu buttons like ascending button and descending button how can i do that?

7 REPLIES 7
Read only

Former Member
0 Likes
970

Hi,

you can use following codes:

CALL METHOD <menu_NAME>->hide_functions

EXPORTING

fcodes = fcode

.

CALL METHOD <menu_NAME>->disable_functions

EXPORTING

fcodes = fcode

.

where fcode is function code which you wnat to hide/disable.

Award helpful answres.

Jogdand M B

Read only

Former Member
0 Likes
970

U need to copy the UI of the standard and then deactivate it.

To copy the standard UI :-

1. Go to SE41

2. Give ur program name

3. Status : give SAPLSALV

4. Select the Button COpy User INterface from the application tool bar

5. Copy to ur satus

6. Deactivate those buttons or codes which u don't need it.

Please award all helpful answers.

Regards,

Deepu.K

Read only

Former Member
0 Likes
971

Hi Sriram,

Write this code before calling the method 'set_table_for_first_display'.

If it is useful then please reward points.

DATA ls_exclude TYPE ui_func.

DATA gt_exclude TYPE ui_functions.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.

APPEND ls_exclude TO gt_exclude.

ls_exclude = cl_gui_alv_grid=>mc_fc_print.

APPEND ls_exclude TO gt_exclude.

regards ,

Rajesh.

Read only

Former Member
0 Likes
970

If you are using OO ALV, you can use the following code.

*--Exclude structure

DATA: it_exclude TYPE ui_functions,

is_exclude TYPE ui_func.

is_exclude = cl_gui_alv_grid=>mc_mb_export.( name of the button which you want to deactivate)

APPEND is_exclude TO it_exclude.

and pass the it_exclude to the method 'set table for first table', in the it_toolbar_excluding.

CALL METHOD g_grid1->set_table_for_first_display

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

  • I_STRUCTURE_NAME =

  • IS_VARIANT =

i_save = 'A'

i_default = ' '

is_layout = gs_layout

is_print = wa_print

  • IT_SPECIAL_GROUPS =

it_toolbar_excluding = it_exclude[]

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

it_outtab = i_output

it_fieldcatalog = tb_fieldcatalog[]

  • IT_SORT =

  • IT_FILTER =

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4

Read only

Former Member
0 Likes
970

If it's a OO ALV, you can populate the parameter 'it_toolbar_excluding =' of alv_grid->set_table_for_first_display.

DATA : ls_exclude TYPE ui_func.

ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo. " choose the button to exclude

APPEND ls_exclude TO lt_toolbar_excluding .

alv_grid->set_table_for_first_display

EXPORTING

it_toolbar_excluding = lt_toolbar_excluding .

Read only

Former Member
0 Likes
970

Hi..,

Execute this sample program....

<b>this program eliminates the Sort descending order and Sort ascending order from Menu list and also from the Application toolbar.</b>

tables spfli.

type-pools: slis.

DATA W_FCODE TYPE SLIS_EXTAB-FCODE.

data: t_spfli TYPE SPFLI OCCURS 0 WITH HEADER LINE.

select * from spfli into table t_spfli.

data : t_excluding TYPE SLIS_T_EXTAB .

W_fcode = '&OUP'.

append w_fcode to t_excluding.

W_fcode = '&ODN'.

append w_fcode to t_excluding.

call function 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_STRUCTURE_NAME = 'SPFLI'

  • IS_LAYOUT =

  • IT_FIELDCAT =

IT_EXCLUDING = T_EXCLUDING

tables

t_outtab = T_SPFLI

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.

plz do remember to close the thread, when ur problem is solved and reward all helpful answers!!!

reward if it helps u...

sai ramesh

Read only

Former Member
0 Likes
970

hello sriram,

Step 1.

Create pf_status. It is recommend that you copy standard status'STANDARD' from function group SALV and modify it according to your requirement.

i.e. in application toolbar remove the items which are not required.

Step 2.

Create a form.

E.g.

FORM set_pf_status USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'ZPFSTATUS'.

"Copy of 'STANDARD' pf_status from fgroup SALV

ENDFORM.

Step 3.

In function REUSE_ALV_GRID_DISPLAY and REUSE_ALV_LIST_DISPLAY there is one export parameter i_callback_pf_status_set pass the form set_pf_status to it.

e.g.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_pf_status_set = 'SET_PF_STATUS'

Regards,

Neelambari.