1 / 65

ABAP/4 程序员之路 —— 第 3 天

ABAP/4 程序员之路 —— 第 3 天. 上海华和得易信息技术有限公司 王勇. 本日学习内容. BATCH INPUT 程序概念和作成 DIALOG 程序初步. Batch Input 程序. Batch Input 是一种数据批量输入 SAP 系统的辅助程序, SAP 系统的资料、格式可以通过 Batch Input 录入 SAP 系统 Batch Input 的机制是模拟事务处理将数据录入 R/3 系统 Batch Input 类似 SAP 的 CATT ,控制性更好,处理能力更强. Batch Input 处理流程. 分析需要什么样的数据结构

morgan
Télécharger la présentation

ABAP/4 程序员之路 —— 第 3 天

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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的结构

  12. 建立Batch Input程序 • 声明内部BDCDATA的内部表 * 存放Batch Input操作序列的内部表 -------------------------------------* 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程序 “调用事务 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. Screen and Screen Object • Screen • 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

  18. 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

  19. Screen Object: Screen A container for further screen object

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

  21. Screen: Attributes

  22. Dynamic Next Screen: Overview SET SCREEN CALL SCREEN

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

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

  25. 101 101 100 100 Calling a Dialog Box Dynamically Screen 101 MODULE ok_code INPUT. ….. CALL SCREEN 101 STARING AT x1 y1. …… ENDMODULE. . 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

  26. 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. Flight date ? sflight-carrid = 'LH'. SET CURSOR FIELD sdyn conn-connid. ... ENDMODULE.

  27. 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

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

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

  30. 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

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

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

  33. 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

  34. ABAP 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 PROGRAM sapmzxxx. ...

  35. General Dictionary Program Display • Object name • Object text • Icon display - Icon name - Quick info • Start position • Size - Static - Dynamic • Scrollable • Modif. groups • Data format • Memory ID - ID - SET attribute - GET attribute • Foreign key check • From Dictionary • Conversion exit • Matchcode • Upper-/lowercase active • 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 • Fixed font • Intensified • Invisible • 2-dimensional Input/Output Field:Attributes Attributes

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

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

  38. 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)

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

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

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

  42. Defining SET/GET Parameter Attributes ABAP Dictionary Data element S_CARR_ID Data element . 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

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

  44. Screen Screen ABAP ABAP Painter Painter Programming Field Input Checks with an Error Dialog 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

More Related