660 likes | 1.01k Views
ABAP/4 程序员之路 —— 第 4 天. 上海华和得易信息技术有限公司 王勇. 本日学习内容. DIALOG 程序 Screen Object 和 PBO 、 PAI 处理 特殊对象处理:对话屏幕,子屏幕以及 Table Control 的处理. Screen. Title bar. Pushbutton. Text field. Input/Output field. Status icon. Group box. Radio button and checkbox. Selection screen. List. GUI status.
E N D
ABAP/4程序员之路——第4天 上海华和得易信息技术有限公司 王勇
本日学习内容 • DIALOG程序Screen Object和PBO、PAI处理 • 特殊对象处理:对话屏幕,子屏幕以及Table Control的处理
Screen Title bar Pushbutton Text field Input/Output field Status icon Group box Radio button and checkbox Selection screen List GUI status Table control Tabstrip control Subscreen
User-input using the mouse Screen Object: Pushbuttons Display/Change A B Display/Change A B
Creating Pushbuttons 2 Screen Painter Display/Change Fullscreen Editor 1 Screen Painter PAI. 1 MODULE user_command. Object Attributes . . . button Object name Object text Display/Change ABAP DATA: ok_code LIKE sy-ucomm, save_ok LIKE ok_code. MODULE user_command INPUT. Save_ok = ok_code. CLEAR ok_code. CASE save_ok. WHEN ‘SWIT’. …… ENDCASE. ENDMODULE. SWIT FctCode FctTyp Object List Object name FctCode FctTyp Type 2 button SWIT ok_code OK
Pushbuttons with Function Type E Screen Painter Cancel Fullscreen Editor Screen Painter PAI. MODULE exit_command Object Attributes AT EXIT-COMMAND. button Object name . . . Object text Cancel ABAP E DATA: ok_code LIKE sy-ucomm. MODULE exit_command INPUT. CASE sy-dynnr. WHEN ‘0100’. Leave program. …… ENDCASE. ENDMODULE. CANC FctCode FctTyp Object List Object name FctCode FctTyp Type E button CANC ok_code OK
Screen Title bar Pushbutton Text field Input/Output field Status icon Group box Radio button and checkbox Selection screen List GUI status Table control Tabstrip control Subscreen
3 3 3 3 Screen Object: GUI status Choose functions by Development object Edit Goto System Help clicking with the mouse xxxx Flight data Menu bar Standard toolbar Application toolbar ENTER Function keys F1 Help F2 Choose F3 . . .
Create GUI Status(1) Double Click
Create GUI Status(2) Double Click
Create GUI Status(3) Enter
Status 001 Status 002 Status ... Function key settings Application toolbars Menu bars T 1 M 1 D 1 Status: Technical View
Menu Bar _____ _____ _____ _____ The max level is 4 Enter Transaction Code Enter Description
Function Key:Attributes Attributes Function text Icon name Icon text Info. text Fastpath Functional type Enter Function Key description • E: Exit command • S: System function • T: Call a Transaction • : Normal application Function • P: Local GUI Function • H: Internal use 以符號方式 來表示此 Icon 以文字方式 來表示此 Icon Short description One- character ID letter for function fast path
Standard Toolbar Functions and Their Reserved Function Keys Icon Function Function key Enter F11 Save F3 Back Ctrl-F3 Exit (program) F12 Cancel (Screen) Ctrl-P Print Ctrl-F Find Ctrl-G Find next Ctrl-Page up First page Page up Previous page Page down Next page Ctrl-Page down Last page F1 Help
Back Exit Cancel Saves Dialog Yes Yes No Checks Entries Yes Yes No - Sequence Check, then save Save, then check Unsaved data will Example Save data? Save data? be lost! Cancel? popup_to_ popup_to_ confirm_step confirm_step popup_to_ Function Module or or confirm_ popup_to_ popup_to_ for Dialog loss_of_data confirm_ confirm_ with_value with_value Navigation - Dialogs
Screen Title bar Pushbutton Text field Input/Output field Status icon Group box Radio button and checkbox Selection screen List GUI status Table control Tabstrip control Subscreen
List Edit Goto System Help CAR ID From To Displaying data at the front end Screen Object: Lists Flight List AA 0017 NEW YORK SAN FRANCISCO 0400 FRANKFURT NEW YORK LH LH 0402 FRANKFURT BERLIN Created on: 01 .01.1998 By: WITTMANN
MODULE < Module_name >. PBO List LEAVE TO LIST-PROCESSING. PAI (100) (100) SET PF-STATUS SPACE. ... 100 100 100 100 WRITE...SKIP...ULINE... Next screen ENDMODULE. F3 MODULE < Module_name >. LEAVE TO LIST-PROCESSING List PBO PAI AND RETURN TO SCREEN 300. (100) (100) SET PF-STATUS SPACE. ... 100 100 100 100 ENDMODULE. Screen 300 F3 MODULE < Module_name >. SUPPRESS DIALOG. List LEAVE TO LIST-PROCESSING. PAI PBO (100) SET PF-STATUS SPACE. (100) ... 100 100 ENDMODULE. Displaying a List Within a Transaction
100 ABAP ABAP MODULE m INPUT. . . . 200 CALL SCREEN 200 STARTING AT 20 10 ENDING AT 50 15. . . . ENDMODULE. Screen Screen Painter Painter PROCESS BEFORE OUTPUT. MODULE LIST . 200 200 ABAP ABAP MODULE LIST OUTPUT. SUPPRESS DIALOG. LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0. SET PF-STATUS SPACE. ... ENDMODULE. Lists in a Modal Dialog Box Dialog Box List 200
Screen Title bar Pushbutton Text field Input/Output field Status icon Group box Radio button and checkbox Selection screen List GUI status Table control Tabstrip control Subscreen
List Edit Goto System Help AA Airline to From Frankfurt Restricting Database selections Flight date This week This month This quarter Any Screen Object: Selection screen
Airline LH to .. . Maintain Selection Options Airline Single value Selection table Greater than or equal Greater than Less than Not equal Select Exclude from selection SELECT-OPTIONS ... PARAMETERS ... From Less than or eqeual SIGN OPTION LOW HIGH I GE LH Entering Value Ranges
SELECTION-SCREEN BEGIN OF SCREEN <nnnn>. ... SELECTION-SCREEN END OF SCREEN <nnnn>. SELECTION-SCREEN BEGIN OF SCREEN 1200. SELECT-OPTIONS se_carr FOR sflight-carrid. PARAMETERS pa_airpf LIKE spfli-airpfrom. SELECTION-SCREEN END OF SCREEN 1200. ... CALL SELECTION-SCREEN 1200. Defining and Calling a Selection Screen
Screen Title bar Pushbutton Text field Input/Output field Status icon Group box Radio button and checkbox Selection screen List GUI status Table control Tabstrip control Subscreen
Reserved area on a Subscreen I screen: Filled at runtime Subscreen Subscreen Subscreen Subscreen area area area area Subscreen Subscreen Screen Object: Subscreen
Calling a Subscreen Subscreen name Screen number Program name
Screen Title bar Pushbutton Text field Input/Output field Status icon Group box Radio button and checkbox Selection screen List GUI status Table control Tabstrip control Subscreen
An easy way to present From To Info data that logically belongs together Country DE City Berlin Airport TXL Time 10:10:00 Screen Object: Tabstrip Control
Tabstrip Elements Current tab title Scrollbar for more tab pages Depart Arrive Seats List of all tab pages Depart Land DE Arrive Current page is indicated Stadt Berlin Seats Bookings Flughafen TXL Information Zeit 10:10:00 Tab border
Subscreen Subscreen area area Tab Page: Technical View Pushbutton Pushbutton Text Text + Text = CONTENTS + Contents = Subscreen
Tabstrip area Tabstrip area Tab titles Tab titles Subscreen areas Subscreen areas Creating a Tabstrip Control
TABSTRIP TABSTRIP Type corresponds to the CXTAB _TABSTRIP CXTAB structured type with the individual types: activetab active tab title . . . ABAP ABAP ************************************ * INCLUDE MZxxxTOP * ************************************ CONTROLS: my_tab_strip TYPE TABSTRIP . . . . Creating a Tabstrip Control: Tabstrip Area
Subscreen Area or Creating a Tabstrip Control: Subscreens
Depart Arr. Info Depart Arr. Info Page 1 Page 2 PBO PAI • • Sets the subscreen Determines which page corresponding to the the user has chosen page chosen by the user Calls the screen again • Scrolling in a Tabstrip Control
ABAP ABAP FctTyp FctTyp CONTROLS: my_tab_strip TYPE TABSTRIP. Dynpro DATA : dynpro LIKE sy-dynnr, MY_TAB_STRIP MY_TAB_STRIP ok_code LIKE sy-ucomm, pressed_tab LIKE sy-ucomm value '0101'. R1 R2 R3 MODULE user_command INPUT. CASE ok_code. Subarea WHEN 'R1'. pressed_tab = 'R1'. WHEN 'R2'. pressed_tab = 'R2'. ... Screen Screen ENDMODULE. Painter Painter PROCESS BEFORE OUTPUT. MODULE SET_PAGE. MODULE set_page OUTPUT. ... my_tab_strip-activetab = pressed_tab. CALL SUBSCREEN subarea CASE pressed_tab. INCLUDING SYST-CPROG dynpro . WHEN 'R1'. dynpro = '0101' . PROCESS AFTER INPUT. WHEN 'R2'. CALL SUBSCREEN subarea . dynpro = '0102' . R ... ... MODULE user_command. ENDMODULE. Scrolling in Tabstrip Controls: Coding
Screen Title bar Pushbutton Text field Input/Output field Status icon Group box Radio button and checkbox Selection screen List GUI status Table control Tabstrip control Subscreen
Airline From To Flgt New Frankfurt 0400 New 0402 Frankfurt San F 2407 Berlin LH Displaying large amounts of data in tabluar form Screen Object: Table control
ABAP Table Control (Function) Change and save table setting Mark and swap columns Change column width Mark rows Automatic horizontal and vertical scrolling Fixed leading columns
Table Control Creating a Table Control Processing a Table Control Further Techniques Table Control Elements
************************************ * INCLUDE MZxxxTOP * ************************************ CONTROLS: my_control TYPE TABLEVIEW USING SCREEN '0100'. . . . ABAP ABAP Create Table Control Area My_control 1-3 給一個tablecontrol name 1-2 圈選所需要的畫面 1-1 選取table control 物件
或從table中 reference field 自己creat field Create Table Control Fields
Table Control Attributes Table control name Not delete all head line elements Show table control label Show table 直條線 Show table 橫條線 可選擇欄位的條件 增加checkbox 固定不會移動的欄位 選擇視窗縮小時出現移動bar Table control 抬頭 一次可選擇幾筆資料
Table Control Elements Table Control Creating a Table Control Processing a Table Control Further Techniques
1 2 3 4 5 6 7 8 6 9 7 . 8 . . Processing a Table Control(Principle) Database table ABAP program Screen Internal table PBO buffer 1 2 3 4 PAI Database table Next page 5