[Dialog屏幕开发] 设置GUI Status 菜单/GUI Title 标题

使用事务码SE38创建程序,自定义程序名称,填写标题,类型选择"M模块池"

点击"保存"按钮,填写相关的包信息,生成ZDIALOG_GZ437程序

点击显示对象列表按钮,鼠标右键刚创建的对象名称ZDIALOG_GZ437,创建屏幕

填写屏幕编号9001

填写9001屏幕的简短描述以及Dynpro类型

保存并激活, 在右侧的对象列表可看到已经生成的屏幕9001

由于主程序不是可执行程序,不能被直接执行,必须通过事务代码指定界面进行执行,所以鼠标右键刚创建的对象名称ZDIALOG_GZ437,创建事务代码

填写事务代码,短文本以及勾选启动对象"程序和dynpro(对话框事务)"

填写程序,屏幕编号以及勾选GUI支持相关信息

点击保存按钮,事务代码ZDIALOG_GZ437成功生效

完成上述操作以后,激活ZDIALOG_GZ437程序,生成的页面如下所示

从上述页面可以看到缺少了相关的保存和回退的按钮以及页面标题 

鼠标右键刚创建的对象名称ZDIALOG_GZ437,创建GUI状态

填写"状态"以及"短文本"的相关信息 

填写相应功能键的功能代码 

每个功能键的功能类型如下所示 

保存并激活, 在右侧的对象列表可看到已经生成的GUI状态9001_STATUS

鼠标右键刚创建的对象名称ZDIALOG_GZ437,创建GUI标题

填写"标题代码"和"标题"相关信息 

点击按钮,在右侧的对象列表可看到已经生成的GUI标题9001_TITLE

屏幕9001绑定GUI状态9001_STATUS与GUI标题9001_TITLE

新建INCLUDE程序ZDIALOG_GZ437_O01

在主程序ZDIALOG_GZ437中,我们可以看到自动生成了ZDIALOG_GZ437_O01的INCLUDE文件 

在该PBO模块中的STATUS_9001编写相关代码,使用SET PF-STATUS语句设置按钮,SET TITLEBAR语句设置标题

保存并激活主程序以后,生成的页面如下所示

接下来我们将上述页面的GUI STATUS进行按钮响应设置

新建INCLUDE程序ZDIALOG_GZ437_I01

在主程序ZDIALOG_GZ437中,我们可以看到自动生成了ZDIALOG_GZ437_I01的INCLUDE文件 

在对应屏幕9001的"元素清单"页签定义OK_CODE按钮接收变量

在主程序ZDIALOG_GZ437中,创建INCLUDE文件ZDIALOG_GZ437_TOP,用于声明模块池中所有模块都可使用的数据

屏幕元素清单填写的变量需要与程序中定义的变量保持一致(同名传递),便于屏幕与程序进行交互 

在该PAI模块中的USER_COMMAND_9001编写相关代码,创建子例程

双击该子例程,新建INCLUDE文件ZDIALOG_GZ437_F01

在主程序ZDIALOG_GZ437中,我们可以看到自动生成了ZDIALOG_GZ437_F01的INCLUDE文件,用于子例程定义

在子例程frm_user_command_9001编写返回按钮的相关代码

保存并激活主程序,返回按钮绑定生效

接下来我们需要将退出按钮和取消按钮绑定生效

在该PAI模块中的EXIT_COMMAND编写相关代码

保存并激活主程序,退出按钮和取消按钮绑定生效


补充扩展知识

① Screen屏幕界面介绍

属性(Attributes):设定Screen屏幕界面的基本属性,包括简短描述、Dynpro类型、界面大小等信息

元素清单(Element List):定义OK_CODE、编辑元素属性、包含Screen屏幕界面定义的所有构成元素(位置及属性)

在 Screen Layout Designer 和 Element List元素清单中定义界面中的元素(位置及属性)

流逻辑(Flow Logic):设定在Screen显示的逻辑处理和显示后对界面进行相应操作的逻辑处理

② Module执行顺序

流逻辑(Flow Logic):用于进行代码定义

用户访问Screen屏幕界面,对屏幕界面进行操作,相应的操作是通过流逻辑进行控制的,也就是Screen中定义Flow Logic 的位置

PBO模块(PBO Modules):屏幕输出前调用的模块

