Rich Heilman and Thomas Jung Next Generation ABAP™ Development Bonn � Boston 352 Book.indb 3 12/6/10 2:59:43 PM Contents at a Glance 1 Workbench Tools and Package Hierarchy ............................... 29 2 New Language Features in SAP NetWeaver 7.02 ................... 57 3 Data Dictionary Objects ......................................................... 85 4 Data Persistence Layer ........................................................... 113 5 Consuming a Web Service ...................................................... 163 6 Shared Memory Objects ......................................................... 191 7 Model Class ............................................................................ 215 8 ABAP and SAP NetWeaver Master Data Management .......... 245 9 ABAP Troubleshooting ............................................................ 275 10 Exposing a Model as a Web Service ....................................... 305 11 XML Processing and XSLT ...................................................... 357 12 Classic Dynpro UI/ALV Object Model ..................................... 383 13 Web Dynpro ABAP .................................................................. 415 14 Advanced Web Dynpro ABAP ................................................. 459 15 Business Server Pages ............................................................ 525 16 Rich Islands ............................................................................ 555 17 Adobe Forms ........................................................................... 573 18 SAP NetWeaver Portal and SAP NetWeaver Business Client ... 609 19 RSS Feed Using an ICF Service Node ...................................... 663 20 SAP Business Objects .............................................................. 679 21 Closing .................................................................................... 717 A CD Contents ............................................................................ 721 B The Authors ............................................................................. 725 352 Book.indb 5 12/6/10 2:59:43 PM Contents Introduction ............................................................................................... 1 7 1 Workbench Tools and Package Hierarchy ................................ 2 9 1.1 Log on and Explore ..................................................................... 3 0 1.1.1 Workbench Object Browser ............................................ 3 0 1.1.2 Object Browser List ........................................................ 3 1 1.1.3 Workbench Settings ....................................................... 3 4 1.1.4 New ABAP Editor ........................................................... 3 4 1.1.5 Additional New Workbench Tools .................................. 4 0 1.1.6 Debugger ....................................................................... 4 8 1.2 Package Hierarchy for the Project ................................................ 5 2 1.2.1 Project Requirements ..................................................... 5 3 1.2.2 Package Hierarchy .......................................................... 5 3 2 New Language Features in SAP NetWeaver 7.02 ..................... 5 7 2.1 Extended Expressions .................................................................. 5 9 2.1.1 Math .............................................................................. 5 9 2.1.2 Functional Method Calls ................................................ 6 0 2.1.3 Built-In Functions ........................................................... 6 1 2.1.4 Boolean – BOOLC .......................................................... 6 2 2.2 String Processing ......................................................................... 6 3 2.2.1 String Templates ............................................................. 6 3 2.2.2 String Functions ............................................................. 6 6 2.2.3 12-Hour Time Format ..................................................... 6 7 2.3 Boxed Components ..................................................................... 6 8 2.4 Decimal Floating Point ................................................................ 7 1 2.5 Locators and Streams .................................................................. 7 2 2.5.1 Streams .......................................................................... 7 4 2.5.2 Locators ......................................................................... 7 8 2.6 Resumable Exceptions ................................................................ 7 9 2.7 Secondary Keys for Internal Tables .............................................. 8 1 7 352 Book.indb 7 12/6/10 2:59:43 PM Contents 3 Data Dictionary Objects ........................................................... 8 5 3.1 Designing Data Relationships ...................................................... 8 5 3.1.1 Table Relationship Graphic ............................................. 8 7 3.1.2 SAP Data Modeler ......................................................... 8 8 3.2 Data Dictionary Fixed Value Domains ......................................... 8 9 3.2.1 Single Value Domains ..................................................... 9 0 3.2.2 Interval Value Domains .................................................. 9 1 3.3 Data Dictionary Text Tables ......................................................... 9 2 3.3.1 Data Elements and Domains .......................................... 9 2 3.3.2 Transparent Table Creation and Relationships ................. 9 3 3.3.3 Maintenance View ......................................................... 9 8 3.3.4 Generated Table Maintenance ........................................ 100 3.4 Data Dictionary Data Tables ........................................................ 102 3.4.1 Enhancements ................................................................ 103 3.4.2 Indexes .......................................................................... 104 3.4.3 Lock Objects .................................................................. 107 3.5 Search Helps ............................................................................... 108 4 Data Persistence Layer ............................................................. 113 4.1 Persistent Objects ....................................................................... 114 4.1.1 Creating the Persistent Object Class ............................... 115 4.1.2 Base Classes and Agent Classes ....................................... 117 4.1.3 Persistent Data Mapper .................................................. 118 4.1.4 Coding with a Persistent Object ..................................... 121 4.2 Exception Classes ........................................................................ 123 4.2.1 Advantages of Exception Classes .................................... 124 4.2.2 Creating an Exception Class ............................................ 125 4.3 Business Object Classes ............................................................... 131 4.3.1 What Is a Business Object Class? .................................... 131 4.3.2 Business Object Class Structure ...................................... 133 4.3.3 Multiple Object Selection ............................................... 138 4.3.4 Select-Options as a Query Criteria .................................. 140 4.3.5 Complex Business Objects .............................................. 143 4.3.6 Modification Operations ................................................ 146 4.3.7 ZIP Compression ............................................................ 149 4.4 Data Load Programs .................................................................... 152 8 352 Book.indb 8 12/6/10 2:59:43 PM Contents 4.4.1 Test Data Generator ....................................................... 152 4.4.2 Backup and Recovery Program ....................................... 156 5 Consuming a Web Service ........................................................ 163 5.1 Proxy Generation ........................................................................ 165 5.1.1 Accessing the WSDL Document ..................................... 165 5.1.2 Creating the Client Proxy ................................................ 166 5.1.3 Logical Ports ................................................................... 172 5.1.4 Using the Client Proxy Object ......................................... 176 5.1.5 Implementing into the Business Object Layer ................. 177 5.2 Logical Ports ............................................................................... 180 5.2.1 Consumer Security ......................................................... 180 5.2.2 Messaging ...................................................................... 184 5.2.3 Transport Settings .......................................................... 184 5.2.4 Operation Specific .......................................................... 186 5.2.5 Errors ............................................................................. 187 5.3 Extended Protocols ..................................................................... 189 6 Shared Memory Objects ........................................................... 191 6.1 Getting Started ........................................................................... 192 6.1.1 Area Root Class Creation ................................................ 192 6.1.2 Defining the Shared Memory Area ................................. 198 6.1.3 Testing the Shared Memory Object ................................ 200 6.1.4 Shared Memory Monitor ................................................ 202 6.2 Automatic Preloading ................................................................. 203 6.2.1 Adding the Interface ...................................................... 203 6.2.2 Modifying the Read Program .......................................... 205 6.3 Implementing into the Business Object Layer .............................. 206 6.3.1 Developing a Test Program ............................................. 207 6.3.2 Modifying the Business Object Class .............................. 208 6.3.3 Testing the Changes ....................................................... 212 7 Model Class .............................................................................. 215 7.1 Class Overview ........................................................................... 215 7.1.1 What Is Model View Controller? .................................... 215 9 352 Book.indb 9 12/6/10 2:59:43 PM Contents 7.1.2 Creating the Model Class ................................................ 216 7.2 Transactional Methods ................................................................ 221 7.2.1 Read Method ................................................................. 222 7.2.2 Record Locking Methods ................................................ 224 7.2.3 Save Method .................................................................. 225 7.2.4 Getters ........................................................................... 227 7.3 Utility Methods .......................................................................... 229 7.4 Emailing ...................................................................................... 231 7.4.1 Email Setup .................................................................... 231 7.4.2 Running an Email Test .................................................... 235 7.4.3 Email Method ................................................................ 237 7.5 Regular Expressions .................................................................... 242 8 ABAP and SAP NetWeaver Master Data Management ........... 245 8.1 What Is Master Data Management? ............................................ 246 8.1.1 Technical Architecture .................................................... 246 8.1.2 Clients ............................................................................ 248 8.1.3 Basic SAP NetWeaver MDM Administration ................... 250 8.1.4 Modeling in SAP MDM .................................................. 252 8.2 Configuring the SAP NetWeaver MDM ABAP API ....................... 254 8.2.1 Installation of the SAP NetWeaver MDM API Add-On ... 254 8.2.2 Configuring the SAP NetWeaver MDM API Connection ... 256 8.2.3 Authentication with the SAP NetWeaver MDM API ....... 258 8.3 Coding with the SAP NetWeaver MDM ABAP API ...................... 260 8.3.1 Class-Based API .............................................................. 260 8.3.2 Function-Module-Based API .......................................... 263 8.3.3 Non-Unicode ABAP Systems .......................................... 265 8.3.4 Simple Read ................................................................... 265 8.3.5 Full Read ........................................................................ 269 8.3.6 Integrating the SAP NetWeaver MDM Repository into Your Business Object Class ...................................... 271 9 ABAP Troubleshooting .............................................................. 275 9.1 ABAP Unit .................................................................................. 275 9.1.1 Overview of ABAP Unit Tests ......................................... 276 9.1.2 Creating ABAP Unit Tests ............................................... 281 9.1.3 Executing the ABAP Unit Test ......................................... 288 10 352 Book.indb 10 12/6/10 2:59:43 PM Contents 9.2 Runtime Analysis ........................................................................ 290 9.2.1 Running an Evaluation ................................................... 290 9.2.2 Evaluating the Results .................................................... 291 9.3 Performance Analysis Tool ........................................................... 293 9.4 ABAP Debugger .......................................................................... 295 9.4.1 New Debugger Introduction ........................................... 295 9.4.2 Diff ................................................................................ 298 9.4.3 Table Tools ..................................................................... 299 9.4.4 Layered Debugging ........................................................ 301 10 Exposing a Model as a Web Service ......................................... 305 10.1 Inside-Out Approach .................................................................. 306 10.1.1 Service Definition Wizard ............................................... 307 10.1.2 Service Definition ........................................................... 313 10.1.3 Releasing the Web Service and Creating an Endpoint ..... 317 10.1.4 Testing the Web Service ................................................. 324 10.1.5 Using the Web Services Navigator .................................. 325 10.2 Outside-In Approach .................................................................. 329 10.2.1 Modeling a Service in the SAP Enterprise Services Repository ...................................................................... 330 10.2.2 Integration Builder ......................................................... 331 10.2.3 Simple Data Types .......................................................... 335 10.2.4 Complex Data Types ....................................................... 340 10.2.5 Message Types ............................................................... 343 10.2.6 Service Interface ............................................................. 344 10.2.7 Implementing the Service as a Server Proxy .................... 346 10.2.8 Creating a Service Definition .......................................... 352 11 XML Processing and XSLT ........................................................ 357 11.1 Simple Transformations ............................................................... 358 11.2 XSL Transformations .................................................................... 363 11.3 iXML Library ............................................................................... 368 11.4 Mini iXML Interface .................................................................... 375 12 Classic Dynpro UI/ALV Object Model ....................................... 383 12.1 ALV Object Model Overview ...................................................... 383 11 352 Book.indb 11 12/6/10 2:59:43 PM Contents 12.1.1 ALV Tool Overview ......................................................... 384 12.1.2 Display Types ................................................................. 385 12.2 Getting Started ........................................................................... 386 12.2.1 Package Selection ........................................................... 386 12.2.2 Basic Program Coding ..................................................... 387 12.3 Modifying the ALV Output ......................................................... 393 12.3.1 ALV Functions ................................................................ 393 12.3.2 Modifying Column Attributes ......................................... 396 12.3.3 Modifying Display Settings ............................................. 397 12.3.4 Saving Layout Variants ................................................... 398 12.4 Making the ALV Interactive ......................................................... 399 12.4.1 Adding Buttons .............................................................. 400 12.4.2 Defining Selections ......................................................... 401 12.4.3 Event Handling ............................................................... 402 12.5 Object Orientation with Classic Dynpro ...................................... 405 12.5.1 Restructuring the Dialog Program ................................... 406 12.5.2 Creating the Controller Class .......................................... 408 12.5.3 Enjoy Control Events ...................................................... 410 12.5.4 Dynpro Events ................................................................ 412 13 Web Dynpro ABAP .................................................................... 415 13.1 Overview of the Components ..................................................... 416 13.1.1 Course Frame Component .............................................. 417 13.1.2 Faculty Detail Component .............................................. 418 13.1.3 Faculty List Component .................................................. 419 13.1.4 Course Details Component ............................................. 420 13.2 Component Usage ...................................................................... 421 13.3 General UI Features .................................................................... 424 13.3.1 Context .......................................................................... 424 13.3.2 Value Help ..................................................................... 425 13.3.3 Required Fields .............................................................. 428 13.3.4 Change/Display Mode .................................................... 431 13.4 ALV Component ......................................................................... 433 13.4.1 ALV Component Usage .................................................. 433 13.4.2 Context Mapping ........................................................... 434 13.4.3 ALV Implementation ...................................................... 435 13.5 Dialog Pop-Up Window .............................................................. 439 13.5.1 Windows from the Same Component ............................. 439 12 352 Book.indb 12 12/6/10 2:59:43 PM Contents 13.5.2 Windows from an External Component Usage ................ 442 13.6 Table Popins ............................................................................... 446 13.6.1 What Is a Table Popin? ................................................... 446 13.6.2 Designing the Table Popin .............................................. 447 13.6.3 Context Design .............................................................. 448 13.6.4 Logic to Populate the Context for a Popin ...................... 449 13.7 File Upload/Download ................................................................ 450 13.7.1 File Downloads .............................................................. 451 13.7.2 File Uploads ................................................................... 453 13.8 Web Dynpro Debugger ............................................................... 455 14 Advanced Web Dynpro ABAP ................................................... 459 14.1 Drag and Drop ............................................................................ 459 14.1.1 Table Hierarchy .............................................................. 460 14.1.2 Drag-and-Drop Basics in Web Dynpro ABAP .................. 463 14.1.3 Drag-and-Drop UI Elements and Properties .................... 463 14.1.4 Drag-and-Drop Event Coding ......................................... 466 14.2 Threshold Slider and Rule Evaluation .......................................... 470 14.2.1 BRFplus Usage ............................................................... 471 14.2.2 Data-Dependent Drop-Down List Box ............................ 480 14.2.3 Threshold Slider Usage ................................................... 482 14.3 Notification Service ..................................................................... 484 14.4 POWL—Power List ..................................................................... 487 14.4.1 POWL Feeder Classes ..................................................... 488 14.4.2 POWL Cockpit ............................................................... 497 14.5 FPM—Floorplan Manager ........................................................... 500 14.5.1 Floorplan Types .............................................................. 501 14.5.2 Generic UI Building Blocks ............................................. 508 14.5.3 Freestyle UI Building Blocks ........................................... 517 14.5.4 Final Configuration ......................................................... 519 15 Business Server Pages .............................................................. 525 15.1 Internet-Facing BSP Application .................................................. 526 15.1.1 Stateless versus Stateful .................................................. 526 15.1.2 Application Layout ......................................................... 528 15.1.3 Custom Style Sheets ....................................................... 530 13 352 Book.indb 13 12/6/10 2:59:44 PM Contents 15.1.4 Course Overview Page .................................................... 534 15.1.5 AJAX .............................................................................. 536 15.2 BSP Extensions ............................................................................ 544 15.2.1 Upload of Open Source Solution .................................... 544 15.2.2 Creating the BSP Extension ............................................. 546 15.2.3 Creating the BSP Extension Element ............................... 547 15.2.4 Design Time Validation .................................................. 550 15.2.5 Runtime Validation ........................................................ 551 15.2.6 Element Rendering ......................................................... 552 15.2.7 Testing the New Extension ............................................. 553 16 Rich Islands .............................................................................. 555 16.1 Islands Architecture .................................................................... 556 16.1.1 Behind the Scenes .......................................................... 557 16.1.2 Type of Islands ............................................................... 558 16.1.3 Limitations of Islands ..................................................... 559 16.2 Building a Flex Component ......................................................... 560 16.2.1 Islands Libraries .............................................................. 561 16.2.2 Flex Code Initialization ................................................... 564 16.2.3 Flex Code Data Binding .................................................. 565 16.2.4 Flex Code Setters ........................................................... 566 16.2.5 Flex Code Events ............................................................ 567 16.3 Embedding the Island in Web Dynpro ......................................... 567 16.3.1 Flex Component Added to MIME Repository ................. 567 16.3.2 FlashIsland UI Element ................................................... 568 16.3.3 DataSource Mapping ...................................................... 569 16.3.4 DataSource Property Mapping ....................................... 570 17 Adobe Forms ............................................................................. 573 17.1 Infrastructure and Setup ............................................................. 574 17.1.1 Adobe Document Services Infrastructure ........................ 574 17.1.2 Exposing the Service from the Java Engine ...................... 575 17.2 Function-Module-Based Forms ................................................... 582 17.2.1 Creating the Interface ..................................................... 583 17.2.2 Form Interface to Context Mapping ............................... 584 17.2.3 Form Layout Editor ........................................................ 589 17.2.4 Coding Against the Form Function Module .................... 592 14 352 Book.indb 14 12/6/10 2:59:44 PM
Description: