Presentation is loading. Please wait.

Presentation is loading. Please wait.

ABAP/4程序员之路——第3天 上海华和得易信息技术有限公司 王勇.

Similar presentations


Presentation on theme: "ABAP/4程序员之路——第3天 上海华和得易信息技术有限公司 王勇."— Presentation transcript:

1 ABAP/4程序员之路——第3天 上海华和得易信息技术有限公司 王勇

2 本日学习内容 BATCH INPUT程序概念和作成 DIALOG程序初步

3 Batch Input程序 Batch Input是一种数据批量输入SAP系统的辅助程序, SAP系统的资料、格式可以通过Batch Input录入SAP系统 Batch Input的机制是模拟事务处理将数据录入R/3系统 Batch Input类似SAP的CATT,控制性更好,处理能力更强

4 Batch Input处理流程 分析需要什么样的数据结构 建立Batch Input程序 处理Batch Input数据 分析结果
分析错误的Session

5 分析数据结构 可以通过在屏幕字段上按‘F1’,然后查看其技术信息获得字段信息 一般我们通过工具来进行辅助分析:
SHDB - Batch Input Transaction Recorder SM35 - Batch Input Monitoring SCAT - Computer Aided Test Tool

6 SHDB - Batch Input Transaction Recorder

7 SHDB - Batch Input Transaction Recorder

8 SHDB - Batch Input Transaction Recorder

9 SHDB - Batch Input Transaction Recorder

10 建立Batch Input程序 …… “创建Batch Input的数据 APPEND BDCDATA. “调用事务
CALL TRANSACTION <transaction code> USING <BDCDATA table> MODE <display mode> UPDATE <update mode> MESSAGE INTO <message table> .

11 建立Batch Input程序 BDCDATA的结构 Field Name Type Length Description PROGRAM
CHAR 8 Module pool DYNPRO NUMC 4 DYNAPRO number DYNBEGIN 1 Starting a DYNPRO FNAM 35 Field name FVAL 80 Field value

12 建立Batch Input程序 声明内部BDCDATA的内部表 清空内部表
DATA:BEGIN OF BDCDATA OCCURS 0. INCLUDE STRUCTURE BDCDATA. DATA:END OF BDCDATA. 清空内部表 *& * *& Action : 清空BatchInput操作序列的内部表BDCDATA * *& Input : 无 * *& Output : 无 * FORM BDC_REFRESH. REFRESH BDCDATA. ENDFORM.

13 建立Batch Input程序 设置屏幕 *& * *& Action : 添加Program/DynPro操作到BatchInput序列的内部表BDCDATA * *& Input : PROGRAM - 程序名(长度为8的字符串) * *& DYNPRO - 画面号 * *& Output : 无 * FORM BDC_DYNPRO USING PROGRAM DYNPRO. CLEAR BDCDATA. BDCDATA-PROGRAM = PROGRAM. BDCDATA-DYNPRO = DYNPRO. BDCDATA-DYNBEGIN = 'X'. APPEND BDCDATA. ENDFORM.

14 建立Batch Input程序 设置屏幕字段
*& * *& Action : 添加屏幕数据操作到BatchInput序列的内部表BDCDATA * *& Input : FNAM - 屏幕项目名 * *& FVAL - 填写项目值 * *& Output : 无 * FORM BDC_FIELD USING FNAM FVAL. CLEAR BDCDATA. BDCDATA-FNAM = FNAM. BDCDATA-FVAL = FVAL. APPEND BDCDATA. ENDFORM.

15 建立Batch Input程序 Display mode Update Mode “调用事务
CALL TRANSACTION <transaction code> USING <BDCDATA table> MODE <display mode> UPDATE <update mode> MESSAGE INTO <message table> . Display mode A - Display all (Default) E - Display only error N - No Display Update Mode S - Continue processing when update is completed ( synchronous ) A - Continue processing immediately

16 SAP R/3 ABAP/4画面程序设计概要

17 1、进入T-Code:SE80(SE38也可以,但略有不同)
2、在“程序”栏输入程序名称,然后单击“显示”按钮 3、程序的名称一般为SAPMZxxx,‘xxx’为任意字符串

