SAP 实例 3 Context Menus
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的更多相关文章
- Google Chrome插件开发-Context Menus
本节主要介绍如何在Google Chrome浏览器web页面上点击右键弹出自定义菜单,即如何使用谷歌Context Menus API接口.上节已经把主要流程介绍了,这节就直接上代码,代码都是官方例子 ...
- Context Menus
转载:http://open.chrome.360.cn/extension_dev/contextMenus.html 内容 清单 范例 API 参考: Chrome.contextMenus 方法 ...
- SAP 实例 8 HTML from the MIME Repository
REPORT demo_html_from_mime. CLASS mime_demo DEFINITION. PUBLIC SECTION. CLASS-METHODS main. PRIVATE ...
- SAP 实例 4 CFW
*&---------------------------------------------------------------------* *& Report demo_cfw ...
- [转] 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
- SAP 实例- 下拉框
效果图 源代码 REPORT rsdemo_dropdown_listbox . DATA init. TABLES scarr. TABLES spfli. TABLES sflight. TABL ...
- SAP 实例- 页签tabsrip
屏幕页签:项目上有一需求,对标准TCODE 一个屏幕增加一个页签.于是做了个例子. 下面屏幕有两个页签. 我们来看一下屏幕结构.100屏幕是主屏幕,101,102是子屏幕,对应页签test1,test ...
- SAP 实例 13 Random Grouping with LOOP
REPORT demo_loop_group_by_random. CLASS demo DEFINITION. PUBLIC SECTION. CLASS-METHODS: main, class_ ...
- 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 ...
随机推荐
- zookeeper面试1-9
1.选举机制 SID:服务器ID.用来唯一标识一台ZooKeeper集群中的机器,每台机器不能重复,和myid一致. ZXID:事务ID.ZXID是一个事务ID,用来标识一次服务器状态的变更.在某一时 ...
- 6.Docker容器底层实现了解与安全机制
原文地址: 点击直达 0x00 底层实现 我们以 Docker 基础架构来探究Docke底层的核心技术,简单的包括: Linux 上的命名空间(Namespaces) 控制组(Control grou ...
- 都2022年了,HDFS为何还如此能战!
摘要:HDFS也许不是最好的大数据存储技术,但依然是最重要的大数据存储技术. 本文分享自华为云社区<HDFS为何在大数据领域经久不衰?>,作者: JavaEdge. 1.概述 1.1 简介 ...
- Py点亮
- Java学习day30
线程分为用户线程和守护线程,虚拟机必须确保用户线程执行完毕,虚拟机不用等待守护线程执完毕 并发:同一个对象被多个线程同时操作,例如上万了同时抢100张票,手机银行和柜台同时取同一张卡里的钱 处理多线程 ...
- VScode链接服务器并配置公钥-SSH Keys
VScode链接服务器并配置公钥-SSH Keys 一直在用Xshell做SSH连接服务器与虚拟机,但是中文乱码的问题一直找不到解决方案,干脆使用编辑器自带的插件,集成之后用起来也方便 1.概述 做法 ...
- 小米手机简单 ROOT教程(百分百成功)
大家都知道啊,由于小米自带的换机软件不支持一些应用数据的还原,所以需要使用钛备份来还原应用和数据.但是钛备份需要root才能用,因为有些机器刚出没多久,第三方的recovery也没有,所以需要找到一种 ...
- Django/SQL server 配置实现(附下载安装)
连接方案1: conn = pymssql.connect(host='127.0.0.1', port=1433, user='sa', password='password', database= ...
- 面试突击44:volatile 有什么用?
volatile 是 Java 并发编程的重要组成部分,也是常见的面试题之一,它的主要作用有两个:保证内存的可见性和禁止指令重排序.下面我们具体来看这两个功能. 内存可见性 说到内存可见性问题就不得不 ...
- 手脱PESpin壳【06.exe】
1.查壳 2.LoradPE工具检查 一方面可以用LoradPE工具查看重定位,另一方面也可获取一些详细信息 3.查找OEP ①未发现pushad 开始未发现pushad,进行单步步入,很快就能找到p ...