TABC42 ABAP Programmiertechniken 1/2 TABC42 1/2 R/3 System Release 46B 30.05.2000 TABC42 ABAP Programming Techniques 1/2..................................................................................................................0-1 Copyright...............................................................................................................................................................................0-2 Section Overview............................................................................................................................................................0-4 Section: Techniques for List Creation and SAP Query.................................................................................................1-1 Content: Techniques for List Creation and SAP Query............................................................................................1-2 Introduction...........................................................................................................................................................................2-1 Course Objectives............................................................................................................................................................2-2 Course Overview Diagram............................................................................................................................................2-3 Business Scenario............................................................................................................................................................2-4 Demonstrations, Copy Templates, and Solutions......................................................................................................2-5 Exercises and Units.........................................................................................................................................................2-6 QuickViewer.........................................................................................................................................................................3-1 QuickViewer: Principle..................................................................................................................................................3-2 QuickViewer: Initial Access..........................................................................................................................................3-3 Creating a QuickView....................................................................................................................................................3-4 Join Definition: Graphical..............................................................................................................................................3-5 Basis Mode: Principle Structure ...................................................................................................................................3-6 Structuring a QuickView in the Basis Mode..............................................................................................................3-7 Using the QuickView......................................................................................................................................................3-8 Summary...........................................................................................................................................................................3-9 SAP Query - Creating Lists................................................................................................................................................4-1 SAP Query - Creating Lists...........................................................................................................................................4-2 Overview: Programs and Query....................................................................................................................................4-3 Organization of Query....................................................................................................................................................4-4 Creating a Query..............................................................................................................................................................4-5 SAP Query - Creating Lists...........................................................................................................................................4-6 Defining a Query.............................................................................................................................................................4-7 Selecting the Work Area and Functional Area...........................................................................................................4-8 Creating Local Fields......................................................................................................................................................4-9 Assigning Short Descriptions......................................................................................................................................4-10 Defining Local Fields...................................................................................................................................................4-11 Statistics..........................................................................................................................................................................4-12 Ranked List.....................................................................................................................................................................4-13 Basic List: Layout Mode..............................................................................................................................................4-14 Designing a Basic List: Example................................................................................................................................4-15 Basic List: Control Level Processing.........................................................................................................................4-16 Interactive Functions.....................................................................................................................................................4-17 Saving Lists....................................................................................................................................................................4-18 Comparison: SAP Query - QuickView......................................................................................................................4-19 Summary.........................................................................................................................................................................4-20 Solutions..........................................................................................................................................................................4-23 Outputting Data in Lists......................................................................................................................................................5-1 Generating a List.............................................................................................................................................................5-2 Setting the List Format...................................................................................................................................................5-3 Page and Column Headers.............................................................................................................................................5-4 Defining Line and Field Formats..................................................................................................................................5-5 WRITE Statement: General Syntax.............................................................................................................................5-6 Outputting Icons, Symbols, and Lines.........................................................................................................................5-7 Scrolling in Lists and Lead Columns...........................................................................................................................5-8 Additional Statements for Page Layout.......................................................................................................................5-9 Multilingual List Elements..........................................................................................................................................5-10 System Fields in List Creation....................................................................................................................................5-11 Standard List Functions................................................................................................................................................5-12 Summary.........................................................................................................................................................................5-13 Exercises.........................................................................................................................................................................5-14 Solutions..........................................................................................................................................................................5-17 Selection Screen...................................................................................................................................................................6-1 Selection Screen: Overview..........................................................................................................................................6-2 Declaring Fields with PARAMETERS.......................................................................................................................6-3 Selections with SELECT-OPTIONS...........................................................................................................................6-4 Selection Options and Multiple Selections.................................................................................................................6-5 Syntax of the SELECT-OPTIONS Statement............................................................................................................6-6 Designing the Selection Screen I..................................................................................................................................6-7 Designing the Selection Screen II.................................................................................................................................6-8 Initializing the Selection Screen...................................................................................................................................6-9 Input Checks: AT SELECTION-SCREEN...............................................................................................................6-10 CALL SELECTION-SCREEN...................................................................................................................................6-11 Selection Screen: Variants I.........................................................................................................................................6-12 Selection Screen: Variants II.......................................................................................................................................6-13 Summary.........................................................................................................................................................................6-14 Exercises.........................................................................................................................................................................6-15 Solutions..........................................................................................................................................................................6-17 Logical Database..................................................................................................................................................................7-1 Generating Lists...............................................................................................................................................................7-2 Advantages of a Logical Database...............................................................................................................................7-3 Logical Database: Overview.........................................................................................................................................7-4 Logical Database: F1S Nodes.......................................................................................................................................7-5 Sample Program for a Logical Database.....................................................................................................................7-6 LDB Sub-Objects: Structure..........................................................................................................................................7-7 Events in Logical Databases..........................................................................................................................................7-8 Program Flow and Termination Alternatives.............................................................................................................7-9 LDB Sub-Objects: Selections......................................................................................................................................7-10 Selection Screen for the Logical Database................................................................................................................7-11 Logical Database: Dynamic Selections....................................................................................................................7-12 LDB Sub-Objects: Database Programs......................................................................................................................7-13 Interaction: LDB and Program....................................................................................................................................7-14 Checking Internal Program Selections.......................................................................................................................7-15 Summary.........................................................................................................................................................................7-16 Exercises.........................................................................................................................................................................7-17 Solutions..........................................................................................................................................................................7-19 Programming Data Retrieval..............................................................................................................................................8-1 Data Retrieval: Internal..................................................................................................................................................8-2 Reading Multiple Database Tables...............................................................................................................................8-3 Reading Multiple Database Tables I............................................................................................................................8-4 Reading Multiple Database Tables IIa.........................................................................................................................8-5 Reading Multiple Database Tables IIb........................................................................................................................8-6 Reading Multiple Database Tables III.........................................................................................................................8-7 Reading Multiple Database Tables IV.........................................................................................................................8-8 Summary...........................................................................................................................................................................8-9 Exercises.........................................................................................................................................................................8-10 Solutions..........................................................................................................................................................................8-11 SAP Query - Administration..............................................................................................................................................9-1 ABAP Query - Administration......................................................................................................................................9-2 Maintaining User Groups...............................................................................................................................................9-3 Authorizations and ABAP Query.................................................................................................................................9-4 ABAP Query - Administration......................................................................................................................................9-5 Defining Functional Areas.............................................................................................................................................9-6 Overview: Creating Functional Areas..........................................................................................................................9-7 Defining Functional Areas: Example...........................................................................................................................9-8 Defining Functional Areas.............................................................................................................................................9-9 Allocating Fields............................................................................................................................................................9-10 Additional Information.................................................................................................................................................9-11 Allocating Additional Tables ......................................................................................................................................9-12 Allocating Additional Fields.......................................................................................................................................9-13 Selection Options...........................................................................................................................................................9-14 Allocating ABAP Statements......................................................................................................................................9-15 Summary.........................................................................................................................................................................9-16 Exercises.........................................................................................................................................................................9-17 Data Formatting and Control Level Processing............................................................................................................10-1 Control Level Processing.............................................................................................................................................10-2 Creating an Internal Table............................................................................................................................................10-3 Filling an Internal Table...............................................................................................................................................10-4 Sorting and Editing an Internal Table........................................................................................................................10-5 Control Level Processing for Internal Tables...........................................................................................................10-6 Control Level Processing Schema for Internal Tables............................................................................................10-7 Summary.........................................................................................................................................................................10-8 Exercises.........................................................................................................................................................................10-9 Solutions........................................................................................................................................................................10-13 Saving Lists and Background Processing......................................................................................................................11-1 Saving Lists and Background Processing.................................................................................................................11-2 Options for Saving Lists...............................................................................................................................................11-3 Saving Lists in SAPoffice............................................................................................................................................11-4 Saving Lists as PC Files...............................................................................................................................................11-5 Saved Lists in the Area Menu.....................................................................................................................................11-6 Saving Lists and Background Processing.................................................................................................................11-7 List Printing Options.....................................................................................................................................................11-8 Print Parameters.............................................................................................................................................................11-9 Program-Controlled Printing.....................................................................................................................................11-10 Printing with GET_PRINT_PARAMETERS.........................................................................................................11-11 GET_PRINT_PARAMETERS: Applications........................................................................................................11-12 Saving Lists and Background Processing...............................................................................................................11-13 The Phases of Background Processing....................................................................................................................11-14 Defining Steps..............................................................................................................................................................11-15 Determining the Start Date and Releasing the Job................................................................................................11-16 Summary.......................................................................................................................................................................11-17 Optional Exercises.......................................................................................................................................................11-18 Solutions........................................................................................................................................................................11-19 ALV Grid Control..............................................................................................................................................................12-1 ALV Grid Control.........................................................................................................................................................12-2 Controls:Technical Background I...............................................................................................................................12-3 Controls:Technical Background II.............................................................................................................................12-4 ALV Example and Standard Functions.....................................................................................................................12-5 ALV Grid Control: Principle.......................................................................................................................................12-6 Implementing the Control: Screen.............................................................................................................................12-7 Implementation in the Program...................................................................................................................................12-8 Generating and Linking Objects.................................................................................................................................12-9 Program Flow...............................................................................................................................................................12-10 Displaying the Data in the Control...........................................................................................................................12-11 ALV Grid Control.......................................................................................................................................................12-12 Field catalog.................................................................................................................................................................12-13 Selected Fields in the Field Catalog.........................................................................................................................12-14 Filling and Passing On the Field Catalog................................................................................................................12-15 Saving Display Variants.............................................................................................................................................12-16 Filling and Passing On the Layout Structure..........................................................................................................12-17 Interface to Display Method......................................................................................................................................12-18 ALV Grid Control.......................................................................................................................................................12-19 Outlook: Handling Events I.......................................................................................................................................12-20 Outlook: Handling Events II......................................................................................................................................12-21 Summary.......................................................................................................................................................................12-22 Appendix.............................................................................................................................................................................13-1 Generating an Extract: Steps.......................................................................................................................................13-2 Example: Generating an Extract.................................................................................................................................13-3 Sorting and Processing an Extract..............................................................................................................................13-4 Example: Control Level Processing...........................................................................................................................13-5 Schema of Control Level Processing for Extracts...................................................................................................13-6 Comparing Internal Tables and Extracts...................................................................................................................13-7 Section: Transaction Programming.................................................................................................................................14-1 Content: Transaction Programming...........................................................................................................................14-2 Course Overview................................................................................................................................................................15-1 Course Goals..................................................................................................................................................................15-2 User Dialogs...................................................................................................................................................................15-3 Course Overview Diagram: BC410...........................................................................................................................15-4 Main Business Scenario...............................................................................................................................................15-5 Data Model.....................................................................................................................................................................15-6 Implementation in the ABAP Dictionary..................................................................................................................15-7 ABAP Program Types..................................................................................................................................................15-8 Program Organization...................................................................................................................................................15-9 Basics for Interactive Lists...............................................................................................................................................16-1 Overview Diagram........................................................................................................................................................16-2 Creating Lists: Overview............................................................................................................................................16-3 Selection Screen.............................................................................................................................................................16-4 Entering Value Ranges.................................................................................................................................................16-5 Defining and Calling Selection Screens....................................................................................................................16-6 Events: Selection Screen..............................................................................................................................................16-7 Events: Executable Program / Basic List..................................................................................................................16-8 User Dialogs on Lists....................................................................................................................................................16-9 Events: Detail List.......................................................................................................................................................16-10 Potential Problems.......................................................................................................................................................16-11 Placing Global Data in the Hide Area......................................................................................................................16-12 Retrieving Data From the Hide Area.......................................................................................................................16-13 Valid Line Selection....................................................................................................................................................16-14 Interactive Lists: Unit Summary...............................................................................................................................16-15 Basics for Interactive Lists: Exercises.....................................................................................................................16-16 Basics for Interactive Lists: Solutions.....................................................................................................................16-18 The Program Interface.......................................................................................................................................................17-1 Overview Diagram........................................................................................................................................................17-2 User Interfaces: Overview...........................................................................................................................................17-3 Overview: The Screen..................................................................................................................................................17-4 GUI Title.........................................................................................................................................................................17-5 Status: Technical View (1)...........................................................................................................................................17-6 Status: Technical View (2)...........................................................................................................................................17-7 Functions.........................................................................................................................................................................17-8 Function Key Settings...................................................................................................................................................17-9 Menus and Menu Bars................................................................................................................................................17-10 User Interfaces: Creating a GUI status....................................................................................................................17-11 Creating a GUI status..................................................................................................................................................17-12 Adjusting Statuses.......................................................................................................................................................17-13 Including Existing Elements......................................................................................................................................17-14 Creating a GUI Status: Function Key Settings.......................................................................................................17-15 Standard Toolbar: Automatic Assignments............................................................................................................17-16 Creating a GUI Status: Application Toolbar..........................................................................................................17-17 Creating a GUI Status: Menu Bar.............................................................................................................................17-18 User Interfaces: Using a GUI status.........................................................................................................................17-19 Activating Title and Status.........................................................................................................................................17-20 Event: AT USER-COMMAND................................................................................................................................17-21 User Interfaces: Unit Summary.................................................................................................................................17-22 The Program Interface: Exercises.............................................................................................................................17-23 The Program Interface: Solutions.............................................................................................................................17-25 Interactive List Techniques..............................................................................................................................................18-1 Overview Diagram........................................................................................................................................................18-2 Flow Control in Details Lists......................................................................................................................................18-3 Selecting Multiple Lines..............................................................................................................................................18-4 Selecting Multiple Lines..............................................................................................................................................18-5 Reading From the List Buffer.....................................................................................................................................18-6 Changing the List Buffer..............................................................................................................................................18-7 Sorting lists.....................................................................................................................................................................18-8 Sorting lists.....................................................................................................................................................................18-9 Finding Out the Sort Field .........................................................................................................................................18-10 Sorting Lists: Program................................................................................................................................................18-11 Controlling the List Sequence and Messages.........................................................................................................18-12 List Navigation.............................................................................................................................................................18-13 Messages in Interactive Lists.....................................................................................................................................18-14 Topic Summary............................................................................................................................................................18-15 Interactive List Techniques: Exercises....................................................................................................................18-16 Interactive List Techniques: Solutions.....................................................................................................................18-18 Introduction to Screen Programming..............................................................................................................................19-1 Overview Diagram........................................................................................................................................................19-2 Screen Programming: Principles.................................................................................................................................19-3 Strengths of Screens......................................................................................................................................................19-4 Screens in Dialog Programs.........................................................................................................................................19-5 Screen Programs: Screen Objects..............................................................................................................................19-6 Screen Objects................................................................................................................................................................19-7 General Attributes.........................................................................................................................................................19-8 Attributes of Screen Objects (Key)............................................................................................................................19-9 Dynamically Modifiable Static Attributes..............................................................................................................19-10 Screen Programs: Screen Modifications................................................................................................................19-11 The System Table SCREEN......................................................................................................................................19-12 Modifying Attributes Dynamically: Example........................................................................................................19-13 Object Attributes: Modification Groups..................................................................................................................19-14 Modifying Attributes Dynamically: Program.........................................................................................................19-15 Screen Programs: Screen Processing......................................................................................................................19-16 Screens...........................................................................................................................................................................19-17 Screen: Definition and Use........................................................................................................................................19-18 Screen: Attributes........................................................................................................................................................19-19 Creating Screen............................................................................................................................................................19-20 Creating a Screen: Screen Attributes.......................................................................................................................19-21 Creating a Screen: Element List:..............................................................................................................................19-22 Creating a Screen: Layout..........................................................................................................................................19-23 Creating a Screen: Flow Logic..................................................................................................................................19-24 Communication: Screen - ABAP Program.............................................................................................................19-25 Static Screen Sequence...............................................................................................................................................19-26 Setting the Next Screen Dynamically......................................................................................................................19-27 Inserting a Sequence of Screens Dynamically .......................................................................................................19-28 Calling a Dialog Box Dynamically ..........................................................................................................................19-29 Window Coordinates..................................................................................................................................................19-30 Setting the Cursor Position Dynamically................................................................................................................19-31 Screen Programs: GUI Status for Screens.............................................................................................................19-32 GUI Status for Screens...............................................................................................................................................19-33 Display Standards........................................................................................................................................................19-34 Processing the Function Code...................................................................................................................................19-35 Screen Programming: Summary.............................................................................................................................19-36 Introduction to Screen Programming: Exercises....................................................................................................19-37 Introduction to Screen Programming: Solutions....................................................................................................19-39 Screen Elements for Output.............................................................................................................................................20-1 Overview Diagram........................................................................................................................................................20-2 Output Elements: Text Fields.....................................................................................................................................20-3 Text Fields......................................................................................................................................................................20-4 Text Field: Attributes....................................................................................................................................................20-5 Creating Text Fields......................................................................................................................................................20-6 Hiding a Text Field Dynamically ...............................................................................................................................20-7 Dynamically Modifiable Attributes: Text Field.......................................................................................................20-8 Dynamic Screen Modifications: Program.................................................................................................................20-9 Output Elements: Status Icons.................................................................................................................................20-10 Status Icons...................................................................................................................................................................20-11 Status Icons: Attributes...............................................................................................................................................20-12 Creating Status Icons..................................................................................................................................................20-13 Filling a Status Icon....................................................................................................................................................20-14 Output Elements: Group Boxes...............................................................................................................................20-15 Group Boxes.................................................................................................................................................................20-16 Group Box: Attributes................................................................................................................................................20-17 Creating Group Boxes................................................................................................................................................20-18 Output Elements: Unit Summary.............................................................................................................................20-19 Screen Elements for Input/Output...................................................................................................................................21-1 Overview Diagram........................................................................................................................................................21-2 Input/Output Elements: Input/Output Fields............................................................................................................21-3 Input/Output Fields.......................................................................................................................................................21-4 Input/Output Fields: Attributes...................................................................................................................................21-5 Creating Input/Output Fields.......................................................................................................................................21-6 Default Values in SAP Memory.................................................................................................................................21-7 Defining SET/GET Parameter Attributes..................................................................................................................21-8 Automatic Field Input Checks.....................................................................................................................................21-9 Field Input Checks with Error Dialog......................................................................................................................21-10 Checking Groups of Fields........................................................................................................................................21-11 Controlling Error Dialogs..........................................................................................................................................21-12 Dialog Message Categories.......................................................................................................................................21-13 The FIELD Statement and Data Transport.............................................................................................................21-14 Conditional Module Calls ..........................................................................................................................................21-15 Execution on Input......................................................................................................................................................21-16 Execution on Change..................................................................................................................................................21-17 Avoiding the Field Input Checks..............................................................................................................................21-18 Navigation - Targets....................................................................................................................................................21-19 Navigation - Dialogs...................................................................................................................................................21-20 Input/Output Elements: Input Help..........................................................................................................................21-21 Input Help.....................................................................................................................................................................21-22 Dropdown List Boxes.................................................................................................................................................21-23 Requirements of F4 Help...........................................................................................................................................21-24 ABAP Dictionary Object: Search Help...................................................................................................................21-25 Using Search Helps.....................................................................................................................................................21-26 Search Help Assignment in ABAP Dictionary ......................................................................................................21-27 Overview: Input Help Mechanisms..........................................................................................................................21-28 Input/Output Elements: Checkboxes and Radio Button Groups........................................................................21-29 Checkboxes and Radio Button Groups....................................................................................................................21-30 Radio Buttons and Checkboxes: Attributes............................................................................................................21-31 Creating a Checkbox...................................................................................................................................................21-32 Creating a Radio Button Group.................................................................................................................................21-33 Input/Output Elements: Pushbuttons......................................................................................................................21-34 Pushbuttons...................................................................................................................................................................21-35 Pushbuttons: Attributes..............................................................................................................................................21-36 Creating Pushbuttons..................................................................................................................................................21-37 Pushbutton Processing................................................................................................................................................21-38 Input/Output Objects: Summary..............................................................................................................................21-39 Screen Elements for Input/Output: Exercises.........................................................................................................21-40 Screen Elements for Input/Output: Solutions.........................................................................................................21-43 Screen Elements: Subscreens and Tabstrip Controls...................................................................................................22-1 Overview Diagram VIII...............................................................................................................................................22-2 Subscreen........................................................................................................................................................................22-3 Subscreen (1)..................................................................................................................................................................22-4 Subscreen (2)..................................................................................................................................................................22-5 Subscreen Area: Attributes..........................................................................................................................................22-6 Creating a Subscreen Area...........................................................................................................................................22-7 Calling a Subscreen.......................................................................................................................................................22-8 Subscreens From External Programs .........................................................................................................................22-9 Subscreens: Encapsulation in Function Groups.....................................................................................................22-10 Subscreens in Function Groups: Call Sequence.....................................................................................................22-11 Subscreens in Function Groups: Data Transport...................................................................................................22-12 Tabstrip Control...........................................................................................................................................................22-13 Screen Element: Tabstrip Control............................................................................................................................22-14 Tabstrip Elements........................................................................................................................................................22-15 Tab Page: Technical View.........................................................................................................................................22-16 Tabstrip Control: Attributes.......................................................................................................................................22-17 Creating a Tabstrip Control.......................................................................................................................................22-18 Creating a Tabstrip Control: Tabstrip Area............................................................................................................22-19 Creating a Tabstrip Control: Tab Title.....................................................................................................................22-20 Creating a Tabstrip Control: Tabstrip Subscreens.................................................................................................22-21 Scrolling Locally in a Tabstrip Control...................................................................................................................22-22 Scrolling Locally in a Tabstrip Control: Coding....................................................................................................22-23 Scrolling in Tabstrip Controls...................................................................................................................................22-24 Scrolling in Tabstrip Controls: Coding....................................................................................................................22-25 Tabstrip Control on the Selection Screen................................................................................................................22-26 Selection Screens as Subscreens...............................................................................................................................22-27 Defining A Tabstrip Control on the Selection Screen...........................................................................................22-28 Selection Screen as a Subscreen on the Screen......................................................................................................22-29 Subscreen and Tabstrip Control: Unit Summary..................................................................................................22-30 Subscreen and Tabstrip Control: Exercises.............................................................................................................22-31 Subscreen and Tabstrip Control: Solutions.............................................................................................................22-34 Screen Element: Table Controls......................................................................................................................................23-1
Description: