Controls Tutorial (BC-CI)

Controls Tutorial (BC-CI)

-

Documents
55 pages
Lire
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

Controls Tutorial (BC-CI)Release 4.6CHELP.BCCICTUTControls Tutorial (BC-CI) SAP AGCopyright© Copyright 2001 SAP AG. All rights reserved.No part of this publication may be reproduced or transmitted in any form or for any purposewithout the express permission of SAP AG. The information contained herein may be changedwithout prior notice.Some software products marketed by SAP AG and its distributors contain proprietary softwarecomponents of other software vendors.® ® ® ® ® ® ®Microsoft , WINDOWS , NT , EXCEL , Word , PowerPoint and SQL Server are registeredtrademarks ofMicrosoft 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.TM® ®INFORMIX -OnLine for SAP and Informix Dynamic Server are registered trademarks ofInformix 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 WideWeb 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 fortechnology invented and implemented by Netscape. SAP, SAP Logo, R/2, RIVA, R/3, ABAP, SAP ArchiveLink, SAP Business Workflow, WebFlow,SAP EarlyWatch, ...

Sujets

Informations

Publié par
Nombre de visites sur la page 60
Langue English
Signaler un problème
C
o
n
t
r
o
l
s
R
T
e
l
u
e
a
t
s
o
e
r
i
4
.
a
6
l
C
(
B
C
-
C
I
)
Controls Tutorial (BC-CI)
Copyright
SAP AG
© 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. IABSM/4®D0,0®B2O,®2SS/09O3/,®®06/2BD,00andOS/40®,0®raPlSyallexsplea®SEAVM/Sfosk,rameda®6/o00rp,SCoRM0BI®,nXiAoIatr®.S/,039®, , re registered tr ORACLE®is a registered trademark of ORACLE Corporation. INFORMIX®-OnLine for SAP and Informix®Dynamic ServerTMare 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.
2
April 2001
SAP AG
Icons
Icon
April 2001
Meaning
Caution
Example
Note
Recommendation
Syntax
Controls Tutorial (BC-CI)
3
Controls Tutorial (BC-CI)
Contents
SAP AG
Controls Tutorial (BC-CI) ................................................................................... 5 BC - Component Integration: Controls Tutorial .......................................................................... 6 NotestotheUser............................................................................................................................6 Prerequisites.....................................................................................................................................7 System Configuration ....................................................................................................................... 7 Architecture ...................................................................................................................................... 9 Lesson 1: Creating a Custom Control........................................................................................ 12 Introduction.....................................................................................................................................13 Exercise 1: Reserving an Area for a Control.................................................................................. 14 Exercise 2: Creating a Control and its Container ........................................................................... 16 Exercise 3: Calling Methods of the Control .................................................................................... 19 Summary ........................................................................................................................................ 20 Lesson 2: Event Handling ........................................................................................................... 21 Introduction.....................................................................................................................................24 Exercise 1: Writing an Event Handler Method ............................................................................... 26 Exercise 2: Registering an Application Event ................................................................................ 28 Exercise 3: Registering a System Event ........................................................................................ 29 Exercise 4: Responding to an Event .............................................................................................. 31 Summary ........................................................................................................................................ 33 Lesson 3: Flush Optimization ..................................................................................................... 34 Introduction.....................................................................................................................................35 Exercise 1: Using Imported Values ................................................................................................ 38 Exercise 2: Value Passing Between Methods................................................................................ 42 Exercise 3: Control Methods in Subroutines .................................................................................. 46 Exercise 4: Using Multiple Controls ............................................................................................... 47 Summary ........................................................................................................................................ 49 Lesson 4: Testing and Error Handling ....................................................................................... 50 Introduction.....................................................................................................................................51 Exercise 1: Activating the Trace Mode........................................................................................... 52 Exercise 2: Synchronous Method Processing................................................................................ 54 Summary ........................................................................................................................................ 55 Additional Sources of Information ............................................................................................. 55
4
April 2001
SAP AG
Controls Tutorial (BC-CI) Controls Tutorial (BC-CI)
Controls Tutorial (BC-CI) What are Controls? Controls are independent binary software components that can be reused. Developers can build controls into their applications and use the functions they provide. Typically, controls are used for designing the user interface. However, using controls is not restricted to visible components. Who Has to Deal With Controls? Users... ...do not see the individual components that make up an application. This is why the integration of controls is transparent to them. They see a single application with which they work. Application Developers... ...use controls in their applications. They are not interested in technical details. When programming their application, they access a logical wrapper class that helps them with the integration of the control. Developers of the Wrapper Class... ...program the logical wrapper of individual controls. Therefore, they must have extensive technical know-how of controls and SAP'sControl Framework. Control Developers... ...create controls themselves. Reusing controls requires that a standardized interface is in place with which control developers must comply. Whom Helps this Tutorial? This documentation is designed forapplication developerswho want to build controls into their ABAP programs.
April 2001
5
SAP AG
Controls Tutorial (BC-CI) BC - Component Integration: Controls Tutorial BC - Component Integration: Controls Tutorial TheBC - Component Integration: Controls Tutorialcontains introductory information for developers who want to use wrapped controls in their ABAP programs. However, the tutorial only covers custom controls that developers can use to integrate modern interface elements into their applications. TheNotes to the User [Page 6]section lists the technical requirements and tells you which programming know-how you need in order to be able to work through the tutorial. In addition, this section gives you a short overview of how controls are integrated with the R/3 System. Each exercise of the tutorial builds on information learned in previous exercises. The exercises are grouped together in lessons that each cover a specific subject: Lesson 1: Creating a Custom Control [Page 10] Lesson 2: Event Handling [Page 19] Lesson 3: Flush Optimization [Page 30] Lesson 4: Testing and Error Handling [Page 44] For each subject covered, there is an introductory section that provides you with background information.
Notes to the User Read the following notes before working through the tutorial: Prerequisites [Page 7] System Configuration [Page 7] Architecture [Page 9]
6
April 2001
SAP AG
Controls Tutorial (BC-CI) Prerequisites
Prerequisites The tutorial is designed to acquaint you step by step with the concepts of control programming. You should have practical knowledge of ABAP programming and be familiar with the tools contained in the ABAP Workbench. For information on this, see: BC - ABAP Workbench Tutorial [Ext.] BC - ABAP Workbench Tools [Ext.] Controls are accessed through classes ofABAP Objects which is the object-oriented extension of ABAP. However, a general introduction to object-oriented programming would have been beyond the scope of this tutorial. Nevertheless, theBasicssections of several lessons explain those ABAP Objects concepts that are necessary to understand controls programming. If you are familiar with these concepts, you can skip the corresponding sections.
For introductory information on object-oriented ABAP programming, seeABAP Objects [Ext.]inBC - ABAP Programming [Ext.].
System Configuration As of Release 4.0A, controls programming is supported through function modules. Starting with Release 4.5A,ABAP Objectsis available for object-oriented programming with ABAP. An object-oriented version of theControl Frameworkis available as of Release 4.6A. The programming examples provided in this tutorial require that you have installed this release. There are two other factors which are of importance:  operating system used on the frontend computer The  The control version installed on the frontend computer Frontend Platform Controls are addressed through a standardized interface. The system supports two of the common standards that are available on the market:ActiveXandJavaBeans. Until Release 4.5B, you must use function modules in your ABAP program to check if the frontend system supports the relevant standard. As of Release 4.6A, theControl Framework performs this check automatically and triggers an exception if an error occurs. You use the function modules to respond individually to such an error, for example, if there is no JavaBean implementation of the control yet. Interface Standards Supported
April 2001
7
Controls Tutorial (BC-CI) System Configuration
SAP AG
Windows95 (32 Bit) Other platforms WindowsNT Standard used ActiveX JavaBeans _ _ _ _ Function module that checks if the standard is HAS GUI ACTIVEX HAS GUI JAVABEAN available on the frontend (only required until Release 4.5B)
Controls Version When you install a local SAPGUI on your machine, the system also installs the appropriate controls. If you install a new local SAPGUI, you should first uninstall the old version to ensure consistency.
8
April 2001
SAP AG
Architecture
R/3 Architecture
April 2001
Controls Tutorial (BC-CI)
Architecture
9
Controls Tutorial (BC-CI)
Architectu
10
re
S
Ap
AP
ril 2
AG
001
SAP AG
R/3
Database
SAPGUI (Client)
Controls Tutorial (BC-CI) Architecture
CREATE _ _ _ FIND AND SELECT TEXT _ HIGHLIGHT SELECTION Tree
CREATE
HTML
Textedit
Explanation When you program controls, interaction between the application server (backend) and the SAPGUI (frontend) is of central importance. By calling ABAP methods, you can create the controls installed on the frontend, modify the control properties, and affect the behavior of these controls. The application server transfers these methods to the frontend by means of a Remote Function Call (RFC) and executes them. The user of an application program triggers control events by performing specific actions (for example, double-clicking a node in a tree structure). You can decide which events you want to catch in your ABAP program and then register these events for the relevant control. A triggered event is transferred from the SAPGUI to the application server. In response to this event, you can then affect the behavior of the control with additional method calls.
April 2001
11