SAP DYNPRO CONTEXT MENU ABEXA



Get Example source ABAP code based on a different SAP table
  



ABAP_DYNPRO - Context Menus
The example illustrates how context menus can be integrated into a program.

ABAP_SOURCE_CODE
ABAP_EXEC

ABAP_DESCRIPTION
The static next dynpro number of dynpro 100 is 100. The elements TEXT2 and FIELD2 do not have their own context menus. They inherit the context menu FRAME of the frame. The modification group MOD is assigned to them. The dynpro flow logic is: PROCESS BEFORE OUTPUT.
MODULE status_0100.
PROCESS AFTER INPUT.
MODULE cancel AT EXIT-COMMAND.
MODULE user_command_0100.
The GUI status SCREEN_100 is set to PBO statically, in which, depending on the field flag, the function codes HIDE or REVEAL are hidden. The context menus for the screen elements are constructed in the callback routines as follows:
TEXT: Loads the static context menu CONTEXT_MENU_1 without modification. This context menu has a single line, Cancel .
FRAME: Constructs the context menu from the static context menus CONTEXT_MENU_2 and CONTEXT_MENU_1. This context menu has two lines, Hide Result and Cancel. The line for the function code HIDE is highlighted.
REVEAL: Constructs the context menus from the static context menus CONTEXT_MENU_3 and CONTEXT_MENU_1. This context menu has two lines, Display Result and Cancel. The line of the function code REVEAL is highlighted.
INPUT: Constructs the context menu by including the multiline local context menu CALCULATE_MENU as a submenu. For the latter, a local reference variable with reference to CL_CTMENU is created, an object is created, and the new function codes SQUARE, CUBE , SQUAREROOT, and CUBICROOT are added. When included in the context menu for INPUT, a text must be specified for the entry, after which the submenu is attached.
When the program is executed and the right mouse button or SHIFT+F10 is pressed, the user sees the context menu TEXT in the first line, the context menu INPUT in the second line, and the context menu FRAME in the third line. The fourth line is hidden after program start. On all other dynpro components, the standard context menu appears with all static function codes and F1 and F4.
When a new dynamic function is selected, calculations are performed with the number in the input field FIELD1 and then passed to FIELD2. When the function Hide Result (HIDE) is selected, the screen is modified dynamically. This makes the fourth line visible and the context menu REVEAL can be used.