Reading Function Codes
In each PAI event that a user triggers by choosing either a pushbutton on the screen or an element in a GUI status, the corresponding function code is placed into the system field syst-ucomm or sy-ucomm and placed in the OK_CODE field (as long as the function code is not empty). Empty function codes are placed in neither the sy-ucomm field nor the OK_CODE field.
In your ABAP programs, you should work with the OK_CODE field instead of sy-ucomm. There are two reasons for this: Firstly, the ABAP program has full control over fields declared within it, and secondly, you should never change the value of an ABAP system field. However, you should also always initialize the OK_CODE field in an ABAP program for the following reason:
In the same way that the OK_CODE field in the ABAP program and the system field sy-ucomm receive the contents of the corresponding screen fields in the PAI event, their contents are also assigned to the OK_CODE screen field and system field syst-ucomm in the PBO event. Therefore, you must clear the OK_CODE field in the ABAP program to ensure that the function code of a screen is not already filled in the PBO event with an unwanted value. This is particularly important when the next PAI event can be triggered with an empty function code (for example, using ENTER). An empty function code does not influence the fields and the old content is transferred.
In your application programs, the first step in PAI processing should be to save the function code in an auxiliary variable and then initialize the OK_CODE field. You can then read the function code from the auxiliary variable (for example, using a CASE structure), and control the program flow from there.
The OK_CODE field can have a different name on each screen. However, common practice is to use the same name for the field on each screen of an ABAP program. You then only need one field in the ABAP program, with the same name, into which the function code is placed, and from which you can read it.
Global data declarations:
DATA: ok_code LIKE sy-ucomm,
save_ok LIKE sy-ucomm.
Your ABAP program must contain a field with the same name as the OK_CODE field on the screen. To specify the type, you should refer to the system field sy-ucomm, since this always corresponds to the type of the OK_CODE field on the screen. At the same time, you should declare an appropriate auxiliary variable.
PAI module:
MODULE user_command_100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN...
...
ENDCASE.
ENDMODULE.
In the first PAI module, you should assign the contents of the OK_FIELD to the auxiliary variable and then clear the OK_CODE field and carry on working with the auxiliary variable.
- 大小: 5.9 KB
分享到:
相关推荐
根据提供的ABAP代码示例,我们可以深入探讨其中涉及的关键知识点,包括如何在ABAP程序中创建查询屏幕、使用标签页以及处理用户输入等。 ### ABAP查询屏幕标签页搜索条件 #### 报告ZTEST_TAN9 此报告旨在演示如何...
标题“abap-ALV.rar_ABAP系统ALV_abap_abap开发alv”暗示我们将深入探讨ABAP ALV的使用,特别是在ABAP系统中的应用以及如何进行开发。 描述中提到“ABAP ALV总结,ALV格式,REUSE_ALV_GRID_DISPLAY_LVC函数使用”,...
### SAP BC412_ABAP_Dialog_Programming_Using_Enjoy_SAP_Control知识点解析 #### 一、课程概述 本课程旨在通过介绍SAP Control Framework(控制框架),使学员能够掌握如何在ABAP对话程序中使用Enjoy SAP Control...
《SAP ABAP 4.7开发指南》 在企业级信息技术领域,SAP系统扮演着至关重要的角色,尤其在企业资源规划(ERP)方面。SAP ABAP(Advanced Business Application Programming)是SAP系统中的一种编程语言,用于开发、...
标题:“TAW12_1_-_2005-Q2_-_A4_ABAP_Workbench_Concepts.pdf” - **TAW12_1**:这可能是文档的内部编号或名称。 - **2005-Q2**:表明文档的出版时间是2005年第二季度。 - **A4**:可能指的是文档的格式为A4纸张...
ABAP 系统变量详解 ABAP 系统变量是 ABAP 运行时环境填写的变量,用于在 ABAP 程序中查询系统状态。这些变量都是只读的,除了 sy-repid 之外,其他系统字段都不能被重写。ABAP 程序中的系统字段只在极少需要控制...
### ABAP DIALOG程序入门详解 #### 一、DIALOG程序概述 DIALOG程序作为SAP系统中的一个重要组成部分,主要用于设计用户界面。它是通过ABAP/4编程语言实现的,几乎所有的SAP功能模块的用户操作接口都是通过DIALOG...
### SAP ABAP ALV 分页显示技术解析 #### 核心知识点:SAP ABAP ALV 分页显示 本篇文章将深入分析一个基于SAP ABAP的ALV(Application List Viewer)分页显示的实现方法。ALV是SAP GUI中用于展示表格数据的一种...
gheader-COMP_CODE = '9000'. gheader-DOC_DATE = '20141209'. gheader-PSTNG_DATE = '20141209'. gheader-FISC_YEAR = '2014'. gheader-DOC_TYPE = 'ZB'. gheader-USERNAME = sy-uname. *** 金额行项目1 gheader-...
标题:“ABAP官方教程--- BC400_EN_Col32”和“Introduction to the ABAP Workbench”(ABAP工作台介绍)。 描述:本文件是一份关于ABAP官方教程的介绍,该教程的全称为“BC400_EN_Col32”,涵盖了ABAP工作台的入门...
在ABAP开发中,ALV(Accelerated List Viewer)是一种常用的数据展示工具,它提供了灵活的表格布局和交互性。用户通常需要对ALV进行定制,以满足特定的需求,例如添加自定义按钮来实现数据的打印或导出到Excel。本篇...
ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。...
在ABAP编程中,ALV (ABAP List Viewer) 是一个强大的工具,用于展示和编辑数据表。在处理用户输入时,我们有时需要对特定字段应用格式化或限制,这时`EDIT_MASK`就派上用场了。`EDIT_MASK`是ABAP中的一种功能,允许...
- 在PAI(Program After Input)中,`OK_CODE`变量应立即赋值给其他变量并清除,然后根据新变量进行条件判断。 - `SET SCREEN`用于指定当前屏幕的后续屏幕,`CALL SCREEN`用于挂起当前屏幕并进入新屏幕或事务。 -...
内联声明是ABAP 7.4新增的一个功能,允许开发者在表达式内部直接声明和初始化变量,而无需显式地定义这些变量。这一特性可以极大地简化代码,使程序更加紧凑易读。 **示例:** ```abap DATA(v_result) = INLINE( ( ...
根据提供的文件信息,本文将详细解释 ABAP 中通过 URL 下载文件的相关知识点,包括 ABAP 程序中实现此功能的基本步骤和技术要点。 ### ABAP URL 文件下载概述 ABAP(Advanced Business Application Programming)...
**ABAP** (Advanced Business Application Programming) 是一种高级商业应用编程语言,专为SAP系统设计。它不仅是一种编程语言,也是SAP系统内部进行各种定制开发的基础工具之一。 #### 1.1 ABAP概览 - **定义**: ...
接下来,我们可以使用/UI2/CL_JSON的`DESERIALIZE`方法将JSON字符串转换为ABAP数据结构: ```abap DATA lo_json_converter TYPE REF TO /ui2/cl_json. DATA lv_json_string TYPE string VALUE '{"name":"John","age...
在SAP系统中,ABAP(Advanced Business Application Programming)是一种编程语言,用于开发企业级的应用程序。本主题将深入探讨“ABAP EXCEL通用类”——ZCL_EXCEL,它是SAP ABAP开发者用于处理Excel文件的一个强大...
FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE lis_selfield. CASE r_ucomm. WHEN 'BUTTON1'. " BUTTON1 是自定义按钮的功能码 PERFORM frm_button1. " 执行相应处理 ENDCASE. ENDFORM. " ...