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
分享到:
相关推荐
CASE SY-UCOMM. WHEN 'PUSH1'. MYTAB-DYNNR = 100. MYTAB-ACTIVETAB = 'BUTTON1'. WHEN 'PUSH2'. MYTAB-DYNNR = 200. MYTAB-ACTIVETAB = 'BUTTON2'. ENDCASE. ENDCASE. START-OF-SELECTION.
sap BC412 ABAP_Dialog_Programming_Using_Enjoy_SAP_Control Doc 文件
51SAP_ECC_ABAP_Unit 01-开发概述
ABAP官方教程--- BC400_EN_Col32:Introduction to the ABAP Workbench
51SAP_ECC_ABAP_Unit 12-接口.ppt
51SAP_ECC_ABAP_Unit 10-BDC .ppt
ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。ABAP_OLE相关文档。...
DATA: OK_CODE TYPE SY-UCOMM, SAVE_OK TYPE SY-UCOMM. TABLES SPFLI. DATA LS_SPFLI TYPE SPFLI. DATA WA_SPFLI TYPE TABLE OF SPFLI. DATA WADEL_SPFLI TYPE TABLE OF SPFLI. SELECT * INTO TABLE WA_SPFLI ...
ABAP ALV总结,ALV格式,REUSE_ALV_GRID_DISPLAY_LVC函数使用
SAP ABAP 开发手册,对SAP上ABAP开发有很大的帮助,希望对在SAP上开发者能够提供帮助
DIALOG程序是在SAP中,专门用于设计使用者接口的ABAP/4程序技巧;事 实上,所有SAP的FUNCTIONAL模块的操作接口,都是透过DIALOG程序开 发出来的。本章将对DIALOG程序操作的原理以及开发工具的使用进行简介。
ABAP TAW12_1 经过重点书签加工的电子文档
ABAP 7.4 新语法
SAP_MIRO_Free-Tutorial-on-Invoice-Verification
ABAP_DOCU_HTML ABAP_DOCU_HTML ABAP_DOCU_HTML ABAP_DOCU_HTML
生成XML文件ABAP程序 REPORT zams_xml_dom_create . TYPE-POOLS: ixml. CLASS cl_ixml DEFINITION LOAD. TYPES: BEGIN OF xml_line, data(256) TYPE x, END OF xml_line. DATA: l_ixml TYPE REF TO if_ixml, ...
ABAP编程中文帮助\指南
ERP系统信息化资料:XX_ABAP_技术书_SD050_金穗系统.docx
ERP系统信息化资料:XX _ABAP_技术书_FICO009_现金流量表.docx
ZGR_ABAP_BUILD_REP_FCAT_FUNC