Book Image

Mastering SAP ABAP

By : Paweł Grześkowiak, Wojciech Ciesielski, Wojciech Ćwik
Book Image

Mastering SAP ABAP

By: Paweł Grześkowiak, Wojciech Ciesielski, Wojciech Ćwik

Overview of this book

Advanced Business Application Programming (ABAP) is an established and complex programming language in the IT industry. This book is designed to help you use the latest ABAP techniques and apply legacy constructions using practical examples. You'll start with a quick refresher on language and database concepts, followed by agile techniques for adding custom code to a modern ABAP system. After this, you will get up to speed with the complete ABAP toolset for importing data to and from different environments. Next, you'll learn how to print forms and work with the different ABAP tools for Extensible Markup Language (XML) manipulation. While covering further chapters, you'll gain insights into building stunning UI5 interfaces, in addition to learning how to develop simple apps using the Business Object Processing Framework (BOPF). You will also pick up the technique of handling exceptions and performing testing in ABAP. In the concluding chapters, you can look forward to grasping various techniques for optimizing the performance of programs using a variety of performance analysis tools. By the end of this book, you will have the expertise you need to confidently build maintainable programs in Systems, Applications, and Products (SAP).
Table of Contents (25 chapters)
Title Page
Copyright and Credits
Dedication
About Packt
Contributors
Preface
Index

Answers


This chapter contains the answers to the questions that are at the end of each chapter. These answers will help the reader to test their knowledge of each chapter. Understanding the content of the chapters is very important for further development and working with the SAP system.

Chapter 1 - Creating Custom Code

  1. Working with Agile speeds up product creation and organizes the creation process. It determines what is important in the project. In this approach, people are very important.
  2. The following are the principals of the Agile Manifesto:
    1. Individuals and interactions over processes and tools
    2. Working software over comprehensive documentation
    3. Customer collaboration over contract negotiation
    4. Responding to change over following a plan
  3. The logical model contains information on data storage, but there is no information on how it will be stored. The physical data design model includes changing the logical database design to a physical layer.
  4. Enhancement and custom development.
  5. The motto is doing, not talking. It is coherent because design thinking is about testing real prototypes, instead of just talking about them.
  6. The categories are as follows:
    • Documentation on the high-level architecture
    • Documentation where we have to describe the whole system, from the high-level architecture to the smallest details
  1. There are various aspects. The ones that apply to SAP development include comprehensibility, conciseness, consistency, maintainability, testability, reliability, and security.
  2. Loose coupling allows for easier maintenance.

Chapter 2 - The Basic Structures of ABAP

  1. They must start with the Z or Y characters.
  2. A field symbol is an instrument in which applications are created with elasticity. Field symbols do not have any memory; instead, they point to a memory location.
  3. The elementary types in the SAP system are C, N, D, T, I, F, P, STRING, and XSTRING.

Chapter 3 - Database Access in ABAP

  1. You need a list of the selected fields, the tables from which data will be selected, and the names of the variables to where data will be downloaded.
  2. The three ways are: FOR ALL ENTRIES, SELECT...ENDSELECT, and JOIN.
  3. The ways to read data from tables are as follows:
    • Get only the required rows from a table.
    • Get only the required columns from a table.
    • Do not use more reads than necessary.
    • Use local buffers and indexes.

Chapter 4 - Import and Export to Document Formats

  1. You can use CL_GUI_FRONTEND_SERVICES to upload files from the presentation layer to the application layer.
  2. The setting of a multiselection parameter controls whether the user can choose one or more files.
  1. The ARCHIVFILE_CLIENT_TO_SERVER function can upload files from the presentation layer to the application server.
  2. The purpose of the parameters is as follows:
    • ASC: data will be transferred as ASCII text.
    • BIN: data should be transferred unconverted in binary format.
    • DAT: data will be transported as unconverted ASCII text, where the different columns are separated by the tabulator.
  1. The CG3Z transaction allows the user to upload a file to the application server.
  2. The file will be saved in the default root folder, DIR_SAPUSERS.
  3. The two languages are: Desktop Office Integration or Object Linking and Embedding.
  4. The ole2incl type-pool needs to be included.

Chapter 5 - Exposing Data to Print Forms

  1. The container for ABAP code is Command Lines.
  2. In Smartform, you have to add empty rows using Command Lines. In Adobe Form, you can set a minimum number of rows in the table settings.
  3. Adobe Forms supports FormCalc and JavaScript.
  4. Transaction SE78 allows the uploading of additional graphics to the server.
  5. When an object is set to a position, it will stay in the same place, no matter what. The object status will be placed according to the available space.
  6. Changes to the structure of the form are not allowed (except for the form field and data values).
  7. Adobe can get input from a user and store that information in a system.

Chapter 6 - ABAP and XML

  1. The import_from_filemethod will parse the XML stream.
  2. The Display method prints an XML file onscreen.
  3. The constant that describes the JSON format can be found in the IF_SXML interface, in the CO_XT_JSON attribute.
  1. No, it's not possible to do that.
  2. ST supports only XML to ABAP and ABAP to XML; XSLT supports any XML transformation.
  3. No, it's possible only using XSLT.
  4. Put the following tag at the beginning of the file: <?xml version="1.0" encoding="UTF-8"?>.