PROCESS BEFORE OUTPUT:PBO 中的处理逻辑控制Screen屏幕界面输出前的处理,如更改一些元素的值或属性

PAI模块(PAI Modules):相应用户输入而调用的模块

PROCESS AFTER INPUT:PAI 中的处理逻辑控制用户对Screen屏幕界面操作后的处理,如按回车键对输入数据进行检查

③ Screen屏幕界面数据处理逻辑

用户可以访问的部分是Screen屏幕界面,用户对屏幕界面进行操作,相应的操作是通过Screen屏幕界面中的逻辑流(Flow Logic)进行控制,而数据声明和屏幕界面逻辑代码实现部分是在ABAP程序中进行操作

屏幕元素清单填写的变量需要与程序中定义的变量保持一致(同名传递),便于屏幕与程序进行交互

### ABAP Dialog Screen Code Structure In the context of SAP development, an ABAP dialog screen is a tool used to create user interfaces that interact with business logic written in ABAP. The structure of ABAP dialog screens involves several key components and follows specific guidelines. #### Definition and Purpose An ABAP dialog screen allows developers to design interactive forms where users can input data or make selections. These screens are closely tied to ABAP programs through flow logic and module pools[^1]. #### Components of ABAP Dialog Screens The main elements include: - **Screen Attributes**: Defined at the top of the screen painter, these attributes specify properties like number, title, and type. - **Fields on Screen**: Each field has its own characteristics such as name (which must match the corresponding database table column), position, length, offset, etc., all defined within the screen layout area using the screen painter tool. - **Flow Logic**: This part contains instructions for processing events triggered by actions performed on the screen, including PAI (Process After Input) and PBO (Process Before Output). Flow logic uses special syntax not found elsewhere in standard ABAP coding practices[^3]: ```abap PROCESS BEFORE OUTPUT. MODULE status_0100. ENDMODULE. ``` - **Modules/Methods**: Modules contain executable statements associated with particular points during execution; they may be called from either event blocks inside flow logic or directly via function calls within other modules. - **Field Selection Table (FST)**: A list defining which fields should appear visually when rendering the GUI element linked to this screen instance. #### Example Code Snippet Demonstrating Basic Structure Below demonstrates how one might set up basic structures required for creating simple dialog screens in ABAP programming language: ```abap * Module Pool Declaration Section REPORT zdialog_example NO STANDARD PAGE HEADING LINE-SIZE 80 LINE-COUNT 65(4). TABLES sflight. DATA: wa_sflight TYPE sflight, it_sflight LIKE TABLE OF sflight. SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01. PARAMETERS: p_carrid TYPE sflight-carrid OBLIGATORY MEMORY ID carr. PARAMETERS: p_connid TYPE sflight-connid OBLIGATORY MEMORY ID conn. SELECT-OPTIONS: so_fldate FOR sflight-fldate. SELECTION-SCREEN END OF BLOCK b1. INITIALIZATION. PERFORM init_data. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_carrid. CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING retfield = 'CARRID' dynprofield = 'P_CARRID' TABLES value_tab = gt_value_help EXCEPTIONS parameter_error = 1 no_values_found = 2 OTHERS = 3. START-OF-SELECTION. SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE @it_sflight WHERE carrid IN @p_carrid AND connid EQ @p_connid AND fldate BETWEEN @so_fldate-low AND @so_fldate-high. END-OF-SELECTION. LOOP AT it_sflight INTO wa_sflight. WRITE:/ wa_sflight~carrid, / wa_sflight~connid, / wa_sflight~fldate. ENDLOOP. ``` This example shows initialization sections, selection screens setup along with their respective handlers, start-of-selection block containing SQL queries against backend tables, end-of-selection section handling output display operations after fetching records based upon given criteria provided by end-users interacting through front-end interface built over generated dialog windows. --related questions-- 1. How does one define custom validations for inputs made into ABAP dialog screens? 2. What role do transaction codes play concerning interaction between back-end processes and frontend displays created via ABAP dialog screens? 3. Can you explain more about integrating web services with traditional ABAP applications utilizing dialog screens? 4. In what ways could modern technologies enhance classic ABAP dialog screen functionalities without compromising system stability? 5. Are there any best practices recommended while designing complex layouts involving multiple interconnected dialog screens within single application flows?
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值