18 1、如果指定的程序不存在,将会有对话框弹出,询问是否需要创建新程序,请选择“是”
2、如果指定的程序已经存在,将自动转到对象浏览器部分

19 1、确定选上“带 TOP INCL”的复选框后,单击“√”按钮继续
2、该复选框是用来自动创建一个包含(INCLUDE类型)的程序,我们一般将数据声明部分放在该程序中

20 确认包含程序的名称后,单击“√”继续(这里程序名称一般无需改动)

21 1、主程序属性设置,一般我们只需要设置以下三个内容:
标题:程序功能描述或其它等等 类型:M(缺省值),Module类型 应用:一般为Z,声明程序为用户自定义程序 2、程序属性设置完成后,按保存按钮保存

22 1、在对象目录条目创建画面里,指定“开发类别”以用于传输属性的设置
2、如果用于测试目的,不需要传输的程序,可以指定为本地对象

23 Screen and Screen Object
Title bar Text field Input/output field Status icon Box Radio button and checkbox Pushbutton GUI statuses List Selection screen Subscreen Tabstrip control Table control

24 Screen Pushbutton Title bar Selection screen List GUI status Text field Input/Output field Status icon Table control Tabstrip control Subscreen Group box Radio button and checkbox

25 A container for further
Screen Object: Screen A container for further screen object

26 Defining and Managing Screens
Screen Objects Screen _ _ _ _ Text field Screen Attributes . . . Flow Logic PBO. . . . PAI. Title Box

27 Screen: Attributes

28 Dynamic Next Screen: Overview
SET SCREEN CALL SCREEN

29 Setting the Next Screen Dynamically
Screen Attributes Screen Attributes Screen number 100 Screen number 300 Next screen 200 Next screen 400 PBO PAI PBO PAI 400 MODULE ... SET SCREEN 300. LEAVE SCREEN. ENDMODULE.

30 Inserting a Sequence of Screens Dynamically
Screen Attributes Screen Attributes Screen number 100 Screen number 300 Next screen 200 Next screen 301 PBO PAI PBO PAI MODULE ... MODULE ... SET SCREEN 0. LEAVE SCREEN. ENDMODULE. Call SCREEN 300. …. ENDMODULE.

31 Calling a Dialog Box Dynamically
Screen 101 MODULE ok_code INPUT. ….. CALL SCREEN 101 STARING AT x1 y1. …… ENDMODULE. 100 101 . Screen Attributes MODULE ok_code INPUT. ….. CALL SCREEN 101 STARING AT x1 y1 ENDING AT x2 y2. …… ENDMODULE. Modal dialog box . Next screen 101 101 100

32 Setting the Cursor Position Dynamically
SET CURSOR FIELD f OFFECT o. Screen Painter PROCESS BEFORE OUTPUT. MODULE set_cursor. Airline LH ABAP Flight number ? MODULE set_cursor OUTPUT. sflight-carrid = 'LH'. Flight date ? SET CURSOR FIELD sdyn conn-connid. ... ENDMODULE.

33 Screen Pushbutton Title bar Selection screen List GUI status Text field Input/Output field Status icon Table control Tabstrip control Subscreen Group box Radio button and checkbox

34 Screen Object: Title Bar
Flight Connections Airline LH To 0400 0402 Frankfurt New 2407 Berlin San From Flight No Window titles

35 Creating and Using Title Bars
ABAP SET TITLEBAR ‘TITLE_SCREEN_100’. Create Object Title TITLE_SCREEN_100 does not exits. Do you want to create the object ? Double-click Yes No Cancel Create Title XXXX Program Title code TITLE_SCREEN_100 Title Flight Connections Save Cancel

36 Screen Pushbutton Title bar Selection screen List GUI status Text field Input/Output field Status icon Table control Tabstrip control Subscreen Group box Radio button and checkbox

37 Screen Object: Text Field
Airline Flight number Booking date Booking number Displaying static texts

38 Creating Text Fields ... Screen Painter ABAP Dictionary Data Element
Fullscreen Editor Directly_entered_text Much_longer_text ABAP Dictionary Data Element ... Texts Field name Short Text Medium Longer text Long Much longer text

