‎2007 Jan 19 8:51 AM
hai frnd's,
Can anybody explain me what is context menu in GUI_Status? and also sample program.
Regards and Thanks
Suganya
‎2007 Jan 19 8:57 AM
Hi Suganya
The user interface of a screen is defined by a GUI status which you define in the
Menu Painter and assign the type Dialog status. For each dialog status, the system automatically creates a standard context menu, which the user can display by clicking the righthand mouse button on the screen (or choosing Shift+F10). The standard context menu contains all of the function keys to which functions are assigned. It therefore makes it easy to access any function code that is available using the keyboard, since normally only the most important are
assigned to the application toolbar.
However, as well as the standard context menu, you can define context-specific menus for any of the following screen elements:
Input/output fields
Text fields
Table controls
Group boxes
Subscreens
When you select one of these elements using the right-hand mouse button, you can create a dynamic context menu in the ABAP program. This may contain any functions, and is not restricted to function keys. You cannot assign context menus to pushbuttons, checkboxes, or radio buttons. However, you can assign unique function codes to them instead.
Sample Program:
REPORT demo_dynpro_context_menu.
DATA: field1 TYPE i VALUE 10,
field2 TYPE p DECIMALS 4.
DATA: prog TYPE sy-repid,
flag(1) TYPE c VALUE 'X'.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
prog = sy-repid.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET TITLEBAR 'TIT100'.
IF flag = 'X'.
SET PF-STATUS 'SCREEN_100' EXCLUDING 'REVEAL'.
ELSEIF flag = ' '.
SET PF-STATUS 'SCREEN_100' EXCLUDING 'HIDE'.
ENDIF.
LOOP AT SCREEN.
IF screen-group1 = 'MOD'.
IF flag = 'X'.
screen-active = '1'.
ELSEIF flag = ' '.
screen-active = '0'.
ENDIF.
MODIFY SCREEN.
ELSEIF screen-name = 'TEXT_IN_FRAME'.
IF flag = 'X'.
screen-active = '0'.
ELSEIF flag = ' '.
screen-active = '1'.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE user_command_0100.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'HIDE'.
flag = ' '.
WHEN 'REVEAL'.
flag = 'X'.
WHEN 'SQUARE'.
field2 = field1 ** 2.
WHEN 'CUBE'.
field2 = field1 ** 3.
WHEN 'SQUAREROOT'.
field2 = field1 ** ( 1 / 2 ).
WHEN 'CUBICROOT'.
field2 = field1 ** ( 1 / 3 ).
ENDCASE.
ENDMODULE.
*******************************************************
Callback-Routines
*******************************************************
FORM on_ctmenu_text USING l_menu TYPE REF TO cl_ctmenu.
CALL METHOD:l_menu->load_gui_status
EXPORTING program = prog
status = 'CONTEXT_MENU_1'
menu = l_menu.
ENDFORM.
FORM on_ctmenu_frame USING l_menu TYPE REF TO cl_ctmenu.
CALL METHOD:l_menu->load_gui_status
EXPORTING program = prog
status = 'CONTEXT_MENU_2'
menu = l_menu,
l_menu->load_gui_status
EXPORTING program = prog
status = 'CONTEXT_MENU_1'
menu = l_menu,
l_menu->set_default_function
EXPORTING fcode = 'HIDE'.
ENDFORM.
FORM on_ctmenu_reveal USING l_menu TYPE REF TO cl_ctmenu.
CALL METHOD:l_menu->load_gui_status
EXPORTING program = prog
status = 'CONTEXT_MENU_3'
menu = l_menu,
l_menu->load_gui_status
EXPORTING program = prog
status = 'CONTEXT_MENU_1'
menu = l_menu,
l_menu->set_default_function
EXPORTING fcode = 'REVEAL'.
ENDFORM.
FORM on_ctmenu_input USING l_menu TYPE REF TO cl_ctmenu.
DATA calculate_menu TYPE REF TO cl_ctmenu.
CREATE OBJECT calculate_menu.
CALL METHOD: calculate_menu->add_function
EXPORTING fcode = 'SQUARE'
text = text-001,
calculate_menu->add_function
EXPORTING fcode = 'CUBE'
text = text-002,
calculate_menu->add_function
EXPORTING fcode = 'SQUAREROOT'
text = text-003,
calculate_menu->add_function
EXPORTING fcode = 'CUBICROOT'
text = text-004,
l_menu->add_submenu
EXPORTING menu = calculate_menu
text = text-005.
ENDFORM.
PLZ REWARD POINTS IF HELPFUL
‎2007 Jan 19 8:57 AM
Hi Suganya
The user interface of a screen is defined by a GUI status which you define in the
Menu Painter and assign the type Dialog status. For each dialog status, the system automatically creates a standard context menu, which the user can display by clicking the righthand mouse button on the screen (or choosing Shift+F10). The standard context menu contains all of the function keys to which functions are assigned. It therefore makes it easy to access any function code that is available using the keyboard, since normally only the most important are
assigned to the application toolbar.
However, as well as the standard context menu, you can define context-specific menus for any of the following screen elements:
Input/output fields
Text fields
Table controls
Group boxes
Subscreens
When you select one of these elements using the right-hand mouse button, you can create a dynamic context menu in the ABAP program. This may contain any functions, and is not restricted to function keys. You cannot assign context menus to pushbuttons, checkboxes, or radio buttons. However, you can assign unique function codes to them instead.
Sample Program:
REPORT demo_dynpro_context_menu.
DATA: field1 TYPE i VALUE 10,
field2 TYPE p DECIMALS 4.
DATA: prog TYPE sy-repid,
flag(1) TYPE c VALUE 'X'.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
prog = sy-repid.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET TITLEBAR 'TIT100'.
IF flag = 'X'.
SET PF-STATUS 'SCREEN_100' EXCLUDING 'REVEAL'.
ELSEIF flag = ' '.
SET PF-STATUS 'SCREEN_100' EXCLUDING 'HIDE'.
ENDIF.
LOOP AT SCREEN.
IF screen-group1 = 'MOD'.
IF flag = 'X'.
screen-active = '1'.
ELSEIF flag = ' '.
screen-active = '0'.
ENDIF.
MODIFY SCREEN.
ELSEIF screen-name = 'TEXT_IN_FRAME'.
IF flag = 'X'.
screen-active = '0'.
ELSEIF flag = ' '.
screen-active = '1'.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE user_command_0100.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'HIDE'.
flag = ' '.
WHEN 'REVEAL'.
flag = 'X'.
WHEN 'SQUARE'.
field2 = field1 ** 2.
WHEN 'CUBE'.
field2 = field1 ** 3.
WHEN 'SQUAREROOT'.
field2 = field1 ** ( 1 / 2 ).
WHEN 'CUBICROOT'.
field2 = field1 ** ( 1 / 3 ).
ENDCASE.
ENDMODULE.
*******************************************************
Callback-Routines
*******************************************************
FORM on_ctmenu_text USING l_menu TYPE REF TO cl_ctmenu.
CALL METHOD:l_menu->load_gui_status
EXPORTING program = prog
status = 'CONTEXT_MENU_1'
menu = l_menu.
ENDFORM.
FORM on_ctmenu_frame USING l_menu TYPE REF TO cl_ctmenu.
CALL METHOD:l_menu->load_gui_status
EXPORTING program = prog
status = 'CONTEXT_MENU_2'
menu = l_menu,
l_menu->load_gui_status
EXPORTING program = prog
status = 'CONTEXT_MENU_1'
menu = l_menu,
l_menu->set_default_function
EXPORTING fcode = 'HIDE'.
ENDFORM.
FORM on_ctmenu_reveal USING l_menu TYPE REF TO cl_ctmenu.
CALL METHOD:l_menu->load_gui_status
EXPORTING program = prog
status = 'CONTEXT_MENU_3'
menu = l_menu,
l_menu->load_gui_status
EXPORTING program = prog
status = 'CONTEXT_MENU_1'
menu = l_menu,
l_menu->set_default_function
EXPORTING fcode = 'REVEAL'.
ENDFORM.
FORM on_ctmenu_input USING l_menu TYPE REF TO cl_ctmenu.
DATA calculate_menu TYPE REF TO cl_ctmenu.
CREATE OBJECT calculate_menu.
CALL METHOD: calculate_menu->add_function
EXPORTING fcode = 'SQUARE'
text = text-001,
calculate_menu->add_function
EXPORTING fcode = 'CUBE'
text = text-002,
calculate_menu->add_function
EXPORTING fcode = 'SQUAREROOT'
text = text-003,
calculate_menu->add_function
EXPORTING fcode = 'CUBICROOT'
text = text-004,
l_menu->add_submenu
EXPORTING menu = calculate_menu
text = text-005.
ENDFORM.
PLZ REWARD POINTS IF HELPFUL
‎2007 Jan 19 8:58 AM
Context Menus
For Example
Look at demo_dynpro_context_menu Program
Check
http://help.sap.com/saphelp_erp2005vp/helpdata/en/94/c4a6377cc0c92ce10000009b38f8cf/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/d1/801d43454211d189710000e8322d00/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/e2/5d3bb2e06411d295a900a0c94260a5/frameset.htm
‎2007 Jan 19 9:00 AM
Hi Suganya,
When u right click mouse on a screen menu options will come . That is context menu.
For Demo purpose check this prog.
<b>DEMO_DYNPRO_CONTEXT_MENU</b>
Regards,
Balavardhan.K