Description
If a proven solution for a recurring problem already exists, why would you reinvent the wheel? This hands-on programming tutorial explains why and how you can use design patterns to help complete your ABAP tasks in less time with better code. Step-by-step, the author guides you through class and interface definitions, as well as the coding for all relevant methods. Plus, benefit immediately from extensively commented real-world code that shows how to implement MVC, Faade, Adapter, Decorator, and more in ABAP Objects.Implementation of Design Patterns
Follow the implementation of Singleton, Adapter, Factory, MVC, Faade, Composite, and Decorator in ABAP.
Hands-on Approach
Written for practitioners, the book includes lots of code, detailed UML diagrams, and comprehensive explanations that guarantee quick success.
Real-World Demo Application
The code in this book is not just theory - it's taken from a real-world application that implements all patterns shown in a production environment.
Improving Code
This book helps you improve the robustness and extendibility of your ABAP Objects code, while reducing maintenance efforts.
New Coverage of Web Dynpro and the Factory Pattern
This second edition has been thoroughly revised and expanded including a new chapter on the Factory pattern, and an extensive section on MVC implementation in multi-technology development for SAP GUI and Web Dynpro ABAP.
CONTENTS:
* 1 ... Introduction ... 11
* 1.1 ... What are Design Patterns? ... 12
* 1.2 ... Communication in Design Patterns ... 13
* 1.3 ... Design Patterns in Software Design ... 14
* 1.4 ... Success Story: The Project and Its By-Product ... 15
* 1.5 ... Formatting and Naming Conventions ... 17
* 1.6 ... Prerequisites ... 18
* 1.6.1 ... Basics of Object-Oriented Software Design ... 18
* 1.6.2 ... Experience in ABAP Programming ... 18
* 1.6.3 ... Web Dynpro ABAP ... 18
* 1.6.4 ... Reading Unified Modeling Language (UML) Diagrams ... 19
* 1.7 ... Structure of the Book ... 25
* 2 ... The Demo Application ... 29
* 2.1 ... Demo Application Server Version Compatibility ... 31
* 2.2 ... Object Orientation ... 32
* 2.3 ... Demo Application at Work ... 32
* 2.3.1 ... The Command Tree ... 33
* 2.3.2 ... Table Maintenance Functionalities ... 34
* 2.3.3 ... Single-record Maintenance Functionalities ... 36
* 2.3.4 ... Empty Containers ... 36
* 2.3.5 ... Special Function: Comments for Flight Schedules ... 37
* 2.4 ... Application Model ... 38
* 2.5 ... SAP GUI Application Controller ... 41
* 2.6 ... Web Dynpro Application Controller ... 42
* 2.7 ... Running the Application While Reading ... 44
* 2.8 ... Summary ... 45
* 3 ... The Singleton Pattern ... 47
* 3.1 ... Case-Study Problem: Running Main Program Only Once ... 48
* 3.2 ... Singleton in the Application Model ... 50
* 3.3 ... Summary ... 51
* 4 ... The Adapter Pattern ... 53
* 4.1 ... Case-Study Problem: Application with a Command Tree ... 53
* 4.2 ... The Adapter in the Demo Application ... 55
* 4.3 ... Interface ZIF_DPD_TREE_OBJECT ... 55
* 4.3.1 ... Types ... 56
* 4.3.2 ... Attributes ... 56
* 4.3.3 ... Constants ... 57
* 4.3.4 ... get_sub_objects Method ... 58
* 4.3.5 ... get_attribute Method ... 58
* 4.3.6 ... get_commands Method ... 59
* 4.3.7 ... user_command Method ... 61
* 4.4 ... Usage of the ZIF_DPD_TREE_OBJECT Interface ... 61
* 4.4.1 ... Active Objects Storage in the Application Model ... 61
* 4.4.2 ... Expanding Tree Nodes ... 62
* 4.4.3 ... Reacting to User's Node Selection ... 62
* 4.4.4 ... Creating Command Buttons ... 63
* 4.4.5 ... Responding to Command Buttons ... 63
* 4.5 ... Summary ... 64
* 5 ... The Factory Pattern ... 65
* 5.1 ... Real-Life Example ... 67
* 5.2 ... Case-Study Problem: Docking Containers Orderly Arranged ... 67
* 5.3 ... Class ZCL_DPD_DOCK_CONTAINER_FACTORY ... 69
* 5.3.1 ... Attributes ... 70
* 5.3.2 ... get_container Method ... 71
* 5.3.3 ... destroy_container Method ... 71
* 5.3.4 ... hide_all and unhide_all Methods ... 72
* 5.3.5 ... refresh_total_size Method ... 73
* 5.3.6 ... resize_containers Method ... 74
* 5.3.7 ... Usage of the Container Factory Class ... 76
* 5.4 ... Summary ... 77
* 6 ... The Model-View-Controller (MVC) Pattern ... 79
* 6.1 ... Two MVCs in the Demo Application ... 81
* 6.2 ... Case-Study Problem I: Single Application in Different UI Technologies ... 83
* 6.3 ... Case-Study Problem II: SAP GUI - Displaying Table Data in Different Controls ... 84
* 6.4 ... The Application Model: Class ZCL_DPD_APP_MOD ... 86
* 6.4.1 ... Attributes ... 87
* 6.4.2 ... constructor Method ... 88
* 6.4.3 ... get_app_mod Method ... 89
* 6.4.4 ... get_tree_object Method ... 89
* 6.4.5 ... get_tree_objects Method ... 90
* 6.4.6 ... add_tree_objects Method ... 90
* 6.5 ... Class ZCL_DPD_MOD_DBT ... 91
* 6.5.1 ... Interfaces ... 91
* 6.5.2 ... Attributes ... 91
* 6.5.3 ... constructor Method ... 93
* 6.5.4 ... zif_dpd_tree_object~user_command Method ... 94
* 6.5.5 ... refresh Method ... 94
* 6.5.6 ... save Method ... 95
* 6.5.7 ... zif_dpd_tree_object~get_sub_objects Method ... 95
* 6.5.8 ... zif_dpd_tree_object~get_attribute Method ... 96
* 6.5.9 ... zif_dpd_tree_object~get_commands Method ... 96
* 6.6 ... Class lcl_mod_dbt_carriers ... 97
* 6.6.1 ... Definition ... 97
* 6.6.2 ... constructor Method ... 98
* 6.6.3 ... zif_dpd_tree_object~get_sub_objects method ... 99
* 6.7 ... Other lcl_mod_* classes ... 100
* 6.8 ... Controller 1: The Program ZDPD_APP_CON_GUI ... 100
* 6.9 ... Class lcl_main_program ... 102
* 6.9.1 ... Definition ... 102
* 6.9.2 ... Attributes ... 103
* 6.9.3 ... run_main_program Method ... 103
* 6.9.4 ... constructor Method ... 104
* 6.9.5 ... on_double_click Method ... 106
* 6.9.6 ... on_expand_no_children Method ... 109
* 6.9.7 ... on_menu_request Method ... 110
* 6.9.8 ... on_menu_select Method ... 110
* 6.10 ... Class lcl_con_alv ... 111
* 6.10.1 ... Definition ... 111
* 6.10.2 ... alv Attribute ... 112
* 6.10.3 ... container Attribute ... 112
* 6.10.4 ... mo_model Attribute ... 113
* 6.10.5 ... Other Attributes ... 113
* 6.10.6 ... constructor Method ... 113
* 6.10.7 ... on_toolbar Method ... 116
* 6.10.8 ... on_user_command Method ... 117
* 6.10.9 ... free Method ... 118
* 6.10.10 ... get_fcat Method ... 118
* 6.10.11 ... flight_schedule_st_text_edit Method ... 119
* 6.11 ... Class lcl_con_dd ... 121
* 6.11.1 ... Definition ... 121
* 6.11.2 ... mo_dd Attribute ... 122
* 6.11.3 ... Other attributes ... 122
* 6.11.4 ... constructor Method ... 122
* 6.11.5 ... on_clicked Method ... 123
* 6.11.6 ... refresh_display Method ... 124
* 6.11.7 ... free Method ... 128
* 6.12 ... Dynpro Screen: An Alien in All-Objects Program ... 129
* 6.12.1 ... Global Program Variables ... 129
* 6.12.2 ... Main Screen 0100 ... 129
* 6.12.3 ... Two GUI Statuses ... 131
* 6.12.4 ... MODULE s0100_start ... 132
* 6.12.5 ... Subscreen 0200 - an Empty Default Subscreen ... 132
* 6.12.6 ... Subscreen 0201 - Carrier Details ... 133
* 6.13 ... Class lcl_con_dynpro_screen ... 135
* 6.13.1 ... Definition ... 136
* 6.13.2 ... mt_scr_contr Attribute ... 137
* 6.13.3 ... m_title, mo_model and mdt_outtab Attributes ... 137
* 6.13.4 ... m_dynnr_main and m_gui_status_main Attributes ... 137
* 6.13.5 ... create_controller Method ... 138
* 6.13.6 ... constructor Method ... 138
* 6.13.7 ... class_pai Method ... 139
* 6.13.8 ... class_pbo Method ... 140
* 6.13.9 ... pai Method ... 140
* 6.13.10 ... pbo Method ... 141
* 6.14 ... The Controller 2: Web Dynpro Component ZDPD_APP_CON_WEBDYNPRO ... 142
* 6.14.1 ... The ZDPD_APP_CON_WEBDYNPRO's COMPONENTCONTROLLER ... 143
* 6.14.2 ... Window MAIN_WINDOW ... 148
* 6.14.3 ... View MAIN_VIEW ... 149
* 6.14.4 ... View ALV_GRID_VIEW ... 154
* 6.15 ... Summary ... 165
* 6.16 ... Appendix: Process Open Object - Close Object ... 166
* 7 ... The Faade Pattern ... 171
* 7.1 ... Case-Study Problem: Editing Comments on Each Flight Schedule ... 174
* 7.1.1 ... Specific Aspects of the Standard Text Editor ... 178
* 7.1.2 ... Starting point: ZIF_DPD_TREE_object~GET_COMMANDS Method ... 178
* 7.2 ... Class ZCL_DPD_ST_TEXT_EDITOR ... 179
* 7.2.1 ... Attributes ... 180
* 7.2.2 ... Methods ... 180
* 7.2.3 ... show Method ... 181
* 7.2.4 ... on_toolbar_func_sel Method ... 186
* 7.2.5 ... save Method ... 186
* 7.2.6 ... free Method ... 188
* 7.3 ... Faade in Web Dynpro ... 188
* 7.4 ... Summary ... 188
* 8 ... The Composite Pattern ... 191
* 8.1 ... Case-Study Problem: Organizing Flights by Date ... 194
* 8.2 ... Class lcl_mod_dbt_flights ... 196
* 8.2.1 ... Definition ... 197
* 8.2.2 ... Attributes ... 198
* 8.2.3 ... constructor Method ... 199
* 8.2.4 ... zif_dpd_tree_object~get_sub_objects Method ... 205
* 8.3 ... Summary ... 209
* 9 ... The Decorator Pattern ... 211
* 9.1 ... Case-Study Problem: Lookup Data for Internal Tables ... 213
* 9.2 ... Class ZCL_DPD_ITAB_DEC ... 218
* 9.2.1 ... Attributes ... 218
* 9.2.2 ... Public Class' Types ... 221
* 9.2.3 ... constructor Method ... 222
* 9.2.4 ... refresh_data Method ... 223
* 9.2.5 ... get_fields Method ... 223
* 9.3 ... Class ZCL_DPD_ITAB_DEC_AIRPORTS ... 224
* 9.3.1 ... Attribute ... 225
* 9.3.2 ... refresh_data Method ... 225
* 9.3.3 ... get_fields Method ... 228
* 9.4 ... Class lcl_itab_dec_fl_sched_comment ... 231
* 9.4.1 ... Definition ... 232
* 9.4.2 ... Attributes ... 232
* 9.4.3 ... get_fields Method ... 232
* 9.5 ... Other Decorators in the Application ... 234
* 9.6 ... Implementation of the Decorator Pattern in the Application ... 235
* 9.7 ... Summary ... 236
* 10 ... Summary ... 237
* 10.1 ... Examples of Extension ... 237
* 10.1.1 ... New Table-Maintaining Object at the Tree - Airplanes ... 238
* 10.1.2 ... New Dynpro Screen: Airplane Details ... 239
* 10.1.3 ... Authorization Checks ... 243
* 10.1.4 ... Toggle Display/Edit ... 244
* 10.1.5 ... Locking Mechanism for Multiuser Applications ... 245
* 10.2 ... Benefits of Combining Objects with DPs ... 245
* 10.3 ... Closing Word by the Author ... 247
* ... The Author ... 249
* ... Index ... 251
Published
30 Dec 2009
Publisher
SAP PRESS/GALILEO PRESS
ISBN
9781592292639
Pages
254




Static Book Details Index Page - Click Here to go to Computer Manuals Website