ebook img

Web Dynpro ABAP for practitioners PDF

357 Pages·2010·20.56 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Web Dynpro ABAP for practitioners

Ulrich Gellert Ana Daniela Cristea l Web Dynpro ABAP for Practitioners UlrichGellert AnaDanielaCristea c/oSþPLIONAG c/oS+PLIONAG Robert-Bosch-Str.9 Robert-Bosch-Str.9 68542Heddesheim 68542Heddesheim Germany Germany [email protected] [email protected] ISBN978-3-642-11384-0 e-ISBN978-3-642-11385-7 DOI10.1007/978-3-642-11385-7 SpringerHeidelbergDordrechtLondonNewYork LibraryofCongressControlNumber:2010929263 #Springer-VerlagBerlinHeidelberg2010 Thisworkissubjecttocopyright.Allrightsarereserved,whetherthewholeorpartofthematerialis concerned,specificallytherightsoftranslation,reprinting,reuseofillustrations,recitation,broadcasting, reproductiononmicrofilmorinanyotherway,andstorageindatabanks.Duplicationofthispublication orpartsthereofispermittedonlyundertheprovisionsoftheGermanCopyrightLawofSeptember9, 1965,initscurrentversion,andpermissionforusemustalwaysbeobtainedfromSpringer.Violations areliabletoprosecutionundertheGermanCopyrightLaw. Theuseofgeneraldescriptivenames,registerednames,trademarks,etc.inthispublicationdoesnotimply, evenintheabsenceofaspecificstatement,thatsuchnamesareexemptfromtherelevantprotectivelaws andregulationsandthereforefreeforgeneraluse. Allprintedscreens,SAP,theSAPLogo,mySAP,SAPR/3,ABAP,NetWeaverPortalaresubjectto copyrightoraretrademarksofSAPAG,Dietmar-Hopp-Allee16,69190Walldorf,Germany Coverdesign:KuenkelLopkaGmbH,Germany Printedonacid-freepaper SpringerispartofSpringerScience+BusinessMedia(www.springer.com) Contents 1 WhatisWebDynpro? .................................................... 1 2 SAPEasyAccess .......................................................... 5 2.1 ChangingtheSAPEasyAccess ....................................... 6 2.2 FavoritesList .......................................................... 6 2.3 SettingaTransactionasStartTransaction ............................ 8 2.4 CreatingaShortcut .................................................... 8 3 DesigningaWebDynproComponent .................................. 11 3.1 View .................................................................. 14 3.1.1 ViewLayout ................................................... 14 3.1.2 ContextView .................................................. 17 3.1.3 Actions ......................................................... 19 3.1.4 Methods ........................................................ 19 3.1.5 Properties ...................................................... 21 3.1.6 Attributes ....................................................... 22 3.2 Componentcontroller ................................................. 23 3.3 Window ............................................................... 23 3.4 Application ............................................................ 24 3.5 ABAPDebugger ...................................................... 27 3.6 WebDynproLogonPageConfiguration ............................. 30 4 ABAPDictionary ........................................................ 33 4.1 DataElement ......................................................... 34 4.2 Domain ................................................................ 35 4.3 Structure .............................................................. 38 4.4 Table .................................................................. 40 4.5 SearchHelp ........................................................... 45 4.6 DatabaseView ........................................................ 48 4.7 TableType ............................................................ 51 4.8 LockObject ........................................................... 52 ix x Contents 5 ContextNodesandAttributesatDesignTime ........................ 55 5.1 Attributes .............................................................. 56 5.2 Nodes ................................................................. 58 5.2.1 CreatingaNodethatUsesanABAPDictionary RepositoryObject .............................................. 59 5.2.2 WorkingwithChildNodes .................................... 64 6 DataBinding,ContextMappingandInterfaceMethods ............. 67 6.1 DataBinding .......................................................... 67 6.2 ContextMapping ..................................................... 72 6.2.1 InternalContextMapping ..................................... 72 6.2.2 ExternalContextMapping ..................................... 76 6.3 InterfaceMethods ..................................................... 83 7 ViewControllerMethods ............................................... 87 7.1 HookMethods ........................................................ 87 7.1.1 wdDoInit ....................................................... 88 7.1.2 wdDoExit ...................................................... 91 7.1.3 wdDoModifyView ............................................. 91 7.1.4 wdDoBeforeAction ............................................ 96 7.1.5 wdDoOnContextMenu ......................................... 98 7.2 SupplyFunctionMethods .......................................... 102 7.3 User-DefinedInstanceMethods .................................... 103 7.4 FireMethods ........................................................ 105 7.5 EventHandlerMethods ............................................. 109 8 LayoutUIElements .................................................... 113 8.1 FlowLayout ......................................................... 114 8.2 GridLayout .......................................................... 116 8.3 MatrixLayout ....................................................... 119 8.4 RowLayout .......................................................... 120 9 UserInterfaceElements(UIelements),StaticandDynamic Programming ............................................................ 123 9.1 Action ............................................................... 124 9.1.1 TimedTrigger ................................................ 124 9.1.2 ButtonChoice ................................................. 126 9.2 Selection ............................................................ 132 9.2.1 DropDownByKey ............................................. 132 9.2.2 DropDownByIndex ........................................... 135 9.2.3 RadioButtonGroupByIndex ................................... 137 9.3 Layout ............................................................... 140 9.3.1 ViewContainerUIElement .................................... 140 9.3.2 TabStrip ....................................................... 146 9.3.3 PageHeader ................................................... 149 9.3.4 ContextualPanel ............................................... 152 Contents xi 9.3.5 TrayUIElement .............................................. 155 9.3.6 MessageArea .................................................. 159 9.4 Complex ............................................................ 163 9.4.1 Table .......................................................... 163 9.4.2 RoadMap ...................................................... 171 9.4.3 PhaseIndicator ................................................ 180 9.4.4 Tree–SequentialImplementation ........................... 186 9.4.5 DateNavigator ................................................ 191 9.5 Graphic .............................................................. 197 9.5.1 Image .......................................................... 198 9.5.2 BusinessGraphics ............................................. 201 9.6 Integration .......................................................... 206 9.6.1 TheInteractiveForm .......................................... 206 9.6.2 FileUpload .................................................... 215 10 Messages,ExceptionsandWebDynproABAP ...................... 221 10.1 MessageHandling ................................................. 222 10.1.1 DynamicTextsStoredintheTextPool oftheAssistanceClass .................................... 222 10.1.2 TextfromDatabaseTableT100 .......................... 225 10.2 ExceptionHandling ............................................... 227 10.2.1 ExceptionClasswithOTRText .......................... 228 10.2.2 ExceptionClasswithTextfromaMessageClass ........ 233 11 WritingMultilanguageApplications .................................. 237 11.1 CreatingMultilanguageUserInterfaces .......................... 238 11.1.1 InternationalizationofDataElementsDefined inABAPDictionary ....................................... 240 11.1.2 InternationalizationofDomainsDefined inABAPDictionary ....................................... 241 11.1.3 InternationalizationofTextfromOTR ................... 242 11.1.4 InternationalizationofTextfromAssistanceClass ....... 244 11.1.5 InternationalizationofMessages .......................... 245 11.2 MultilanguageRecordsintheDatabase .......................... 247 11.2.1 StudyanExampleCreatedintheSystem ................. 248 11.2.2 CreatingTableStructuresandInternationalization oftheRecords ............................................. 250 11.2.3 UsingtheInternationalizedRecordsinWebDynpro ..... 255 12 WebDynproModel ..................................................... 259 12.1 AssistanceClassasaModelforaMulticomponent Application ........................................................ 260 12.2 BAPIasaModel .................................................. 274 12.2.1 CreatingaBAPI ........................................... 274 12.2.2 UsingtheCreatedBAPIasaModel ...................... 279 12.3 WebService ....................................................... 283 xii Contents 12.3.1 CreatingtheWebService ................................. 284 12.3.2 WebServiceConfiguration ............................... 287 12.3.3 TestingtheWebService .................................. 288 12.3.4 ConsumingtheWebServiceinWebDynpro ............ 289 13 ALVandSelectOptions ................................................ 295 13.1 SAPListViewer ................................................... 295 13.1.1 SimpleALVExample ..................................... 296 13.1.2 ALVConfigurationModel ................................ 299 13.2 SelectOptions ..................................................... 306 13.3 ALVandSelectOptions .......................................... 313 14 IntegratingaWebDynproApplicationintotheSAP NetWeaverPortal ....................................................... 315 14.1 CreatingaFolder .................................................. 316 14.2 ConnectingtotheBack-EndABAPSystem ...................... 317 14.3 CreatinganiView ................................................. 321 14.4 CreatingaRoleandRoleAssignment ............................ 324 14.5 RunningtheApplicationintothePortal .......................... 327 14.6 TriggeringaPortalEvent ......................................... 327 14.7 ReactingtoaPortalEvent ........................................ 329 14.8 CreatingaPage .................................................... 331 14.9 RunningtheApplicationthatProcessesPortalEvents ........... 333 15 WebDynproandAuthorization ....................................... 335 15.1 RoleBasedAccessControlPattern–RBAC ..................... 337 15.2 AuthorizationObjectClass ........................................ 338 15.3 AuthorizationObject .............................................. 338 15.4 AuthorizationFields ............................................... 340 15.5 CreatingaSingleRoleandChangingitsAuthorizationData .... 343 15.6 CreatingtheWebDynproComponent ............................ 346 15.6.1 CheckingtheAuthorizationoftheCurrentUser ......... 346 15.6.2 AssigningtheUser-RoleandRunning theApplication ............................................ 349 16 WebDynproMindMap ................................................ 351 16.1 CreatingaMindMap .............................................. 351 16.2 WebDynproABAPMindMap ................................... 352 Appendix ...................................................................... 353 Index .......................................................................... 357 Chapter 1 What is Web Dynpro? “LogicwillgetyoufromAtoB.Imaginationwilltakeyoueverywhere.” AlbertEinstein Abstract Inthischapter,wepresenttheplaceandroleoftheWebDynprowithin theSAPNetWeaverplatform.So,westartwiththelayersoftheSAPNetWeaver platform, we continue with the importance of the Application Platform layer, and we conclude with the place androleofWeb Dynpro(ABAPandJava) within the ApplicationServerABAPand,respective,ApplicationServerJava. To answer this question we have to look at the SAP NetWeaver technology platform(Fig.1.1). As we can see, four layers are distinguished in this context: Application Plat- form,ProcessIntegration,InformationIntegrationandPeopleIntegration. The Application Platform represents the technical basis of almost all the other SAPproducts.ThisisthereasonwhytheApplicationPlatformplaysacentralrole intheSAPNetWeaver. TheApplicationPlatformessentiallyofferstwoprogramminginterfaces:ABAP andJava(J2EE).ABAPistheprogramminginterfaceforApplicationServer(AS) ABAPandJavaistheprogramminginterfaceforASJava. TocreateABAPandJavaapplications,wehavetwoindependentdevelopment environments: ABAP Workbench for ABAP and SAP NetWeaver Developer StudioforJava. Bothdevelopmentenvironmentsofferthepossibilitytocreatewebbasedappli- cations built by using declarative programming techniques based on the Model ViewController(MVC)paradigm. SAPNetWeaverDeveloperStudioistheSAP’sowndevelopmentenvironment used to develop Java-based multilayer business applications. This development environment is based on Eclipse and offers a Web Dynpro Perspective to create WebDynproJavaapplications(Fig.1.2). AllthetoolsweneedtocreateWebDynproJavaapplicationsarefoundwithin theSAPNetWeaverDeveloperStudio. U.GellertandA.D.Cristea,WebDynproABAPforPractitioners, 1 DOI10.1007/978-3-642-11385-7_1,#Springer-VerlagBerlinHeidelberg2010 2 1WhatisWebDynpro? Fig.1.1 SAPNetWeavercomponents(SAP) Fig.1.2 SAPNetWeaverDeveloperStudio–WebDynproperspective ABAPWorkbenchistheSAP’sowndevelopmentenvironmentusedtodevelop ABAP-based multilayer business applications. This development environment offersWebDynproExplorertocreateWebDynproABAPcomponents(Fig.1.3). 1WhatisWebDynpro? 3 Fig.1.3 ABAPWorkbench–WebDynproExplorer TheApplicationServerABAPhasthestructurepresentedinFig.1.4. Fig.1.4 ASABAP(SAP) 4 1WhatisWebDynpro? As we can see, most of the AS ABAP components can be divided into three layers: l Presentationlayer. l Businesslayer. l Persistencelayer. WebDynproABAPispartofthepresentationlayerandit’stheSAPstandardUI technologyusedfordevelopingwebbusinessapplicationswithoutknowingHTML orJavaScript. WebDynproABAPoffersmanyadvantages,asfollows: l Strictseparationbetweenthelayoutandbusinessdata. l Re-useandbettermaintainabilitythroughreusability. l Automaticinputchecks. l Automaticdatatransport,usingdatabinding. l WYSIWYG(WhatYouSeeIsWhatYouGet)vieweditor. WebDynproABAPandWebDynproJavamostlyofferthesamefunctionalities. But,ofcourse,therearesomedifferencesbetweenthem,forexample: l Web Dynpro Java, unlike the Web Dynpro ABAP, disposes of a ViewSet that allows us to integrate in a Screen more Views, by using certain pre-defined layouts.Inthisrespect,theircommonpartistheViewContainerUIElement. l Web Dynpro Java offers graphical tools that ease the programming work, as: NavigationManagerandDiagramView,unliketheWebDynproABAPwhere wedisposeonlyofatoolusedtovisualizeandtodefinethewindowstructure. The Web Dynpro ABAP is what the current book is about. More information aboutWebDynproJavacanbefoundintheBookInsideWebDynproforJavaby ChrisWhealy.

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.