39 Screen Pushbutton Title bar Selection screen List GUI status Text field Input/Output field Status icon Table control Tabstrip control Subscreen Group box Radio button and checkbox

40 Screen Object: Input/Output Field
Displaying and receiving data at the frontend Automatic field input checks Data consistency checks (foreign key) Possible values help LH ABAP PROGRAM sapmzxxx. ...

41 Input/Output Field:Attributes
General Object name Object text Icon display - Icon name - Quick info Start position Size - Static - Dynamic Scrollable Modif. groups Dictionary Data format Memory ID - ID - SET attribute - GET attribute Foreign key check From Dictionary Conversion exit Matchcode Upper-/lowercase active Program Dialog properties - Input field - Output field - Output only - Required field Possible entries - with or without - P. entries button Output options - right-justified - leading zeros Input options - *input possible - without reset - without template Display Fixed font Intensified Invisible 2-dimensional

42 Creating Input/Output Fields
Fullscreen Editor Screen Painter ABAP Dictionary Table: SDYN_CONN Field name Type Length CHAR 3 CARRID CONNID NUMC 4 Object Attributes HUGO Object name defLg 8 Data format CHAR ************************** INCLUDE MZxxxTOP * ************************** TABLES sdyn_conn DATA hugo(8) TYPE c . . .

43 Hiding a Field Dynamically
Display/Change This field is always displayed. This field can be hidden. This text is always Text field name: textfield1

44 Dynamically Modifiable Attributes
SCREEN-NAME Object Name SCREEN-GROUP1 SCREEN-GROUP2 SCREEN-GROUP3 SCREEN-GROUP4 Modification group 1 Modification group 2 Modification group 3 Modification group 4 SCREEN-REQUIRED SCREEN-INPUT SCREEN-OUTPUT SCREEN-INTENSIFIED SCREEN-INVISIBLE SCREEN-LENGTH SCREEN-ACTIVE SCREEN-DISPLAY 3D SCREEN-VALUE HELP SCREEN-REQUEST Required entry Ready for input Ready for output Intensified Invisible Object length Active object Display object in 3D Field with value help Input exists (only in PAI)

45 Object Attributes: Modification Groups
Screen Painter Object name SDYN_CONN-CONNID SDYN_CONN -CITYFROM SDYN_CONN -CITYTO ... Gr1 SEL Gr2 Gr3 Gr4 ... Object list: Modification groups

46 Dynamic Screen Modifications: Program
painter PROCESS BEFORE OUTPUT. . MODULE modify_screen. ABAP MODULE modify_screen OUTPUT. …... LOOP AT SCREEN. IF screen-name = ‘FEILD1’. Screen-invisible = 1. ENDIF. IF screen-group1 = ‘SEL’. Screen-input = 1. MODIFY SCREEN. ENDLOOP. ENDMODULE.

47 Input/Output Fields: Default Values in SAP Memory
Transaction 1 Transaction 2 SAP memory Set parameter Get parameter Airline Flight no. LH 0400 . CAR LH CON 0400 1 2

48 Defining SET/GET Parameter Attributes
ABAP Dictionary Data element Data element S_CARR_ID . Parameter ID CAR Carrier ID Screen Painter List of General Object Attributes SPA GPA PID SPFLI-CARRID X X CAR . SPFLI-CONNID X X CON

49 Input/Output Fields: Automatic Field Input Checks (Review)
DEC INT4 DATS CLNT ... Required entry check Field format check Fixed values Foreign key check Domain: Fixed values Field: Check table ?

50 Programming Field Input Checks with an Error Dialog
Screen Painter ABAP PROCESS AFTER INPUT. FIELD screen-field MODULE check_inp. MODULE check_inp INPUT. . MESSAGE E……. ENDMODULE. 1 1 1 E ? message 1 Ready for input again

51 Checking Groups of Fields
Screen Painter ABAP PROCESS AFTER INPUT. CHAIN. FIELD: screen-field1, screen-field2. MODULE check_inp. ENDCHAIN. MODULE check_inp INPUT. . MESSAGE E……. ENDMODULE. 1 1 1 1 1 1 1 1 E ? message Ready for input again

