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 INTO DATA(screen_wa).
IF screen_wa-group1 = 'MOD'.
IF flag = 'X'.
screen_wa-active = '1'.
ELSEIF flag = ' '.
screen_wa-active = '0'.
ENDIF.
MODIFY SCREEN FROM screen_wa.
ELSEIF screen_wa-name = 'TEXT_IN_FRAME'.
IF flag = 'X'.
screen_wa-active = '0'.
ELSEIF flag = ' '.
screen_wa-active = '1'.
ENDIF.
MODIFY SCREEN FROM screen_wa.
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.
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.
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.
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.
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.

Description

The static Next-Screen-Number of screen 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 screen 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 to the screen elements are set up in the callback routines as follows:

  • TEXT: Loading of the static context menu CONTEXT_MENU_1 without modification. This context menu has a line Cancel.
  • FRAME: Setup of the context menu from the static context menus. CONTEXT_MENU_2 und CONTEXT_MENU_1. This context menu has two lines Hide result and Cancel. The line for the function code HIDE is highlighted.
  • REVEAL: Creation of 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 to the function code REVEAL is highlighted.
  • INPUT: Setting up the context menu by incorporating the multiline local context menu CALCULATE_MENU as 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. At the integration into the context menu for INPUT, a text must be specified for the entry, after which the submenu is attached.

When executing the program and pressing the right (secondary) mouse button or SHIFT F10, the user receives 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 remaining screen components, the standard context menu appears with all static function codes and additionally F1 and F4.

When selecting a new dynamic function, calculations are carried out with the number in input field FIELD1 and then put to FIELD2. When selecting the function Hide result (HIDE), the screen is modified dynamically. Thereby, the fourth line is made visible making the context menu REVEAL accessible.

SAP 实例 3 Context Menus的更多相关文章

  1. Google Chrome插件开发-Context Menus

    本节主要介绍如何在Google Chrome浏览器web页面上点击右键弹出自定义菜单,即如何使用谷歌Context Menus API接口.上节已经把主要流程介绍了,这节就直接上代码,代码都是官方例子 ...

  2. Context Menus

    转载:http://open.chrome.360.cn/extension_dev/contextMenus.html 内容 清单 范例 API 参考: Chrome.contextMenus 方法 ...

  3. SAP 实例 8 HTML from the MIME Repository

    REPORT demo_html_from_mime. CLASS mime_demo DEFINITION. PUBLIC SECTION. CLASS-METHODS main. PRIVATE ...

  4. SAP 实例 4 CFW

    *&---------------------------------------------------------------------* *& Report demo_cfw ...

  5. [转] How to change font settings for all UI elements (toolbar and context menus, property editors, etc.)

    https://www.devexpress.com/Support/Center/Question/Details/S35762

  6. SAP 实例- 下拉框

    效果图 源代码 REPORT rsdemo_dropdown_listbox . DATA init. TABLES scarr. TABLES spfli. TABLES sflight. TABL ...

  7. SAP 实例- 页签tabsrip

    屏幕页签:项目上有一需求,对标准TCODE 一个屏幕增加一个页签.于是做了个例子. 下面屏幕有两个页签. 我们来看一下屏幕结构.100屏幕是主屏幕,101,102是子屏幕,对应页签test1,test ...

  8. SAP 实例 13 Random Grouping with LOOP

    REPORT demo_loop_group_by_random. CLASS demo DEFINITION. PUBLIC SECTION. CLASS-METHODS: main, class_ ...

  9. SAP 实例 12 List Box with Value List from PBO Module

    REPORT demo_dynpro_dropdown_listbox. DATA: name TYPE vrm_id, list TYPE vrm_values, value LIKE LINE O ...

随机推荐

  1. Educational Codeforces Round 116 (Rated for Div. 2), problem: (C) Banknotes

    传送门 Problem - C - Codeforces 题目 题目重点内容手打翻译:(欢迎批评指正) 在柏林, 使用着n套不同的货币(banknotes).第i个货币面额为10ai 元,货币的第一种 ...

  2. 【LeetCode】24.两两交换链表中的节点

    24.两两交换链表中的节点 知识点:链表 题目描述 给你一个链表,两两交换其中相邻的节点,并返回交换后链表的头节点.你必须在不修改节点内部的值的情况下完成本题(即,只能进行节点交换). 示例 示例 1 ...

  3. SMTP协议解读以及如何使用SMTP协议发送电子邮件

    电子邮件协议中POP3协议用于接收邮件,SMTP协议用于发送邮件.SMTP的全称为Simple Mail Transfer Protocol,也就是简单邮件传输协议,字如其名.   相较于POP3而言 ...

  4. pgpool-II 4.3 中文手册 - 入门教程

    本章解释了如何开始使用 Pgpool-II. 安装 在本节中,我们假设您已经安装了 Pgpool-II 与 PostgreSQL 集群. 你的第一个复制(Replication) 在本节中,我们将解释 ...

  5. 清除安装的Rancher、K8s

    #清除主机的所有容器.挂载.镜像(慎用) docker stop $(docker ps -aq) docker system prune -f docker volume rm $(docker v ...

  6. GO 前后端分离开源后台管理系统 Gfast v2.0.4 版发布

    更新内容:1.适配插件商城,开发环境从后台直接安装插件功能:2.代码生成细节修复及功能完善(支持生成上传文件.图片及富文本编辑器功能):3.增加swagger接口文档生成:4.更新goframe版本至 ...

  7. 【论文阅读】ConvNeXt:A ConvNet for the 2020s 新时代卷积网络

    一.ConvNext Highlight 核心宗旨:基于ResNet-50的结构,参考Swin-Transformer的思想进行现代化改造,知道卷机模型超过trans-based方法的SOTA效果. ...

  8. 快速了解Spring,简明Spring使用流程

    前言: 注意题目,这篇文章说的是操作,也就是重在应用,更多的是一个入门的或者说一篇概览,所以大佬们多多担待,不涉及底层分析和很多的源码,所以如果看官想看以上两者的可以划走了,有时间又不懒的话,可能以后 ...

  9. 简述Web3.0

    什么是 Web 3.0 以及为什么要关心它. 为了更好地理解什么是 Web 3.0,我们需要知道什么是 Web 1.0 和 2.0. 为了不让你厌烦,这里简单的解释一下: Web 1.0 -- 信息仅 ...

  10. 评估海外pop点网络质量,批量探测到整个国家运营商ip地址段时延

    1 查询当地供应商所有AS号和IP地址段,如下 可以手动复制也可以爬下来,此次测试地址不多,手动复制下来再做下格式话 61.99.128.0/17 61.99.0.0/16 61.98.96.0/20 ...