Chapter 7 - Building User Interfaces

  1. The two categories are Selection Screen and Classic DynPro.
  2. In Parameters, you have the ability to input only one values, and in Select-Options, you can input multiple values.
  3. The name of the Custom Container needs to be written in capital letters, and needs to be exactly the same onscreen and in the code.

Chapter 8 - Creating Stunning UI5 Interfaces

  1. Although there are available tools for Eclipse IDE, it is recommended to use WebIDE from SAP (either the Cloud or Personal editions).
  2. According to the development rules, all texts displayed in the applications should be stored in an i18n file. Then, the translation process requires only the generation of a new i18n file, with appropriate language suffix and translated texts inside. When using a fully integrated cloud version of WebIDE, this can be performed with the use of Translation Hub.
  3. MVC is a paradigm that introduces the separation of concerns in applications. It states that the model (M), view (V), and controller (C) should be maintained separately, making the whole process of development and maintenance easier and cheaper.
  4. The toolset includes mock servers, OPA5 for intergration tests, and QUnit for unit tests.

Chapter 9 - Business Object Processing Framework

  1. To enhance the BOstandard, you can use a BOBX transaction.
  2. The BOBFtransaction is used for SAP internal uses.
  3. The association's entity is used to create a relation between two BOPF objects.
  4. There are two different types of association: general and composite.
  5. To save data to the database, we have to use Transaction Manager.
  6.  The main BOPF exception is /bopf/cx_frw.
  7. The configuration object is used to get BO metadata.

Chapter 10 - Modification and Customization Techniques

  1. The techniques are Changes and modification.
  2. With the switch mechanism, you can switch enhancement on and off without making any change to the code.
  3. Classical: objects are created by the factory method; filters are passed into implementation; classical BAdI can be called only once; and the calling position is registered centrally.New: This is created by GET BADI; filters are used when an object is created; and multiple calls are possible and are not centrally registered.
  4. It's used for the FICA module.
  5. A SECTION contains default code and POINT does not.
  6. If INCLUDE BOUND is used, the enhancement will be called from every main program that uses this include method.
  7. For customer exit implementation, we use function modules.

Chapter 11 - Handling Exceptions in ABAP

  1. Exception classes are implemented in the Class Builder just like usual classes. The difference is that it has to be marked as an exception class, and it must inherit from one of the standard exception classes.
  2. It is an object that groups breakpoints and assertions in order to manage them centrally. It allows for quick activation/deactivation, behavior configuration, and log checks.
  3. ABAP Dump Analysis is used to analyze execution errors in the SAP system.
  4. ABAP Dump Analysis is launched after using the st22 transaction.
  5. Despite the exception, the program does not end its work in an unexpected way. Dumps will not appear.

Chapter 12 - Testing ABAP Programs

  1. This variant is called S4HANA_READINESS.
  2. PERFORMANCE_CHECKLIST can be used to check code performance.
  3. Using SET EXTENDED CHECK OFF will turn off extended checks.
  4. You can use append_line from cl_tpda_script_tabledescr.
  5. Those steps are: Debugger Single Step, Breakpoint Reached, and Watchpoint Reached.
  6. To record, the TCD RECtransaction can be used.
  7. Either the Local, Import, or Export parameters.

Chapter 13 - Advanced Techniques in ABAP Objects

  1. The global class can be used in the code all over the system. The local class can be used only in the code where it is defined.
  2. Interfaces cannot have an implementation of methods. Only definitions are allowed.
  3. Design patterns are universal, tested in practice for frequently occurring and repetitive design issues.

Chapter 14 - Integrating SAP with Third-Party Systems

  1. The user can connect with other systems using the following technologies: IDoc, EDI/ALE, BAPI, OData, or Gateway.
  2. The OData service works as a RESTful service, offering basic CRUD methods. From the consumer’s perspective, it provides uniquely identified data according to the OData specification. From the system’s perspective, it usually consists of model-provider classes and data-provider classes, where the latter is responsible for business logic implementation.
  3. The main difference between the two is that EDI is used for external communication, while ALE is used for internal connections. From a technical point of view, EDI transfers data using file ports, whereas ALE uses memory buffers to transfer the data.

Chapter 15 - Background Processing of ABAP Programs

  1. Users can schedule the job in the background with the SM36 transaction.
  2. Ready: This status means that the task scheduler puts the job in the queue while it waits for the job to be released in the background.
  3. To set the High and Medium priorities, the user must have the appropriate permissions. 

Chapter 16 - Performance and Optimization of ABAP Code

  1. SAT–it is a modern replacement of SE30 offering better configuration options and more transparent result analysis
  2. Using this tool allows you to constantly improve programs and increase the business suitability of the process by accelerating it.
  3. The ABAP Trace Analysis offers the list of calls executed during runtime, alongside the execution times and counters.
  1. In the Statement tab, the user can set what should be checked during the operation of the ABAP SAT Transaction tool.
  2. Users can decide whether to collect information about database accesses, remote function calls, and enqueues/dequeues on database tables.
  3. It shows accesses to internal tables during program execution.
  4. SAP Trace Analysis runs through ST12 transactions.