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

Class for LOAD_GUI_STATUS

Sultanuddin
Explorer
0 Likes
938

Hi all...

Please anybody tell me,

What is the class for method LOAD_GUI_STATUS in context menu.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
646

<b>CL_CTMENU is the class for method LOAD_GUI_STATUS</b>

<b>CONTEXT MENU</b>

Context menu can be used in relation with the various screen elements like I/O fields, subscreen,group box,table control but not with push buttons,radio,check buttons.

It can be used to show related options when the user right clicks on the screen elements. It is a type of status. SAP automatically creates a default context menu for dialog statuses consisting of all the function codes available.

We can create a context menu statically using the menu painter(SE41)or dynamically by using the methods of the <b>global class CL_CTMENU</b>.

All context menus are objects of this global class.

<b> There are number of methods which can be used to create and modify context menu dynamically . These are:</b>

LOAD_GUI_STATUS

This method is used to load a static context menu already defined using

menu painter.The exporting parameters are PROGRAM ,STATUS and MENU. Where MENU indicates the menu to which the context menu will be attached .

ADD_FUNCTION

This method adds a function code to the menu ,The exporting parameters are FCODE and TEXT. These are used to specify the function code and the corresponding text in the men.

ADD_MENU

This method adds a context menu to another one.

ADD_SEPARATOR

This method adds a separator line.

ADD_SUBMENU

This method adds a menu to another one as a sub menu the exporting parameters are MENU and the TEXT that will be displayed.

HIDE_FUNCTIONS

SHOW_FUNCTIONS

DISABLE_FUNCTIONS

ENABLE_FUNCTIONS

<b>These functions are used to modify the context menu by hiding,enabling etc them.</b>

SET_DEFAULT_FUNCTION

This method will mark a particular menu item as the default one ,the corresponding function code is passed as an exporting parameter.

The context menu should be linked to the screen element in the screen painte(SE51) by specifying an ID which is known as CONTEXT in the context menu field.

We can specify the same context for different screen elements or different context for different elements.

For each context specified in the screen painter a special call back subroutine is used in the abap program. the syntax of this special routine is:

FORM ON_CTLMENU_context USING menu TYPE REF TO CL_CTMENU

...

ENDFORM

This subroutine can be used to modify or load or create a context menu at runtime when the user right clicks the screen element.

In the above subroutine the context is the context assigned to the screen element and menu is the menu object that was passed to this call back routine which is initially blank, we have to use methods of the class as stated above to create a working menu or load an existing static context menu previously build in the menu painter.

<b>e.g. To load an existing context menu</b>

FORM on_ctmenu_text USING menu TYPE REF TO cl_ctmenu.

CALL METHOD menu->load_gui_status

EXPORTING program = prog

status = 'CON_MENU'

menu = menu .

CALL METHOD menu->set_default_function

EXPORTING fcode = 'list'.

ENDFORM.

e.g. CREATING A NEW CONTEXT MENU DYNAMICALLY.

FORM on_ctmenu_text USING menu TYPE REF TO cl_ctmenu.

DATA new_menu TYPE REF TO cl_ctmenu.

CREATE OBJECT new_menu.

CALL METHOD new_menu->add_function

EXPORTING fcode = 'list'

text = text-001.

CALL METHOD new_menu->add_function

EXPORTING fcode = 'add'

text = text-002. CALL METHOD new_menu->add_function

EXPORTING fcode = 'delete'

text = text-003.

CALL METHOD new_menu->add_submenu

EXPORTING menu = new_menu

text = text-005.

ENDFORM.

2 REPLIES 2
Read only

Former Member
0 Likes
646

Hi,

Class for LOAD_GUI_STATUS is CL_CTMENU .

Regards,

Asha

Read only

Former Member
0 Likes
647

<b>CL_CTMENU is the class for method LOAD_GUI_STATUS</b>

<b>CONTEXT MENU</b>

Context menu can be used in relation with the various screen elements like I/O fields, subscreen,group box,table control but not with push buttons,radio,check buttons.

It can be used to show related options when the user right clicks on the screen elements. It is a type of status. SAP automatically creates a default context menu for dialog statuses consisting of all the function codes available.

We can create a context menu statically using the menu painter(SE41)or dynamically by using the methods of the <b>global class CL_CTMENU</b>.

All context menus are objects of this global class.

<b> There are number of methods which can be used to create and modify context menu dynamically . These are:</b>

LOAD_GUI_STATUS

This method is used to load a static context menu already defined using

menu painter.The exporting parameters are PROGRAM ,STATUS and MENU. Where MENU indicates the menu to which the context menu will be attached .

ADD_FUNCTION

This method adds a function code to the menu ,The exporting parameters are FCODE and TEXT. These are used to specify the function code and the corresponding text in the men.

ADD_MENU

This method adds a context menu to another one.

ADD_SEPARATOR

This method adds a separator line.

ADD_SUBMENU

This method adds a menu to another one as a sub menu the exporting parameters are MENU and the TEXT that will be displayed.

HIDE_FUNCTIONS

SHOW_FUNCTIONS

DISABLE_FUNCTIONS

ENABLE_FUNCTIONS

<b>These functions are used to modify the context menu by hiding,enabling etc them.</b>

SET_DEFAULT_FUNCTION

This method will mark a particular menu item as the default one ,the corresponding function code is passed as an exporting parameter.

The context menu should be linked to the screen element in the screen painte(SE51) by specifying an ID which is known as CONTEXT in the context menu field.

We can specify the same context for different screen elements or different context for different elements.

For each context specified in the screen painter a special call back subroutine is used in the abap program. the syntax of this special routine is:

FORM ON_CTLMENU_context USING menu TYPE REF TO CL_CTMENU

...

ENDFORM

This subroutine can be used to modify or load or create a context menu at runtime when the user right clicks the screen element.

In the above subroutine the context is the context assigned to the screen element and menu is the menu object that was passed to this call back routine which is initially blank, we have to use methods of the class as stated above to create a working menu or load an existing static context menu previously build in the menu painter.

<b>e.g. To load an existing context menu</b>

FORM on_ctmenu_text USING menu TYPE REF TO cl_ctmenu.

CALL METHOD menu->load_gui_status

EXPORTING program = prog

status = 'CON_MENU'

menu = menu .

CALL METHOD menu->set_default_function

EXPORTING fcode = 'list'.

ENDFORM.

e.g. CREATING A NEW CONTEXT MENU DYNAMICALLY.

FORM on_ctmenu_text USING menu TYPE REF TO cl_ctmenu.

DATA new_menu TYPE REF TO cl_ctmenu.

CREATE OBJECT new_menu.

CALL METHOD new_menu->add_function

EXPORTING fcode = 'list'

text = text-001.

CALL METHOD new_menu->add_function

EXPORTING fcode = 'add'

text = text-002. CALL METHOD new_menu->add_function

EXPORTING fcode = 'delete'

text = text-003.

CALL METHOD new_menu->add_submenu

EXPORTING menu = new_menu

text = text-005.

ENDFORM.