Application Development 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: 

REUSE_ALV_GRID_DISPLAY & context menu

luis_lopez_gomez
Explorer
0 Kudos
571

Hi SAP guys,....

Any help about how to manage context menus with FM REUSE_ALV_GRID_DISPLAY ? I would like to add new entries into the context menu. I have review all entries into the forum but I haven't find any solution.

Thanks in advance,

Luis López

1 ACCEPTED SOLUTION

Former Member
0 Kudos
191

Hi,

Look at the below DEMO Porgram

<b>demo_dynpro_context_menu

demo_list_context_menu</b>

Regards

Sudheer

4 REPLIES 4

Former Member
0 Kudos
191

Hi,

To create a context menu follow this: See also report BCALV_GRID_06 in development class SLIS .

Defining a Context Menu

Use

The ALV Grid Control uses the context menu and assigns standard functions to it. Depending on the context, you can add self-defined functions to this menu and hide or disable preset functions.

Integration

The context menu is an instance of class CL_CTMENU . If event CONTEXT_MENU_REQUEST is triggered by the user, event parameter E_OBJECT contains a reference to the standard context menu.

Features

You can change this menu as follows:

To add an option to the menu, call method add_function :

CALL METHOD E_OBJECT->ADD_FUNCTION

EXPORTING FCODE = 'DELE'

TEXT = TEXT-003. "Delete

To disable existing functions (and gray them out), you pass all corresponding function codes of method disable_functions in a table:

DATA: LT_FCODES TYPE UI_FUNCTIONS,

CLEAR LT_FCODES.

APPEND CL_GUI_ALV_GRID=>MC_FC_COL_OPTIMIZE TO LT_FCODES.

APPEND CL_GUI_ALV_GRID=>MC_FC_HELP TO LT_FCODES.

CALL METHOD E_OBJECT->DISABLE_FUNCTIONS

EXPORTING FCODES = LT_FCODES.

Jogdand M B

Jogdand M B

0 Kudos
191

Hi Jogdand:

Thanks for your answer but I don't know how to implement your solution. I checked BCAL_GRID_06 but it is using OO programing not the FM REUSE_.....

When I code the Call method E_OBJECT->ADD_FUNCTION, I get a sintax error (field e_object->add_function is unknow). I think that I can not triger the event CONTEXT_MENU_REQUEST. It is none of the events returned by the FM REUSE_ALV_EVENTS_GET.

A short example will be really very nice.

Thanks in advance,

Luis

0 Kudos
191

Hi

Go through this link it will solve your problem

http://www.erpgenie.com/sap/abap/controls/alvgrid.htm

Reward for all helpfull answers

Regards

Pavan

Former Member
0 Kudos
192

Hi,

Look at the below DEMO Porgram

<b>demo_dynpro_context_menu

demo_list_context_menu</b>

Regards

Sudheer