52 Dialog Message Categories
Termination Program Call Screen 100 A message X message Error Warning Information Screen 100 I message Screen 200 Success Screen 100 Screen 100 Screen 200 E message W message There are six different categories of message: A Termination The processing terminates and the user must restart the transaction. X Exit Like message type A, but with short dump MESSAGE_TYPE_X. E Error Processing is interrupted, and the user must correct the entry. W Warning Processing is interrupted, and the user may correct the entry. He or she may also, however, confirm the message (ENTER) as though it were an information message. I Information Processing is interrupted, but continues when the user has confirmed the message (pressed ENTER). S Success An information message, displayed on the next screen Screen 100 Screen 100 S message

53 Calling Modules Conditionally (1)
Screen Painter PROCESS AFTER INPUT. FIELD <screen-field> MODULE <module> ON INPUT. …... Called when field contains a non-initial value Screen Painter PROCESS AFTER INPUT. CHAIN. FIELD: <screen-field1>, <screen-field2>, . MODULE <module> ON CHAIN-INPUT. ENDCHAIN. …...

54 Calling Modules Conditionally (2)
Screen Painter PROCESS AFTER INPUT. FIELD <screen-field> MODULE <module> ON REQUEST. …... Called when Screen field contains have changed Screen Painter PROCESS AFTER INPUT. CHAIN. FIELD: <screen-field1>, <screen-field2>, . MODULE <module> ON CHAIN-REQUEST. ENDCHAIN. …...

55 Screen Pushbutton Title bar Selection screen List GUI status Text field Input/Output field Status icon Table control Tabstrip control Subscreen Group box Radio button and checkbox

56 Screen Object: Status Icons
Occupancy for flight Flight date Occ. 0400 LH Displaying Icons

57 Creating Status Icon Fields
Screen Painter Fullscreen Editon Flight date Occupancy Object Attributes Object name iconfield1 defLg 33 visLg >2 Data format CHAR ABAP ****************************** * INCLUDE MZXXXTOP DATA: iconfield1 like icons-text . …...

58 Filling Status Icon Fields
Screen Painter PBO. Icon List MODULE set_icon. . . . Icon Name 100 ABAP Icon_ok MODULE set_icon. ………… CALL FUNCTION ‘ICON_CREATE’ EXPORTING name = ‘ICON_RED_LIGHT text = ‘ ‘ IMPORT result = iconfield1 EXCEPTIONS icon_not_found = 1 …… ENDMODULE. Icon_cancel Icon_red_light . . . Flight date Occupancy 100

59 Screen Pushbutton Title bar Selection screen List GUI status Text field Input/Output field Status icon Table control Tabstrip control Subscreen Group box Radio button and checkbox

60 Screen Object: Group Boxes
Graphical element Group box header Field group Field 1 Field 2 Field 3 Group box

61 Create Group Box

62 Screen Pushbutton Title bar Selection screen List GUI status Text field Input/Output field Status icon Table control Tabstrip control Subscreen Group box Radio button and checkbox

63 Screen Object: Radio Buttons and Checkboxes
User-input by mouse- click Radio button group Option 1 Option 2 Option 3 Checkboxes X Option 1 X Option 2 Group box Option 3

64 Creating a Radio Button Group
Screen Painter Fullscreen Editor 2 1 Option1 Option2 Object Attributes Option3 Object name radio1 Object text Option1 Data format CHAR 1 Create radio button 2 Define radio button group ABAP ***************************** * INCLUDE MZxxxTOP DATA: radio1(1) TYPE c. ………...

65 Creating a Checkbox X Screen Painter ABAP
Fullscreen Editor X Option1 Option2 Object Attributes Option3 Object name check1 Object text Option1 Data format CHAR ABAP ***************************** * INCLUDE MZxxxTOP DATA: check1(1) TYPE c. ………...


Download ppt "ABAP/4程序员之路——第3天 上海华和得易信息技术有限公司 王勇."

Similar presentations


Ads by Google