BC ABAP Programming PHẦN 1 pptx

155 324 0
BC ABAP Programming PHẦN 1 pptx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

BC ABAP Programming Release 4.6B HELP.BCABA BC - ABAP Programming SAP AG 2 December 1999 Copyright © Copyright 2001 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft ® , WINDOWS ® , NT ® , EXCEL ® , Word ® , PowerPoint ® and SQL Server ® are registered trademarks of Microsoft Corporation. IBM ® , DB2 ® , OS/2 ® , DB2/6000 ® , Parallel Sysplex ® , MVS/ESA ® , RS/6000 ® , AIX ® , S/390 ® , AS/400 ® , OS/390 ® , and OS/400 ® are registered trademarks of IBM Corporation. ORACLE ® is a registered trademark of ORACLE Corporation. INFORMIX ® -OnLine for SAP and Informix ® Dynamic Server TM are registered trademarks of Informix Software Incorporated. UNIX ® , X/Open ® , OSF/1 ® , and Motif ® are registered trademarks of the Open Group. HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C ® , World Wide Web Consortium, Massachusetts Institute of Technology. JAVA ® is a registered trademark of Sun Microsystems, Inc. JAVASCRIPT ® is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. SAP, SAP Logo, R/2, RIVA, R/3, ABAP, SAP ArchiveLink, SAP Business Workflow, WebFlow, SAP EarlyWatch, BAPI, SAPPHIRE, Management Cockpit, mySAP.com Logo and mySAP.com are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other products mentioned are trademarks or registered trademarks of their respective companies. SAP AG BC - ABAP Programming December 1999 3 Icons Icon Meaning Caution Example Note Recommendation Syntax Tip BC - ABAP Programming SAP AG 4 December 1999 Contents BC - ABAP Programming 17 Introduction to ABAP 19 The R/3 Basis System: Overview 20 Position of the Basis System Within the R/3 System 21 Application Servers 27 Work Processes 32 Overview of the Components of Application Programs 37 Structure of an Application Program 38 Screens 40 Structure of ABAP Programs 44 Processing Blocks in ABAP Programs 49 ABAP Statements 56 Logical Databases and Contexts 60 Memory Structures of an ABAP Program 66 Creating and Changing ABAP Programs 68 Opening a Program from the Repository Browser 70 Opening Programs in the ABAP Editor 73 Opening Programs Using Forward Navigation 74 Maintaining Program Attributes 75 Editing Programs 79 The ABAP Programming Language 82 ABAP Syntax 83 Types and Objects 87 Basic Statements 90 Data Types and Data Objects 91 Data Types 92 Defining Data Types 96 Predefined ABAP Types 97 Local Data Types in Programs 100 Data Types in the ABAP Dictionary 105 The TYPE Addition 113 The LIKE Addition 117 Data Objects 119 Literals 120 Text Symbols 122 Variables 124 Constants 130 Interface Work Areas 131 Predefined Data Objects 133 Compatibility 134 Determining the Attributes of Data Objects 136 Examples of Data Types and Objects 141 Processing Data 144 Assigning Values 145 SAP AG BC - ABAP Programming December 1999 5 Assigning Values with MOVE 146 Assigning Values with WRITE TO 149 Resetting Values to Their Initial Value 151 Numerical Operations 152 Arithmetic Calculations 153 Mathematical Functions 157 Business Calculations 159 Date and Time Calculations 160 Processing Character Strings 162 Shifting Field Contents 163 Replacing Field Contents 166 Converting to Upper or Lower Case or Replacing Characters 168 Converting into a Sortable Format 169 Overlaying Character Fields 170 Finding Character Strings 171 Finding the Length of a Character String 174 Condensing Field Contents 175 Concatenating Character Strings 176 Splitting Character Strings 177 Assigning Parts of Character Strings 178 Single Bit Processing in Hexadecimal Fields 179 Setting and Reading Bits 180 Bit Operations 182 Set Operations Using Bit Sequences 184 Type Conversions 187 Conversion Rules for Elementary Data Types 188 Conversion Rules for References 192 Conversion Rules for Structures 193 Conversion Rules for Internal Tables 195 Alignment of Data Objects 196 Processing Sections of Strings 197 Field Symbols and Data References 201 Field Symbols 202 Defining Field Symbols 204 Assigning Data Objects to Field Symbols 208 Basic Form of the ASSIGN Statement 209 Assigning Components of Structures to a Field Symbol 214 Defining the Data Type of a Field Symbol 216 Data Areas for Field Symbols 218 Data References 220 Reference Variables 221 Creating Data Objects Dynamically 222 Getting References to Data Objects 223 Dereferencing Data References 224 Data References: Example 225 BC - ABAP Programming SAP AG 6 December 1999 Logical Expressions 226 Comparisons Between Different Data Types 227 Comparing Strings 231 Comparing Bit Sequences 234 Checking Whether a Field Belongs to a Range 236 Checking for the Initial Value 237 Checking Selection Criteria 238 Checking Whether a Field Symbol is Assigned 239 Combining Several Logical Expressions 240 Controlling the Program Flow 241 Branching Conditionally 243 Loops 246 Processing Large Volumes of Data 251 Internal tables 252 Creating Internal Tables 255 Internal table types 256 Internal table objects 260 Special Features of Standard Tables 262 Processing Internal Tables 264 Operations on Entire Internal Tables 265 Assigning Internal Tables 266 Initializing Internal Tables 268 Comparing Internal Tables 270 Sorting Internal Tables 272 Internal Tables as Interface Parameters 277 Determining the Attributes of Internal Tables 278 Operations on Individual Lines 279 Operations for all Table Types 282 Inserting Lines into Tables 283 Appending Summarized Lines 286 Reading Lines of Tables 288 Changing Lines 293 Deleting Lines 296 Processing Table Entries in Loops 300 Operations for Index Tables 307 Appending Table Lines 308 Inserting Lines Using the Index 312 Reading Lines Using the Index 315 Binary Search in Standard Tables 316 Finding Character Strings in Internal Tables 317 Changing Table Lines Using the Index 319 Deleting Lines Using the Index 322 Specifying the Index in Loops 325 Access Using Field Symbols 327 Using Header Lines as Work Areas 329 SAP AG BC - ABAP Programming December 1999 7 Extracts 332 Defining an Extract 333 Filling an Extract with Data 335 Processing Extracts 337 Reading an Extract 338 Sorting an Extract 341 Processing Control Levels 344 Calculating Numbers and Totals 348 Formatting Data 351 Example of Formatted Data 352 Formatting Data During Reading 354 Refining Data Using Internal Tables 356 Formatting Data Using Extracts 360 Saving Data Externally 362 Saving Data Objects as Clusters 363 Data Clusters in ABAP Memory 364 Saving Data Objects in Memory 365 Reading Data Objects from Memory 366 Deleting Data Clusters from Memory 368 Data Clusters in the Database 369 Cluster Databases 370 Structure of a Cluster Database 371 Example of a Cluster Database 373 Saving Data Objects in Cluster Databases 375 Creating a Directory of a Data Cluster 377 Reading Data Objects From Cluster Databases 379 Deleting Data Clusters from Cluster Databases 381 Open SQL Statements and Cluster Databases 383 Working with Files 385 Working with Files on the Application Server 386 File Handling in ABAP 387 Opening a File 388 Basic Form of the OPEN DATASET Statement 389 Opening a File for Read Access 390 Opening a File for Write Access 391 Opening a File for Appending Data 394 Using Binary Mode 396 Using Text Mode 398 Opening a File at a Given Position 400 Executing Operating System Commands 402 Receiving Operating System Messages 403 Closing a File 404 Deleting a File 405 Writing Data to Files 406 Reading Data from Files 408 BC - ABAP Programming SAP AG 8 December 1999 Automatic Checks in File Operations 410 Authorization Checks for Programs and Files 411 General Checks for File Access 414 Working with Files on the Presentation Server 417 Writing Data to Presentation Server (Dialog) 418 Writing Data to Presentation Server (no Dialog) 421 Reading Data from Presentation Server (Dialog) 424 Reading Data from Presentation Server (no Dialog) 427 Checking Files on the Presentation Server 430 Using Platform-Independent Filenames 433 Maintaining Syntax Groups 434 Assigning Operating Systems to Syntax Groups 435 Creating and Defining Logical Paths 437 Creating and Defining Logical Filenames 439 Using Logical Files in ABAP Programs 440 Modularization Techniques 443 Source Code Modules 445 Macros 446 Include Programs 449 Procedures 451 Subroutines 453 Defining Subroutines 454 Global Data from the Main Program 455 Local Data in the Subroutine 457 The Parameter Interface 461 Terminating Subroutines 466 Calling Subroutines 468 Naming Subroutines 469 Passing Parameters to Subroutines 472 Examples of Subroutines 475 Shared Data Areas 480 Function Modules 483 Function Groups 484 Calling Function Modules 486 Creating Function Modules 492 Organization of External Procedure Calls 498 Special Techniques 500 Catchable Runtime Errors 501 Program Checks 502 Catching Runtime Errors 504 Checking Authorizations 506 Checking User Authorizations 508 Defining an Authorization Check 509 Checking the Runtime of Program Segments 512 GET RUN TIME FIELD 513 Runtime Measurement of Database Accesses 515 SAP AG BC - ABAP Programming December 1999 9 Generating and Running Programs Dynamically 517 Creating a New Program Dynamically 518 Changing Existing Programs Dynamically 520 Running Programs Created Dynamically 521 Creating and Starting Temporary Subroutines 524 ABAP User Dialogs 527 Screens 528 Screen Elements 530 Screen Attributes 531 Screen Elements 532 Screen Fields 534 Screen Flow Logic 537 Processing Screens 539 User Actions on Screens 540 Processing Input/Output Fields 542 Pushbuttons on the Screen 547 Checkboxes and Radio Buttons with Function Codes 550 Using GUI Statuses 553 Reading Function Codes 561 Finding Out the Cursor Position 563 Calling ABAP Dialog Modules 566 Simple Module Calls 568 Controlling the Data Transfer 571 Calling Modules Unconditionally 574 Conditional Module Calls 578 Input Checks 583 Automatic Input Checks 584 Checking Fields in the Screen Flow Logic 587 Input Checks in Dialog Modules 590 Field Help, Input Help, and Dropdown Boxes 595 Field Help 596 Input Help 601 Input Help from the ABAP Dictionary 602 Input Help on the Screen 607 Input Help in Dialog Modules 609 Dropdown Boxes 613 Modifying Screens Dynamically 617 Setting Attributes Dynamically 618 The Field Selection Function 626 Setting the Cursor Position 637 Switching on Hold Data Dynamically 639 Complex Screen Elements 641 Status Icons 642 Context Menus 645 Subscreens 653 BC - ABAP Programming SAP AG 10 December 1999 Tabstrip Controls 660 Custom Controls 668 Table Controls 676 Using the LOOP Statement 678 Looping Through an Internal Table 679 Example Transaction: Table Controls 680 Looping Directly Through a Screen Table 684 How the System Transfers Data Values 686 Using Step Loops 688 Selection Screens 691 Selection Screens and Logical Databases 693 Defining Selection Screens 696 Defining Input Fields for Single Values 699 Basic Form of Parameters 700 Dynamic Dictionary Reference 702 Default Values for Parameters 704 SPA/GPA Parameters as Default Values 705 Allowing Parameters to Accept Upper and Lower Case 706 Reducing the Visible Length 707 Defining Required Fields 708 Search Helps for Parameters 709 Checking Input Values 710 Defining Checkboxes 712 Defining Radio Buttons 713 Hiding Input Fields 715 Modifying Input Fields 716 Defining Complex Selections 718 Selection Tables 719 Basic Form of Selection Criteria 722 Selection Criteria and Logical Databases 727 Default Values for Selection Criteria 729 Restricting Entry to One Row 731 Restricting Entry to Single Fields 732 Additional Options for Selection Criteria 733 Formatting Selection Screens 734 Blank Lines, Underlines, and Comments 735 Several Elements in a Single Line 738 Blocks of Elements 740 Calling Selection Screens 742 Calling Standard Selection Screens 743 Calling User-Defined Selection Screens 745 User Actions on Selection Screens 752 Pushbuttons on the Selection Screen 753 Checkboxes and Radio Buttons with Function Codes 755 Pushbuttons in the Application Toolbar 756 [...]... 11 28 Locking Conflicts 11 34 Changing Data 11 35 Inserting Lines into Tables 11 36 Changing Lines 11 39 Deleting Lines 11 42 Inserting or Changing Lines 11 45 Committing Database Changes 11 47 Performance Notes 11 48 Keep the Result Set Small 11 52 Minimize the Amount of Data Transferred 11 53... R/3 System 10 79 Open SQL 10 82 Reading Data 10 84 Defining Selections 10 87 Specifying a Target Area 10 94 Specifying Database Tables 11 01 Selecting Lines 11 08 Grouping Lines 11 16 Selecting Groups of Lines 11 19 Specifying a Sort Order 11 21 Subqueries 11 24 Using a Cursor... Transfers 11 54 Minimize the Search Overhead 11 56 Reduce the Database Load 11 58 Native SQL 11 61 Native SQL for Oracle 11 66 Native SQL for Informix 11 84 Native SQL for DB2 Common Server 11 99 Logical Databases 12 10 Structure of Logical Databases 12 13 Selection Views 12 20 Example of a Logical... Hints 13 11 Programming Database Updates 13 12 Transactions and Logical Units of Work 13 13 Database Logical Unit of Work (LUW) 13 14 SAP LUW 13 17 SAP Transactions 13 21 The R/3 Lock Concept 13 22 Example Transaction: SAP Locking 13 26 Update Techniques 13 28 Asynchronous Update 13 29 Updating Asynchronously... Function Modules 13 41 Error Handling for Bundled Updates 13 42 ABAP Objects 13 44 December 19 99 15 BC - ABAP Programming SAP AG What is Object Orientation? 13 45 What are ABAP Objects? 13 48 From Function Groups to Objects 13 49 Example 13 52 Classes 13 53 Overview Graphic 13 58 Classes - Introductory... of ABAP Calls 14 21 Call Contexts 14 22 Internal Calls 14 23 External Procedure Calls 14 25 External Program Calls 14 27 Callable Units 14 29 ABAP Programs 14 30 Procedures 14 32 Screens and Screen Sequences 14 34 ABAP Statement Overview 14 37 ABAP System Fields 14 98 ABAP. .. 15 22 Syntax Conventions 15 40 16 December 19 99 SAP AG BC - ABAP Programming BC - ABAP Programming BC - ABAP Programming This documentation describes how to write application programs within the three-tier client/server architecture of the R/3 System Presentation SAP GUI SAP GUI SAP GUI SAP GUI Application ABAP ABAP Database RDBMS R/3 applications are written in the ABAP programming. .. 13 94 Interfaces - Introductory Example 13 95 Triggering and Handling Events 13 97 Overview Graphic 14 00 Events: Introductory Example 14 03 Events in ABAP Objects - Example 14 05 Class Pools 14 11 Appendix 14 14 Programs, Screens, and Processing Blocks 14 15 Introductory Statements for Programs 14 19... Program 12 51 Dynamic Selections in the Database Program 12 58 14 December 19 99 SAP AG BC - ABAP Programming Field Selections in the Database Program 12 62 Search Helps in the Database Program 12 65 Independent Calls and the Database Program 12 69 Editing Other Components 12 70 Improving Performance 12 71 Using Contexts 12 73 What are Contexts?... 10 60 Affecting Lists in Called Programs 10 64 Program Statements to Leave a Called Program 10 66 Calling Transactions 10 68 December 19 99 13 BC - ABAP Programming SAP AG Calling Screen Sequences as Modules 10 69 Passing Data Between Programs 10 73 Filling an Initial Screen using SPA/GPA Parameters 10 74 ABAP Database Access 10 78 Accessing . Area 10 94 Specifying Database Tables 11 01 Selecting Lines 11 08 Grouping Lines 11 16 Selecting Groups of Lines 11 19 Specifying a Sort Order 11 21 Subqueries 11 24 Using a Cursor to Read Data 11 28 Locking. Conflicts 11 34 Changing Data 11 35 Inserting Lines into Tables 11 36 Changing Lines 11 39 Deleting Lines 11 42 Inserting or Changing Lines 11 45 Committing Database Changes 11 47 Performance Notes 11 48 Keep. Hints 13 11 Programming Database Updates 13 12 Transactions and Logical Units of Work 13 13 Database Logical Unit of Work (LUW) 13 14 SAP LUW 13 17 SAP Transactions 13 21 The R/3 Lock Concept 13 22 Example

Ngày đăng: 09/08/2014, 13:22

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan