TAW10

ABAP Workbench Fundamentals Part 1

Publication ID:

Course Overview
Unit 1: SAP Portfolio Overview Unit 2: Navigation Unit 3: The System Core Unit 4: Communication and Integration Technologies Unit 5: Flow of an ABAP Program Unit 6: ABAP Workbench Introduction Unit 7: Basic ABAP Language Elements Unit 8: Modularization Unit 9: Complex Data Objects Unit 10: Data Modeling and Data Retrieval

Unit 11: Classic ABAP Report Unit 12: Program Analysis Tools Unit 13: Program Calls and Memory Management Unit 14: ABAP Open SQL in Detail

Unit 1: SAP Portfolio Overview
Lesson 1: Identifying the Parts of the SAP Portfolio Lesson 2: Listing the Key Capabilities of SAP NetWeaver Lesson 3: Considering the Release Strategy of SAP

TAW10_1

Unit 1 Lesson 1

Lesson 1: Identifying the Parts of the SAP Portfolio Lesson Objectives
After completing this lesson, you will be able to:

Determine the components of the SAP portfolio that best meet your needs

TAW10_1

Figure 1: Key Areas of SAP

Unit 1 Lesson 1

TAW10_1

Figure 2: Different Products for Companies in Various Sizes

Unit 1 Lesson 1

TAW10_1

Unit 1 Lesson 1

Parameters Overview

SAP Business One A single, integrated application to manage an entire business

SAP Business ByDesign Single, integrated business management solution delivered as software as a service (SaaS)

SAP Business All-inOne A comprehensive, integrated industry solution to power businesses end to end

Best fit for companies

For companies that have outgrown packaged accounting-only software and need to replace multiple, non integrated applications

For companies that For the following need to replace point companies: solutions, manual ● Companies processes, and that have spreadsheets outgrown point solutions, legacy or custom

TAW10_1

Unit 1 Lesson 1

Parameters

SAP Business One

SAP Business ByDesign

SAP Business All-inOne applications, or current ERP software

● Companies

that have current solutions that  may either not meet industryspecific requirements or that lack

TAW10_1

Unit 1 Lesson 1

Parameters

SAP Business One

SAP Business ByDesign

SAP Business All-inOne cross-border functionality

● Companies

that are experiencing increasing business process complexity and need systems that can scale to meet growth plans

Company size

Up to 100

100–500

 Up to 2,500

TAW10_1

Unit 1 Lesson 1

Parameters IT staff and capabilities Deployment model

SAP Business One Have limited or outsourced IT resources

SAP Business ByDesign Have limited or outsourced IT resources

SAP Business All-inOne Have in-house IT staff On premise or hosted by a partner

On premise or hosted On demand by a partner

TAW10_1

Figure 3: SAP Business Suite – Architecture

Unit 1 Lesson 1

TAW10_1

Figure 4: SAP Applications and Components

Unit 1 Lesson 1

TAW10_1

Summary
You should now be able to:

● Determine the components of the SAP portfolio that best meet your needs

TAW10_1

Unit 1 Lesson 2

Lesson 2: Listing the Key Capabilities of SAP NetWeaver Lesson Objectives
After completing this lesson, you will be able to:

List the key capabilities of SAP NetWeaver

TAW10_1

Figure 5: Capability-Based Technology Map of SAP NetWeaver (Edition 2010)

Unit 1 Lesson 2

TAW10_1

Figure 6: SAP NetWeaver AS – The Basis for SAP Systems

Unit 1 Lesson 2

TAW10_1

Figure 7: SAP NetWeaver Application Server

Unit 1 Lesson 2

TAW10_1

Unit 1 Lesson 2

Use Case Building composite applications Data warehousing Integrating and self-servicing content with the SAP NetWeaver portal Building integration scenarios Mobilizing business processes Custom application development (ABAP)

Corresponding Capability of SAP NetWeaver SAP NetWeaver Composition Environment SAP NetWeaver Business Warehouse SAP NetWeaver Process Integration SAP NetWeaver Portal SAP NetWeaver Mobile All areas that allow ABAP development on AS ABAP

TAW10_1

Figure 8: SAP NetWeaver - Functionality

Unit 1 Lesson 2

TAW10_1

Summary
You should now be able to:

● List the key capabilities of SAP NetWeaver

you will be able to: ● Find upgrade and maintenance information for SAP solutions .TAW10_1 Unit 1 Lesson 3 Lesson 3: Considering the Release Strategy of SAP Lesson Objectives After completing this lesson.

TAW10_1 Figure 9: Phases of Software Delivery by SAP Unit 1 Lesson 3 .

TAW10_1 Figure 10: SAP Maintenance Strategy Unit 1 Lesson 3 .

TAW10_1 Figure 11: SAP Business Suite 7 Maintenance Extension Unit 1 Lesson 3 .

TAW10_1 Figure 12: Evolution of the Basis and Business Functionality Unit 1 Lesson 3 .

TAW10_1 Figure 13: Consolidation of Application Server ABAP Unit 1 Lesson 3 .

7.31 Unit 1 Lesson 3 .TAW10_1 Figure 14: SAP NetWeaver 7.03 vs.

Use the SAP Service Marketplace to find the end of extended maintenance of SAP enhancement package 6 for SAP ERP 6. skip this exercise. 1.0 end? . Business Example You want to determine the end of extended maintenance for SAP enhancement package 6 for SAP ERP 6.TAW10_1 Unit 1 Exercise 1 Exercise 1: Access the SAP Release Strategy Document . Hint: This exercise requires a registered user on the SAP Service Marketplace. If you do not have access to your S-user.0.0. When does the extended maintenance for SAP enhancement package 6 for SAP ERP 6.

If you do not have access to your S-user. .0. skip this exercise.com/releasestrategy. When does the extended maintenance for SAP enhancement package 6 for SAP ERP 6.0 end? a) Navigate to the SAP Service Marketplace. Hint: This exercise requires a registered user on the SAP Service Marketplace. Business Example You want to determine the end of extended maintenance for SAP enhancement package 6 for SAP ERP 6. See https://service. quick link or release strategy. 1.0.sap. Use the SAP Service Marketplace to find the end of extended maintenance of SAP enhancement package 6 for SAP ERP 6.TAW10_1 Unit 1 Solution 1 Solution 1: Access the SAP Release Strategy Document .

b) Choose SAP’s Release Strategy for Large Enterprises.TAW10_1 Unit 1 Solution 1 Solution 1: Access the SAP Release Strategy Document . c) Within the document. Extended maintenance for SAP EHP 6 for SAP ERP 6. .0 will end December 2020. search for SAP ERP. Open the document named SAP’s Release Strategy for Large Enterprises for all Major Releases from 2005 onward. One of the hits will lead you to the table giving the SAP ERP details.

TAW10_1 Summary You should now be able to: ● Find upgrade and maintenance information for SAP solutions .

Unit 1 A. SAP ERP D. SAP Customer Relationship Management (CRM) C. SAP NetWeaver . Choose the correct answer. A service-oriented architecture(SOA) B.TAW10_1 Non-SAP solutions can be integrated consistently with the customers’ core business processes through ___________________.

Unit 1 A.TAW10_1 Non-SAP solutions can be integrated consistently with the customers’ core business processes through ___________________. A service-oriented architecture(SOA) .

" . Unit 1 "SAP Business All-in-One is the ideal solution for small and midsize companies (having up to 2.500 employees) with stable processes and that want to use a preconfigured system from SAP.TAW10_1 Determine whether this statement is true or false.

TAW10_1 Determine whether this statement is true or false. Unit 1 "SAP Business All-in-One is the ideal solution for small and midsize companies (having up to 2." True .500 employees) with stable processes and that want to use a preconfigured system from SAP.

Unit 1 "SAP ERP does not support industry-specific processes. " .TAW10_1 Determine whether this statement is true or false.

TAW10_1 Determine whether this statement is true or false. Unit 1 "SAP ERP does not support industry-specific processes. " False .

Choose the correct answers. Service-oriented architecture (SOA) middleware B.TAW10_1 Multiple Choice Unit 1 Identify the key capabilities of SAP NetWeaver. Business intelligence . Security and Identity management C. A.

Security and Identity management C. Business intelligence . A.TAW10_1 Multiple Choice Unit 1 Identify the key capabilities of SAP NetWeaver. Service-oriented architecture (SOA) middleware B.

SAP NetWeaver AS C++ . SAP NetWeaver AS Java C. SAP NetWeaver AS ABAP B. Unit 1 A.TAW10_1 Identify the different installation options for SAP NetWeaver Application Server (AS). Choose the correct answers. SAP NetWeaver AS ABAP + Java D.

SAP NetWeaver AS ABAP + Java . SAP NetWeaver AS Java C.TAW10_1 Identify the different installation options for SAP NetWeaver Application Server (AS). SAP NetWeaver AS ABAP B. Unit 1 A.

Support Packages are delivered to customers to solve system and customer issues. Unit 1 "In the customer-specific maintenance phase." .TAW10_1 Determine whether this statement is true or false.

Support Packages are delivered to customers to solve system and customer issues." False . Unit 1 "In the customer-specific maintenance phase.TAW10_1 Determine whether this statement is true or false.

Support packages B. A. Extended maintenance components C. Central ERP functions .TAW10_1 Unit 1 ___________ are used to solve (component-dependent) problems that arise when using SAP software. Choose the correct answer.

A. Support packages .TAW10_1 Unit 1 ___________ are used to solve (component-dependent) problems that arise when using SAP software.

Unit 2: Navigation Lesson 1: Navigating Through SAP Systems Lesson 2: Performing Advanced Navigation in the SAP GUI .

you will be able to: ● Navigate through SAP systems by using the SAP GUI .TAW10_1 Unit 2 Lesson 1 Lesson 1: Navigating Through SAP Systems Lesson Objectives After completing this lesson.

TAW10_1 Unit 2 Lesson 1 Different Access Technologies SAP Product SAP ERP SAP NetWeaver Business Intelligence (BI) SAP Business ByDesign SAP Business All-in-One solutions Typical Access Technology SAP GUI for Windows or SAP GUI for HTML Browser-based interface (various browsers possible) Browser-based interface (various browsers possible). software as a service (SaaS) SAP NetWeaver Business Client .

TAW10_1 Figure 15: Variants of SAP GUI Unit 2 Lesson 1 .

TAW10_1 Figure 16: The SAP Logon Program Unit 2 Lesson 1 .

TAW10_1 Figure 17: The Logon Screen for an SAP System Unit 2 Lesson 1 .

it makes sense to occasionally change your password. For security reasons. You can move between these fields by using a mouse click or the Tab key. Use the following steps to change your password: 1. the system prompts you to change and save your password. Enter your new password in the New Password and Repeat Password fields. . Note that numerous rules regarding the structure of a password can be set up for your system. During the first logon attempt.TAW10_1 Unit 2 Lesson 1 Procedure: To Change the Initial Password Use the initial password assigned to you when you log on to the system for the first time.

.TAW10_1 Unit 2 Lesson 1 Procedure: To Change the Initial Password Figure 18:  Dialog Box for Changing the Password 2. Choose (Continue) to save your new password.

3. user administrators with authorization for transaction SU01 can change user passwords as often as they want. Choose the New Password pushbutton. Change your password and save your data. On the logon screen of the SAP system. An initial password requires a change during the next logon of the corresponding user. . the administrator can only assign new initial passwords. The following are the steps to change your password again: 1. Actually. In contrast. enter your data and current password. 2.TAW10_1 Unit 2 Lesson 1 Procedure: To Change the Changed Password Again User can change their passwords at most once a day on the initial logon screen.

TAW10_1 Figure 19: SAP Easy Access Screen Unit 2 Lesson 1 .

TAW10_1 Figure 20: Screen Elements in the SAP GUI Unit 2 Lesson 1 .

choose the Exit pushbutton on the SAP Easy Access screen or enter the /NEND command in the command field.TAW10_1 Unit 2 Lesson 1 Procedure: To Log Off the System The steps to log off the system are as follows: 1. 2. The dialog field for logging off appears in the last window only. All SAP GUI sessions of your terminal session are closed and the entries that have not been saved are lost. The Log Off dialog box appears and tells you that you will lose data that has not been saved when you log off. If several SAP GUI sessions (window sessions) are open. . Hint: Alternatively. Caution: The /NEX command immediately terminates your logon without querying the dialog windows first. On the SAP Easy Access screen. choose System → Log off. choose the Exit pushbutton to close only the active window.

To log off. choose the Yes pushbutton.TAW10_1 Unit 2 Lesson 1 Procedure: To Log Off the System Figure 21: Log off Dialog Box 3. .

. When you close the last window of your session. an SAP session is a normal application.TAW10_1 Unit 2 Lesson 1 Procedure: To Log Off the System Hint: From the perspective of the Windows operating system. the Log Off dialog box is also displayed. You can also close the SAP GUI sessions by using the key combination Alt + F4 on the operating system.

TAW10_1 Figure 22: Starting SAP NetWeaver Business Client Unit 2 Lesson 1 .

<full qualified name>:<Port of ICM or HTTP(S)>. For example. ABAP or as needed by the system to which you want to connect The client to which you want to connect Language that SAP NetWeaver Business Client has to use for connecting to the SAP system (for example. EN or DE) Type Client Language .TAW10_1 Unit 2 Lesson 1 Connection Settings Name URL Description The SID of your training system The URL to connect SAP NetWeaver Business Client to an SAP system. For example. http://server. Note that the string /sap/bc/nwbc depends on the type of system with which you want to connect.

TAW10_1 Unit 2 Lesson 1 Connection Settings SAP GUI Logon description Description Usually. Please see the context help for this field for further information. Description on the SAP NWBC Logon screen Comment . you do not need to use this field.

TAW10_1 Figure 23: Using SAP NetWeaver Business Client Unit 2 Lesson 1 .

enter a new password of your choice two times in the window that appears. When you log on for the first time. Log on to the training system PSM and carry out some basic exercises in the system (the menu path refers to the SAP standard menu). 2. Choose the Logon pushbutton. user name. Hint:  Use the logon data provided by your instructor. Enter the client. Start the SAP Logon program and create a new entry according to the information given by your instructor.TAW10_1 Unit 2 Exercise 2 Exercise 2: Log on to the System and Navigate on the Screen . 1. What is the maximum number of parallel SAP GUI sessions that you can open using System → Create Session? . initial password. and logon language supplied by the instructor. Business Example You want to work in the SAP Solution Manager system.

What is the name of the function you reach if you choose Tools → Administration → Monitor → System Monitoring → User Overview? What transaction code do you use  to call this transaction instead of the specified menu path? . 3.TAW10_1 Unit 2 Exercise 2 Exercise 2: Log on to the System and Navigate on the Screen .

and logon language supplied by the instructor. 1. Hint:  Use the logon data provided by your instructor. . Log on to the training system PSM and carry out some basic exercises in the system (the menu path refers to the SAP standard menu).TAW10_1 Unit 2 Solution 2 Solution 2: Log on to the System and Navigate on the Screen . Choose the Logon pushbutton. initial password. Start the SAP Logon program and create a new entry according to the information given by your instructor. user name. Enter the client. enter a new password of your choice two times in the window that appears. Business Example You want to work in the SAP Solution Manager system. a) Follow the instruction in the exercise. When you log on for the first time.

  3. In this case. What is the maximum number of parallel SAP GUI sessions that you can open using System → Create Session? a) This training system should allow you to open up to 6 SAP GUI sessions. 2. b) You can also choose to display the transaction code for an active transaction in the status bar. the transaction code is SM04.TAW10_1 Unit 2 Solution 2 Solution 2: Log on to the System and Navigate on the Screen . . What is the name of the function you reach if you choose Tools → Administration → Monitor → System Monitoring → User Overview? What transaction code do you use  to call this transaction instead of the specified menu path? a) The function is called User List. You can find the relevant transaction code by choosing System → Status.

TAW10_1 Unit 2 Solution 2 Solution 2: Log on to the System and Navigate on the Screen . d) A fourth option is to display the details by choosing the corresponding menu entry and then Extras → Technical details. you can permanently display the transaction codes on the SAP Easy Access screen. c) Alternatively. . Choose Extras → Settings and activate the field Display Technical Names.

TAW10_1 Summary You should now be able to: ● Navigate through SAP systems by using the SAP GUI .

you will be able to: ● Call functions in ABAP-based systems .TAW10_1 Unit 2 Lesson 2 Lesson 2: Performing Advanced Navigation in the SAP GUI Lesson Objectives After completing this lesson.

TAW10_1 Figure 24: Favorites List and User Menu Unit 2 Lesson 2 .

TAW10_1 Figure 25: Options to Call a Function in an SAP System Unit 2 Lesson 2 .

1. 2. Identify who is currently logged on to the training system PSM and create a Favorites menu for your user. Note that this menu path might not be available in your training system by default. familiarize yourself with various ways of calling functions. Task 1 Find out various ways of viewing the user overview. Run the transaction for displaying a list of users who are logged on. Run transaction code SM04. which takes you directly to the user overview. . choose Tools → Administration → Monitor → System Monitoring → User Overview. Business Example As an end user. enter /nS000 in the command field. On the SAP Easy Access screen. In this case. Exit the user overview by using either the F3 key or the Back pushbutton in the standard toolbar.TAW10_1 Unit 2 Exercise 3 Exercise 3: Call Functions .

Task 2 Create a Favorites menu. 1.TAW10_1 Unit 2 Exercise 3 Exercise 3: Call Functions . choose Favorites → Add. The transaction is saved in the Favorites area. Add transactions RSPFPAR. . 2. On the SAP Easy Access screen. 3. and SEARCH_USER_MENU to the Favorites menu without expanding the SAP menu. SEARCH_SAP_MENU. To view the user overview. Can you distinguish between the favorites entries by the method used to insert them? 4. Create a folder Search Options in which you can store both search transactions. choose Tools → Administration → Monitor → System Monitoring → User Overview on the SAP Easy Access screen. Save the frequently used transactions in a Favorites menu. Choose the transaction entry.

TAW10_1 Unit 2 Exercise 3 Exercise 3: Call Functions . Find out how often and where transaction SM04 for the user overview is stored in the SAP menu. . 5.

Identify who is currently logged on to the training system PSM and create a Favorites menu for your user. enter /nS000 in the command field.TAW10_1 Unit 2 Solution 3 Solution 3: Call Functions . Run transaction code SM04. 2. In this case. On the SAP Easy Access screen. Exit the user overview by using either the F3 key or the Back pushbutton in the standard toolbar. Task 1 Find out various ways of viewing the user overview. Business Example As an end user. which takes you directly to the user overview. familiarize yourself with various ways of calling functions. Run the transaction for displaying a list of users who are logged on. . 1. Note that this menu path might not be available in your training system by default. a) See the exercise for the solution. choose Tools → Administration → Monitor → System Monitoring → User Overview.

To view the user overview. The transaction is saved in the Favorites area. Save the frequently used transactions in a Favorites menu. On the SAP Easy Access screen. choose Tools → Administration → Monitor → System Monitoring → User Overview on the SAP Easy Access screen. 1. Task 2 Create a Favorites menu. a) See the exercise for the solution. you can use a drag-and-drop action or the context menu to copy transactions into the Favorites area. Choose the transaction entry. Hint: Alternatively. a) See the exercise for the solution. .TAW10_1 Unit 2 Solution 3 Solution 3: Call Functions . choose Favorites → Add. The context menu is opened by a right-click action.

enter the desired transaction. a) On the SAP Easy Access screen. Add transactions RSPFPAR. c) Choose the Continue pushbutton. 3. choose Favorites → Insert transaction.TAW10_1 Unit 2 Solution 3 Solution 3: Call Functions . 4. 2. and SEARCH_USER_MENU to the Favorites menu without expanding the SAP menu. SEARCH_SAP_MENU. a) On the SAP Easy Access screen. . d) Execute these steps for every transaction. when inserting with the previous selection in the menu. Create a folder Search Options in which you can store both search transactions. Can you distinguish between the favorites entries by the method used to insert them? a) Yes. choose Favorites → Insert folder. b) In the Transaction Code field. a part of the path information of the menu access is stored as a favorites text.

a) Run the search transaction SEARCH_SAP_MENU.TAW10_1 Unit 2 Solution 3 Solution 3: Call Functions . enter search options. 5. c) Transaction SM04 is stored three times in different paths in the SAP menu. enter SM04. c) Drag both the search transactions SEARCH_SAP_MENU and SEARCH_USER_MENU to the file. Find out how often and where transaction SM04 for the user overview is stored in the SAP menu. b) In the Folder Name field. b) In the Search text entry field. Transaction SM04 Path on the SAP Easy Access screen Tools → Administration → Monitor →  System Monitoring → User Overview . as shown in the following table.

you can search in the user menu. . Transaction SM04 Path on the SAP Easy Access screen Tools → Administration → Monitor →  Performance → Exceptions/ User → Active User → Local User Tools → CCMS → Control/ Monitoring → Performance → Excepti ons/User → Active User → Local User SM04 In the same way.TAW10_1 Unit 2 Solution 3 Solution 3: Call Functions .

TAW10_1 Summary You should now be able to: ● Call functions in ABAP-based systems .

Unit 2 A. User master record C. Stored record . User record B.TAW10_1 The user data in SAP systems is called the ______________________. Choose the correct answer.

User master record . Unit 2 B.TAW10_1 The user data in SAP systems is called the ______________________.

TAW10_1 Determine whether this statement is true or false." . Unit 2 "You can work in only one window (session) at a time in an SAP system.

TAW10_1 Determine whether this statement is true or false. Unit 2 "You can work in only one window (session) at a time in an SAP system." False .

Choose the correct answers. Unit 2 A. From SAP Easy Access: search_sap_menu . /nex C. ?SM04 D.TAW10_1 The following strings are valid entries in the command field in the SAP Easy Access screen. /nend B. From SAP Easy Access: SM04 F. /nsm04 E.

Unit 2 A. /nex D. From SAP Easy Access: SM04 F. /nend B. From SAP Easy Access: search_sap_menu . /nsm04 E.TAW10_1 The following strings are valid entries in the command field in the SAP Easy Access screen.

A client may represent an entire company. C. A client corresponds to a customer. A client represents a completely independent business entity.TAW10_1 Identify the statements that accurately describe a client in an SAP system. A client has its own database. B. D. . Choose the correct answers. Unit 2 A.

. A client represents a completely independent business entity. D. Unit 2 A. A client may represent an entire company.TAW10_1 Identify the statements that accurately describe a client in an SAP system.

Current users B.TAW10_1 Only ___________ can change the entries of the SAP and user menus. Unit 2 A. System administrators . Choose the correct answer.

TAW10_1 Only ___________ can change the entries of the SAP and user menus. Unit 2 B. System administrators .

Unit 3: The System Core Lesson 1: Exploiting the SAP NetWeaver Application Server Architecture Lesson 2: Distinguishing the Processes of SAP NetWeaver AS Java and ABAP Lesson 3: Processing AS ABAP Requests Lesson 4: Explaining AS ABAP Processes .

TAW10_1 Unit 3 Lesson 1 Lesson 1: Exploiting the SAP NetWeaver Application Server Architecture Lesson Objectives After completing this lesson. you will be able to: ● Understand the architecture of SAP NetWeaver AS .

TAW10_1 Unit 3 Lesson 1 SAP NetWeaver provides the following runtime environments: ● ABAP runtime environment (AS ABAP) ● Java runtime environment (AS Java) .

TAW10_1 Figure 26: Hardware-Oriented and SoftwareOriented Views Unit 3 Lesson 1 .

TAW10_1 Figure 27: Simple Client/Server Configurations Unit 3 Lesson 1 .

TAW10_1 Figure 28: The Instance of an SAP System (Example) Unit 3 Lesson 1 .

TAW10_1 Summary You should now be able to: ● Understand the architecture of SAP NetWeaver AS .

you will be able to: ● ● Identify the processes that run on SAP NetWeaver AS Plan the system architecture of different types of SAP NetWeaver AS .TAW10_1 Unit 3 Lesson 2 Lesson 2: Distinguishing the Processes of SAP NetWeaver AS Java and ABAP Lesson Objectives After completing this lesson.

TAW10_1 Figure 29: AS ABAP Processes Unit 3 Lesson 2 .

TAW10_1 Figure 30: SAP NetWeaver AS Java Processes 7.0x and Lower Unit 3 Lesson 2 .

1x and Higher Unit 3 Lesson 2 .TAW10_1 Figure 31: Processes in SAP NetWeaver AS Java 7.

TAW10_1 Figure 32: Possible Types of SAP NetWeaver AS (7.0x and lower Versions) Unit 3 Lesson 2 .

TAW10_1 Figure 33: Possible Types of SAP NetWeaver AS (7.10 and Higher) Unit 3 Lesson 2 .

TAW10_1 Figure 34: Architecture of AS ABAP (7.0x and Lower) Unit 3 Lesson 2 .

TAW10_1 Figure 35: Architecture of AS Java 7.0 and Lower Unit 3 Lesson 2 .

1x and Higher Unit 3 Lesson 2 .TAW10_1 Figure 36: Architecture of AS Java 7.

TAW10_1 Figure 37: Architecture of AS ABAP + Java 7.0x and Lower Unit 3 Lesson 2 .

1x and Higher Unit 3 Lesson 2 .TAW10_1 Figure 38: Architecture of AS ABAP + Java 7.

Which AS Java instances exist in system PSM? . Business Example As the system administrator. 1. With which instance are you currently working in system PSM? 2. you need to have an overview of the processes of your SAP system. Determine the number of instances that an SAP system can have.TAW10_1 Unit 3 Exercise 4 Exercise 4: Determine the Structure of an Instance . Which (AS ABAP) instances does training system PSM offer? Which services are provided? What is the system number of the central instance of the system? 3.

choose System → Status. b) On the SAP Easy Access screen. 1. you need to have an overview of the processes of your SAP system. With which instance are you currently working in system PSM? a) Log on to the SAP Easy Access screen by using the SAP GUI for Windows. Determine the number of instances that an SAP system can have. 2. Business Example As the system administrator. c) The name of the instance to which you are logged on is available in the Server Name field and has the structure: <computer name>_<SID>_<instance number>.TAW10_1 Unit 3 Solution 4 Solution 4: Determine the Structure of an Instance . Which (AS ABAP) instances does training system PSM offer? Which services are provided? What is the system number of the central instance of the system? .

. you can recognize this instance by the message type enqueue. d) In transaction SM51. b) You can see a list of all AS ABAP instances that were started and the services provided. 3. run transaction code SM51 (alternatively. b) Run the start page of the AS Java of in SAP system PSM. c) The instance in which the enqueue work process is configured is the central instance.TAW10_1 Unit 3 Solution 4 Solution 4: Determine the Structure of an Instance . choose Tools → Administration → Monitor → System Monitoring → Servers). Which AS Java instances exist in system PSM? a) Start a Web browser. a) On the SAP Easy Access screen.

f) You see information about the AS Java instances and central services (SCS).corp:58000/ d) On the AS Java homepage. e) Log on with the user and password provided by the instructor. for example http://twdf1928. . c) You reach the start page at http://<host name>:<port-number>.sap.TAW10_1 Unit 3 Solution 4 Solution 4: Determine the Structure of an Instance .wdf. choose the System Information link.

TAW10_1 Summary You should now be able to: ● Identify the processes that run on SAP NetWeaver AS ● Plan the system architecture of different types of SAP NetWeaver AS .

TAW10_1 Unit 3 Lesson 3 Lesson 3: Processing AS ABAP Requests Lesson Objectives After completing this lesson. you will be able to: ● Describe the processing of requests in AS ABAP .

TAW10_1 Figure 39: Processing a User Request in ABAP Unit 3 Lesson 3 .

TAW10_1 Figure 40: Process Flow for Requests Unit 3 Lesson 3 .

TAW10_1 Figure 41: Flow of a Database Query Unit 3 Lesson 3 .

TAW10_1 Figure 42: Multiplexing of Dialog Work Processes Unit 3 Lesson 3 .

choose Tools → Administration → Monitor → System Monitoring → Process Overview). How many dialog work processes are there on the instance to which you are logged on? 2. Click Refresh several times in the process overview. on SAP Easy Access screen. Use transaction SM50 to answer the following questions (alternatively.TAW10_1 Unit 3 Exercise 5 Exercise 5: List the Work Processes Configured on an Instance of AS ABAP . Business Example You want to gain an overview of the configured work processes and their current statuses. Are your queries always processed by the same work process? . 1.

Use transaction SM50 to answer the following questions (alternatively. choose Tools → Administration → Monitor → System Monitoring → Process Overview). . run transaction code SM50. This action displays the numbers of dialog work processes. How many dialog work processes are there on the instance to which you are logged on? a) On the SAP Easy Access screen. b) Count the work processes of the type DIA. on SAP Easy Access screen.TAW10_1 Unit 3 Solution 5 Solution 5: List the Work Processes Configured on an Instance of AS ABAP . Business Example You want to gain an overview of the configured work processes and their current statuses. Transaction SM50 displays the work processes on the instance to which you are currently logged on. 1.

run transaction SM66. If you want to display the work processes for the entire SAP system.) 2. you need to make the appropriate settings by using the Select process and the Settings pushbuttons. (In this case.TAW10_1 Unit 3 Solution 5 Solution 5: List the Work Processes Configured on an Instance of AS ABAP . Find your work process by finding your user name in the User Names column.   . You may find that your queries are processed by various work processes. Are your queries always processed by the same work process? a) In transaction SM50. choose the Refresh pushbutton. Click Refresh several times in the process overview.

TAW10_1 Summary You should now be able to: ● Describe the processing of requests in AS ABAP .

you will be able to: ● ● Describe the processing of transactions in AS ABAP Explain ABAP processes and their purposes .TAW10_1 Unit 3 Lesson 4 Lesson 4: Explaining AS ABAP Processes Lesson Objectives After completing this lesson.

TAW10_1 Figure 43: Relationship Between Database and SAP Transactions Unit 3 Lesson 4 .

TAW10_1 Figure 44: Lock Management in AS ABAP Unit 3 Lesson 4 .

TAW10_1 Figure 45: The Principle of Asynchronous Updates Unit 3 Lesson 4 .

TAW10_1 Figure 46: Asynchronous Updates Unit 3 Lesson 4 .

Learn how lock administration works in SAP systems. In another window.TAW10_1 Unit 3 Exercise 6 Exercise 6: Set and Monitor Lock Entries . Change your user data. Business Example You want to know how enqueue (lock) handling works in AS ABAP. try changing your own user data again. 4. 3. 2. Open a new window and check the list of lock entries to determine the tables on which a lock has been set. Close the window displaying your user data that is ready for change. 1. What happens to the lock entries? .

1. Learn how lock administration works in SAP systems. choose System → User Profile → Own Data).TAW10_1 Unit 3 Solution 6 Solution 6: Set and Monitor Lock Entries . . Note: Your user data is now exclusively locked at the SAP system level. 2. Change your user data. a) On the SAP Easy Access screen. run transaction code SU3 for maintaining some of your user data (alternatively. choose System → Create Session to open a new window. a) On the SAP Easy Access screen. Business Example You want to know how enqueue (lock) handling works in AS ABAP. Open a new window and check the list of lock entries to determine the tables on which a lock has been set.

Note: The system returns an information message that the requested data is already in change access by another user (in this case. choose Tools → Administration → Monitor → Lock Entries). You see a lock entry (held by your user) for your data record in table USR04. c) Press ENTER without changing the default values. yourself). Because transaction SU3 is always in change mode.TAW10_1 Unit 3 Solution 6 Solution 6: Set and Monitor Lock Entries . (choose System → Create Session) run transaction SU3 again to open the second window. you are required to use transaction SU01 to display the user data that is currently being changed. 3. try changing your own user data again. . a) On the SAP Easy Access screen. In another window. b) Run transaction code SM12 (alternatively. Data locked can still be viewed.

Close the window displaying your user data that is ready for change. . What happens to the lock entries? a) To end your user change window. the lock on table USR04 will not appear.TAW10_1 Unit 3 Solution 6 Solution 6: Set and Monitor Lock Entries . run transaction code SM04 (alternatively. choose Tools → Administration → System Administration → Monitor → System Monitoring → User Overview). d) If you now select your current lock entries by using transaction SM12. b) Select your user and choose the Sessions pushbutton. c) Position the cursor on the Maintain Users Own Data row and choose the End Session pushbutton. 4.

TAW10_1 Unit 3 Solution 6 Solution 6: Set and Monitor Lock Entries . . the locks held by the action are deleted. Note: If an action terminates in an SAP system (whether deliberately or not).

TAW10_1 Figure 47: Printing in AS ABAP Unit 3 Lesson 4 .

You must also be able to explain the difference between spool requests and output requests. Display your own spool requests and generate an output request from the spool request.TAW10_1 Unit 3 Exercise 7 Exercise 7: Print a Screenshot in AS ABAP . 1. 2. Print the list of work processes. For this reason. . you must be able to print a screenshot in AS ABAP. Call transaction SM50. Print the list. Print a simple list and generate an output request from a spool request. Business Example System administration needs a list of the work processes set up on each instance.

b) Use the F4 help to select an Output Device.TAW10_1 Unit 3 Solution 7 Solution 7: Print a Screenshot in AS ABAP . You must also be able to explain the difference between spool requests and output requests. 1. such as LP01. Print the list. . a) Call transaction SM50 (alternatively. Print the list of work processes. For this reason. choose Tools → Administration → Monitor → System Monitoring → Process Overview and choose Print (Ctrl + P). you must be able to print a screenshot in AS ABAP. c) Choose Continue to confirm your setting in the displayed dialog box. and choose Continue. Business Example System administration needs a list of the work processes set up on each instance. Call transaction SM50. Print a simple list and generate an output request from a spool request.

you will not be able to print to paper. Because there is no printer connected to the training system. choose System → Own Spool Requests. . c) Select your spool request and choose the Output Requests pushbutton to display the output requests for your spool request. a) On the SAP Easy Access screen. Check the status and the number of pages of your spool request. Display your own spool requests and generate an output request from the spool request. b) Select your spool request and choose Print directly pushbutton to create an output request for the spool request you selected. 2. The status text Waiting for output formatter is displayed.TAW10_1 Unit 3 Solution 7 Solution 7: Print a Screenshot in AS ABAP .

TAW10_1 Figure 48: Scheduling Background Tasks (Jobs) Unit 3 Lesson 4 .

2. you need to schedule the execution of a report in the background. Call transaction SA38 to execute report RSUSR000 in the background. Business Example As a system administrator or an end user.TAW10_1 Unit 3 Exercise 8 Exercise 8: Schedule a Simple Report in the Background . 1. Display the result of the job. Differentiate between executing a report in dialog mode and background mode. On the SAP Easy Access screen. Schedule and monitor jobs. run transaction code SA38 (System → Services → Reporting) and select report RSUSR000 in the dialog mode. . Schedule the execution of a simple job.

2. Business Example As a system administrator or an end user. run transaction SA38.TAW10_1 Unit 3 Solution 8 Solution 8: Schedule a Simple Report in the Background . Display the result of the job. you need to schedule the execution of a report in the background. Schedule and monitor jobs. 1. Users who are logged on are listed. run transaction code SA38 (System → Services → Reporting) and select report RSUSR000 in the dialog mode. On the SAP Easy Access screen. Call transaction SA38 to execute report RSUSR000 in the background. . Differentiate between executing a report in dialog mode and background mode. enter the report name RSUSR000 in the Program field and choose the Execute pushbutton. a) On the SAP Easy Access screen. Schedule the execution of a simple job. b) On the ABAP Editor: Initial Screen screen.

you will not be able to see the result of the job soon. Ensure that the execution time is not too far in the future (about 2 minutes. c) Choose the Background pushbutton. Make sure that the Job Name and Execution Time have been entered. You can also choose the Schedule pushbutton. select System → Own Jobs. b) On the ABAP: Program Execution screen. a) On the SAP Easy Access screen. e) Then choose the Schedule once pushbutton. . f) On the Schedule Report screen. Otherwise. for example). run transaction code SA38. d) Choose the Execute immed pushbutton.TAW10_1 Unit 3 Solution 8 Solution 8: Schedule a Simple Report in the Background . enter the report name RSUSR000 in the Program field. You will see the job you just scheduled in the displayed list.

If the job is marked as “finished”. To display the result. it is finished. Select the spool request and choose the Display contents pushbutton. and you can display the result in the form of a spool list. select the job and then choose the Spool pushbutton.TAW10_1 Unit 3 Solution 8 Solution 8: Schedule a Simple Report in the Background . you have to wait until the execution time you selected has passed. If the job is marked as “released”. . You can see a list of users who were logged on at the time the job was executed.

TAW10_1 Figure 49: Gateway Communication Unit 3 Lesson 4 .

0x or Lower Unit 3 Lesson 4 .TAW10_1 Figure 50: Processing Web Request for 7.

TAW10_1 Summary You should now be able to: ● Describe the processing of transactions in AS ABAP ● Explain ABAP processes and their purposes .

Unit 3 "Java is an object-oriented and a platform-independent programming language.TAW10_1 Determine whether this statement is true or false. " .

Unit 3 "Java is an object-oriented and a platform-independent programming language. " True .TAW10_1 Determine whether this statement is true or false.

Unit 3 "In a two-tier client/server configuration.TAW10_1 Determine whether this statement is true or false." . each layer runs on its own hosts.

Unit 3 "In a two-tier client/server configuration. each layer runs on its own hosts.TAW10_1 Determine whether this statement is true or false." False .

None of the above . Load balancing D. Simpler administration C.TAW10_1 Unit 3 What are the advantages of a three-tier client/server configuration as compared with a single-tier or two-tier configuration? Choose the correct answers. A. Simpler scalability B.

TAW10_1 Unit 3 What are the advantages of a three-tier client/server configuration as compared with a single-tier or two-tier configuration? A. Simpler scalability C. Load balancing .

" . Unit 3 "The Software Deployment Manager (SDM) is the standard tool used to install ABAP software components.TAW10_1 Determine whether this statement is true or false.

Unit 3 "The Software Deployment Manager (SDM) is the standard tool used to install ABAP software components." False .TAW10_1 Determine whether this statement is true or false.

TAW10_1 Determine whether this statement is true or false.

Unit 3

"The gateway reader enables communication between SAP systems or between SAP systems and external application systems. "

TAW10_1 Determine whether this statement is true or false.

Unit 3

"The gateway reader enables communication between SAP systems or between SAP systems and external application systems. " True

TAW10_1 Determine whether this statement is true or false.

Unit 3

"Data does not need to be read from the database every time it is required in an instance. But the data can be called quickly from the buffer."

TAW10_1 Determine whether this statement is true or false.

Unit 3

"Data does not need to be read from the database every time it is required in an instance. But the data can be called quickly from the buffer." True

TAW10_1 __________________________ is used to manage large sets of data. Choose the correct answer.

Unit 3

A. A Graphical User Interface (GUI) B. A Relational Database Management System C. A Dynpro processor D. An ABAP dispatcher

TAW10_1 __________________________ is used to manage large sets of data.

Unit 3

B. A Relational Database Management System

TAW10_1 Identify the types of work processes in an AS ABAP system. Choose the correct answers.

Unit 3

A. Dialog work process B. Message Server process C. Update work process D. Internet Communication Manager (ICM) process E. Background work process F. Enqueue work process G. Spool work process

TAW10_1 Identify the types of work processes in an AS ABAP system.

Unit 3

A. Dialog work process C. Update work process E. Background work process F. Enqueue work process G. Spool work process

TAW10_1 In ___________, several users can have read access to locked data at the same time. Choose the correct answer.

Unit 3

A. Write locks B. Read locks C. Enhanced write locks D. Optimistic locks

TAW10_1 In ___________, several users can have read access to locked data at the same time.

Unit 3

B. Read locks

Unit 4: Communication and Integration Technologies
Lesson 1: Integrating Existing Applications with SAP Applications Lesson 2: Linking Cross-System Business Processes Lesson 3: Working with Web Services on SAP NetWeaver Application Server Lesson 4: Explaining Service-Oriented Architecture

TAW10_1

Unit 4 Lesson 1

Lesson 1: Integrating Existing Applications with SAP Applications Lesson Objectives
After completing this lesson, you will be able to:

Explain RFCs, the Business Object Repository (BOR), and BAPIs

TAW10_1

Figure 51: Interface Technologies Used in SAP Systems

Unit 4 Lesson 1

TAW10_1

Figure 52: Options for Connections Using Remote Function Call

Unit 4 Lesson 1

TAW10_1

Figure 53: Remote Function Call in Detail

Unit 4 Lesson 1

TAW10_1

Figure 54: Business Object Repository and Business Application Programming Interfaces

Unit 4 Lesson 1

TAW10_1

Unit 4 Exercise 9

Exercise 9: Use a Business Application Programming Interface
. Business Example You require user data from another SAP system. Use a BAPI to display the address data for your user in the system. 1. Start the overview transaction for the BOR. 2. Find the USER.Change method. Display the documentation for this method. 3. Call the Function Builder for the USER.Display method. You can now see the source code for the BAPI in the Function Builder. 4. Execute this BAPI for your user with the RFC destination NONE. 5. Once you confirm the dialog box, the result screen for the query is displayed. You can view the return code and the response time for your query.

TAW10_1

Unit 4 Solution 9

Solution 9: Use a Business Application Programming Interface
. Business Example You require user data from another SAP system. Use a BAPI to display the address data for your user in the system. 1. Start the overview transaction for the BOR. a) On the SAP Easy Access screen, choose Tools → ABAP Workbench → Development → Business Object Builder or enter transaction SWO1. If you are following the Business Object Builder menu path, select BAPI in the dialog box. 2. Find the USER.Change method. Display the documentation for this method. a) Choose the Alphabetical tab page. Then, on the BAPI Explorer screen, look for the User business object.

TAW10_1

Unit 4 Solution 9

Solution 9: Use a Business Application Programming Interface
. From the BAPIs available for this business object, choose the USER.Change BAPI. Use the appropriate tab page to display the documentation for this BAPI on the right side of the BAPI Explorer screen. 3. Call the Function Builder for the USER.Display method. You can now see the source code for the BAPI in the Function Builder. a) Switch to the USER.Display BAPI. b) On the Tools tab page, choose the Function Builder. c) Choose the Display pushbutton. 4. Execute this BAPI for your user with the RFC destination NONE. a) On the Function Builder screen, choose the Test/Execute pushbutton.

TAW10_1

Unit 4 Solution 9

Solution 9: Use a Business Application Programming Interface
. b) On the Test Function Module: Initial Screen, enter NONE in the RFC target system entry field (which refers to your system). c) Enter your user name on the query screen (for example, SAPTEC-04). d) Choose the Execute pushbutton. Your user data, which is requested through RFC by the BAPI, is displayed. 5. Once you confirm the dialog box, the result screen for the query is displayed. You can view the return code and the response time for your query. a) The return code for your query is displayed as the value for the export parameter Return on the Test Function Module: Result Screen.

TAW10_1

Summary
You should now be able to:

● Explain RFCs, the Business Object Repository (BOR), and BAPIs

TAW10_1 Unit 4 Lesson 2 Lesson 2: Linking Cross-System Business Processes Lesson Objectives After completing this lesson. you will be able to: ● Describe ALE .

TAW10_1 Figure 55: Distribution of Business Processes by Using Application Link Enabling Unit 4 Lesson 2 .

TAW10_1 Unit 4 Lesson 2 Process Identify the information to be transmitted e-Commerce for Consumers Using SAP CRM Sequence of data from the SAP CRM system. which is to be passed to an ERP back end IDoc format By remote function call (RFC) Asynchronously. every 60 seconds Provision of goods and/or services for sale on the Internet Specify the format of the data to be transferred Decide the technology for transfer Decide the type of transfer Decide the objective of transfer .

TAW10_1 Summary You should now be able to: ● Describe ALE .

you will be able to: ● Work with Web services on SAP NetWeaver AS .TAW10_1 Unit 4 Lesson 3 Lesson 3: Working with Web Services on SAP NetWeaver Application Server Lesson Objectives After completing this lesson.

TAW10_1 Figure 56: Outline of a Web Service Scenario Unit 4 Lesson 3 .

TAW10_1 Figure 57: Logical Port (Consumer) – Service Endpoint (Provider) Unit 4 Lesson 3 .

TAW10_1 Summary You should now be able to: ● Work with Web services on SAP NetWeaver AS .

you will be able to: ● ● Describe SOA in the context of SAP Differentiate between Web and enterprise services for SOA .TAW10_1 Unit 4 Lesson 4 Lesson 4: Explaining Service-Oriented Architecture Lesson Objectives After completing this lesson.

TAW10_1 Figure 58: A Brief History of Service-Oriented Architecture Unit 4 Lesson 4 .

TAW10_1 Figure 59: Service-Oriented Architecture in the Context of SAP Unit 4 Lesson 4 .

TAW10_1 Summary You should now be able to: ● Describe SOA in the context of SAP ● Differentiate between Web and enterprise services for SOA .

The Business Object Repository (BOR) B. A Business Application Programming Interface (BAPI) C. Application Link Enabling (ALE) .TAW10_1 _____________ facilitates internal and external access to business processes and data in SAP systems. Unit 4 A. Choose the correct answer.

A Business Application Programming Interface (BAPI) .TAW10_1 _____________ facilitates internal and external access to business processes and data in SAP systems. Unit 4 B.

SAP Transfer Protocol .TAW10_1 Multiple Choice Unit 4 Identify the interfaces and communication options that are supported by SAP systems. Simple Mail Transfer Protocol (SMTP) C. Business Application Programming Interfaces (BAPIs) E. HyperText Transfer Protocol (HTTP) B. Extended Data Transfer Protocol F. Choose the correct answers. Remote Function Call (RFC) D. A.

A.TAW10_1 Multiple Choice Unit 4 Identify the interfaces and communication options that are supported by SAP systems. Remote Function Call (RFC) D. HyperText Transfer Protocol (HTTP) B. Simple Mail Transfer Protocol (SMTP) C. Business Application Programming Interfaces (BAPIs) .

TAW10_1 Unit 4 For which of the following functions can Business Application Programming Interfaces (BAPIs) be used? Choose the correct answers. Request data from an SAP system B. Transfer SAP screen images to third-party applications (such as Microsoft Word) D. Pass data to an SAP system C. Access business processes in SAP systems . A.

Access business processes in SAP systems .TAW10_1 Unit 4 For which of the following functions can Business Application Programming Interfaces (BAPIs) be used? A. Request data from an SAP system B. Pass data to an SAP system D.

Remote Function Call. function. Function B. They are accessed using the ____________ interface. function C. Function. Remote Function Call. Choose the correct answer. function. A. They are created and managed using the ___________ Builder. Remote Function Call. function D. Application.TAW10_1 Unit 4 Business __________ Programming Interfaces (BAPIs) are specialized ___________ modules. Remote Function Call. Application. Application . Application. Function. Function.

Application. function. Function . A. They are accessed using the ____________ interface.TAW10_1 Unit 4 Business __________ Programming Interfaces (BAPIs) are specialized ___________ modules. They are created and managed using the ___________ Builder. Remote Function Call.

Communicate between the systems of your system landscape E. Exchange data exclusively between SAP systems of the same release B. but only between SAP applications C. Unit 4 A.TAW10_1 What action can you perform with Application Link Enabling (ALE)? Choose the correct answers. Exchange data across system boundaries. using certain formats and technologies D. Exchange data between collaborating enterprises. Update your order data using the appropriate Business Application Programming Interface (BAPI) (only once every 24 hours) .

Exchange data between collaborating enterprises.TAW10_1 What action can you perform with Application Link Enabling (ALE)? Unit 4 C. Communicate between the systems of your system landscape . using certain formats and technologies D.

" . Unit 4 "Composite processes are extensions of SAP Business Suite.TAW10_1 Determine whether this statement is true or false.

Unit 4 "Composite processes are extensions of SAP Business Suite.TAW10_1 Determine whether this statement is true or false." True .

Unit 5: Flow of an ABAP Program Lesson 1: Describing the Processing of ABAP Programs .

TAW10_1 Unit 5 Lesson 1 Lesson 1: Describing the Processing of ABAP Programs Lesson Objectives After completing this lesson. you will be able to: ● ● Describe the SAP NetWeaver Application Server architecture Describe the execution of a simple dialog program by the ABAP runtime system .

TAW10_1 Figure 60: Client/Server Architecture of SAP NetWeaver AS Unit 5 Lesson 1 .

TAW10_1 Figure 61: Excerpt for an ABAP Program Unit 5 Lesson 1 .

TAW10_1 Figure 62: View for the User Unit 5 Lesson 1 .

TAW10_1 Figure 63: Interplay Between Server Levels and Program Flow Unit 5 Lesson 1 .

TAW10_1 Figure 64: Program Start Unit 5 Lesson 1 .

TAW10_1 Figure 65: System Loads Program Context Unit 5 Lesson 1 .

TAW10_1 Figure 66: Runtime System Sends Selection Screen Unit 5 Lesson 1 .

TAW10_1 Figure 67: Input Values Are Inserted into Data Objects Unit 5 Lesson 1 .

TAW10_1 Figure 68: Reuse Unit is Loaded Unit 5 Lesson 1 .

TAW10_1 Figure 69: Reuse Unit is Called Unit 5 Lesson 1 .

TAW10_1 Figure 70: Program Requests Data Record from the Database Unit 5 Lesson 1 .

TAW10_1 Figure 71: Database Supplies the Data Record Unit 5 Lesson 1 .

TAW10_1 Figure 72: Reuse Unit Returns the Data Unit 5 Lesson 1 .

TAW10_1 Figure 73: Runtime System Sends the List Unit 5 Lesson 1 .

TAW10_1 Unit 5 Lesson 1 The table of contents for the course is as follows: ● Unit 1: Flow of an ABAP Program ● Unit 2: ABAP Workbench Introduction ● Unit 3: Basic ABAP Language Elements ● Unit 4: Modularization ● Unit 5: Complex Data Objects ● Unit 6: Data Modeling and Data Retrieval ● Unit 7: Classic ABAP Report ● Unit 8: Screen ● Unit 9: SAP List Viewer ● Unit 10: Web Dynpro ABAP ● Unit 11: Program AnalysisTool .

TAW10_1 Unit 5 Lesson 1 The table of contents for the course is as follows: ● Unit 12: SAP Standard Software Adjustments .

TAW10_1 Summary You should now be able to: ● Describe the SAP NetWeaver Application Server architecture ● Describe the execution of a simple dialog program by the ABAP runtime system .

TAW10_1

Unit 5

Which of the following levels contains the user interface where each user can access a program, enter new data, and receive the results of a work process? Choose the correct answer.

A. Application server level B. Presentation server level C. Application logic level D. SAP NetWeaver Application

TAW10_1

Unit 5

Which of the following levels contains the user interface where each user can access a program, enter new data, and receive the results of a work process?

B. Presentation server level

TAW10_1

Unit 5

When a program is not made up of a single block but of several units, the concept is referred to as ______. Choose the correct answer.

A. Isolation B. Modularity C. Universality D. Multiplicity

TAW10_1

Unit 5

When a program is not made up of a single block but of several units, the concept is referred to as ______.

B. Modularity

Unit 6: ABAP Workbench Introduction
Lesson 1: Introducing the ABAP Development Environment Lesson 2: Organizing ABAP Developments Lesson 3: Developing Programs Lesson 4: Finalizing Development

TAW10_1

Unit 6 Lesson 1

Lesson 1: Introducing the ABAP Development Environment Lesson Objectives
After completing this lesson, you will be able to:

● ● ●

Describe the structure of the ABAP Repository Use the search tools of the ABAP Repository Use the Object Navigator for displaying Repository objects

TAW10_1

Figure 74: The Cross-Client Capability of the Repository

Unit 6 Lesson 1

TAW10_1

Figure 75: Structure of Repository

Unit 6 Lesson 1

TAW10_1

Figure 76: Repository Information System

Unit 6 Lesson 1

TAW10_1

Figure 77: SAP Application Hierarchy

Unit 6 Lesson 1

TAW10_1

Figure 78: ABAP Workbench Tools

Unit 6 Lesson 1

TAW10_1

Figure 79: Screen Layout in the Object Navigator

Unit 6 Lesson 1

TAW10_1

Figure 80: Working with the Navigation Area

Unit 6 Lesson 1

TAW10_1

Figure 81: Functions in the Tool Area

Unit 6 Lesson 1

TAW10_1

Figure 82: Synchronizing the Navigation and Tool Areas

Unit 6 Lesson 1

TAW10_1

Summary
You should now be able to:

● Describe the structure of the ABAP Repository ● Use the search tools of the ABAP Repository ● Use the Object Navigator for displaying Repository objects

TAW10_1

Unit 6 Lesson 2

Lesson 2: Organizing ABAP Developments Lesson Objectives
After completing this lesson, you will be able to:

● ●

Describe the ABAP development infrastructure Create packages

TAW10_1

Figure 83: Transporting Development Objects

Unit 6 Lesson 2

TAW10_1

Figure 84: Organization of a Development Project in a Change Request

Unit 6 Lesson 2

TAW10_1

Figure 85: Setting Package Attributes (Example)

Unit 6 Lesson 2

TAW10_1

Figure 86: Specifying a Transport Route

Unit 6 Lesson 2

TAW10_1 Figure 87: Assignment to a Change Request Unit 6 Lesson 2 .

Press F5 to create the object. choose the Package object type and enter the name of the package in the input field below. In the dialog box. Press ENTER. If the specified package does not already exist. the system will branch off to a dialog to create a package. You have the following options: a) In the navigation area. 2. Assign the package to a change request.TAW10_1 Unit 6 Lesson 2 Procedure: To Create a Package 1. search for the option of specifying a package and enter the name of the package. Navigate to the Object Navigator. b) Choose the Edit Object pushbutton on the initial screen of the Object Navigator. 3. . Set the attributes of the package to be created. ensuring that you comply with the customer namespace conventions.

and initial password given to you by your instructor.TAW10_1 Unit 6 Exercise 10 Exercise 10: Create a Package . . you have to create a package. 1. where ## represents the group number given to you by your instructor. Task 2 Create a package named ZBC400_##. Business Example You are a developer for an airline group and have been given the task of developing evaluation programs for several airline companies. Create a package. Enter a new personal password. To group Repository objects logically and transport them. Log on to the training system. 2. Task 1 Log on to the training system. user name. Use the client.

. 1. In the following dialog box.TAW10_1 Unit 6 Exercise 10 Exercise 10: Create a Package . You have successfully created your own package. enter a short description of your package. 3. assign the package to a change request. Assign the package to the application component CA and the software component HOME. Open the Object Navigator and create the package there. Use the change request in which the instructor has already created a task for your user. Take the default value for all the other input fields in the dialog box. 2. In the dialog box that appears. Use the same change request in each case. Hint: To determine this request. Assign all Repository objects that you create in the following exercises to this package. choose the Own Requests pushbutton.

Task 2 Create a package named ZBC400_##. and initial password given to you by your instructor. Use the client. where ## represents the group number given to you by your instructor. Task 1 Log on to the training system. Log on to the training system. 1. Create a package. 2. user name. Business Example You are a developer for an airline group and have been given the task of developing evaluation programs for several airline companies. To group Repository objects logically and transport them. Enter a new personal password. . you have to create a package.TAW10_1 Unit 6 Solution 10 Solution 10: Create a Package .

assign the package to a change request. a) Enter a short description for your package and choose Continue. 2. choose the Own Requests pushbutton. Use the change request in which the instructor has already created a task for your user. In the dialog box that appears. Open the Object Navigator and create the package there.TAW10_1 Unit 6 Solution 10 Solution 10: Create a Package . Hint: To determine this request. select Package and enter ZBC400_## in the next field and return. Assign the package to the application component CA and the software component HOME. . a) Open the Object Navigator using transaction SE80. In the following dialog box. b) In the drop-down menu. 1. 3. enter a short description of your package. Take the default value for all the other input fields in the dialog box.

Use the same change request in each case. Assign all Repository objects that you create in the following exercises to this package. .TAW10_1 Unit 6 Solution 10 Solution 10: Create a Package . You have successfully created your own package.

TAW10_1 Summary You should now be able to: ● Describe the ABAP development infrastructure ● Create packages .

TAW10_1 Unit 6 Lesson 3 Lesson 3: Developing Programs Lesson Objectives After completing this lesson. you will be able to: ● ● ● Create ABAP programs Use the ABAP Editor Activate ABAP programs .

TAW10_1 Figure 88: Creating an ABAP Program Unit 6 Lesson 3 .

TAW10_1 Unit 6 Lesson 3 Procedure: To Create an ABAP Program 1. Remove the flag for With TOP Include. To create the object. to prevent your source code from being distributed to several programs. the system goes to the dialog that allows you to create a program. ensuring that you comply with the customer namespace conventions. If the program does not exist. choose the Program object type and enter the name of the program in the input field. . You can branch to the dialog for creating a program using the context menu for the package or the Programs node. 2. Press ENTER. Navigate to the Object Navigator using any of the following options: a) In the navigation area. In the dialog box. c) Choose the Edit Object pushbutton on the initial screen of the Object Navigator. press F5. choose the Program tab page and enter the name of the program. b) Display the package in which you want to create the program.

All other program attributes are optional. press F1. choose Executable Program as the program type. To access help or get more details. Change the title to a self-explanatory short text and.TAW10_1 Unit 6 Lesson 3 Procedure: To Create an ABAP Program 3. for the purposes of this course. .

● It is upward-compatible.TAW10_1 Unit 6 Lesson 3 The features of the ABAP programming language are as follows: ● It is typed. ● It is platform-independent. ● It enables SQL access. ● It enables multi-language application. . ● It is enhanced as an object-oriented language.

TAW10_1 Figure 89: General ABAP Syntax I Unit 6 Lesson 3 .

TAW10_1 Figure 90: General ABAP Syntax II Unit 6 Lesson 3 .

TAW10_1 Figure 91: Keyword Documentation in the ABAP Editor Unit 6 Lesson 3 .

TAW10_1 Figure 92: Previous ABAP Editor Unit 6 Lesson 3 .

TAW10_1 Figure 93: New ABAP Editor Unit 6 Lesson 3 .

TAW10_1 Figure 94: Inactive and Active Development Objects Unit 6 Lesson 3 .

TAW10_1 Figure 95: Generating Runtime Objects Unit 6 Lesson 3 .

2. Enable the user to enter a name on the selection screen. Define input field pa_name on the selection screen with type string. together with the 'Hello' text.TAW10_1 Unit 6 Exercise 11 Exercise 11: Develop a Simple ABAP Program . In the next dialog box. Create program ZBC400_##_HELLO without a TOP include. create an executable program named ZBC400_##_HELLO. modifies the data. and outputs the information to a screen. 3. which will be output later in the list. 1. . use the ABAP WRITE statement. Implement the output of the Hello World! text. To do this. In your package. Business Example You want to create an ABAP program that takes simple user input. 4. Set the status of the program to a meaningful value. make sure that the program type is Executable Program.

7. Using a chained statement. use the NEWLINE statement. Test and activate it. . Check your program for syntax errors. To do so. implement the output text 'Hello' together with the input name from the selection screen.TAW10_1 Unit 6 Exercise 11 Exercise 11: Develop a Simple ABAP Program . 5. Make sure that the following output appears on a new line. 6.

1. d) Enter ZBC400_##_HELLO in the Program field. right-click ZBC400_## and choose Create → Program. c) Under Object Name. a) Open the Object Navigator using transaction SE80. modifies the data. Enable the user to enter a name on the selection screen. and outputs the information to a screen. Create program ZBC400_##_HELLO without a TOP include.TAW10_1 Unit 6 Solution 11 Solution 11: Develop a Simple ABAP Program . . In your package. Uncheck With TOP INCL. which will be output later in the list. create an executable program named ZBC400_##_HELLO. b) In the drop-down menu. Business Example You want to create an ABAP program that takes simple user input. together with the 'Hello' text. select Package and enter ZBC400_## in the next field. e) Choose Continue.

Define input field pa_name on the selection screen with type string. To do this. c) In the next dialog box. a) Choose Executable Program from the Type drop-down list.TAW10_1 Unit 6 Solution 11 Solution 11: Develop a Simple ABAP Program . use the ABAP WRITE statement. 4. b) Choose Test Program from the Status drop-down list and choose Save. a) Enter the following code in the ABAP Editor: . Set the status of the program to a meaningful value. make sure that the program type is Executable Program. In the next dialog box. 3. Implement the output of the Hello World! text. 2. select a Package name and choose the Local Object pushbutton. a) Enter the following code in the ABAP Editor: PARAMETERS: pa_name TYPE string.

TAW10_1 Unit 6 Solution 11 Solution 11: Develop a Simple ABAP Program . implement the output text 'Hello' together with the input name from the selection screen. and Activate (Ctrl+F3) pushbuttons. Check your program for syntax errors. use the NEWLINE statement. Test and activate it. WRITE 'Hello World!’. 5. 6. Make sure that the following output appears on a new line. To do so. Using a chained statement. a) Enter the following code in the ABAP Editor: WRITE: 'Hello'. Direct (F8). pa_name. . a) Choose the Check (Ctrl+F2). a) Enter the following code in the ABAP Editor: NEW-LINE. 7.

......... PARAMETERS: pa_name TYPE string........ NEW-LINE.........-...TAW10_1 Unit 6 Solution 11 Solution 11: Develop a Simple ABAP Program .......-* *& Report BC400_GSS_HELLO *&. ........ WRITE: 'Hello'....-...... pa_name. WRITE 'Hello World!'. Complete source code *&...-* REPORT bc400_gss_hello....

.TAW10_1 Unit 6 Solution 11 Solution 11: Develop a Simple ABAP Program .

TAW10_1 Summary You should now be able to: ● Create ABAP programs ● Use the ABAP Editor ● Activate ABAP programs .

you will be able to: ● ● Create transactions Release change requests .TAW10_1 Unit 6 Lesson 4 Lesson 4: Finalizing Development Lesson Objectives After completing this lesson.

TAW10_1 Figure 96: Creating a Transaction Unit 6 Lesson 4 .

5. In the navigation area. set the SAP GUI for Windows indicator. Under GUI enabled. Save the transaction. . display the object list for the program. 3. Assign a short text and select the Program and Selection Screen (Report Transaction) radio button. 6. On the next screen. In the Object Navigator. select your program and choose Create → Transaction from the context menu. Enter the required transaction code. 4. Assign the transaction to a package and to a change request on the following screens.TAW10_1 Unit 6 Lesson 4 Procedure: To Create a Transaction 1. 2. enter the name of the program and choose Professional User Transaction. Make sure you comply with the customer namespace conventions.

TAW10_1 Unit 6 Lesson 4 Procedure: To Create a Transaction Note: Each transaction is a Repository object. .

TAW10_1 Figure 97: Inserting a Transaction into Personal Favorites Unit 6 Lesson 4 .

2. choose Insert Transaction. . You can start the corresponding program by double-clicking it. In the dialog box. In the Favorites context menu. Navigate to the initial screen. 3. the SAP Easy Access screen. enter the required transaction code.TAW10_1 Unit 6 Lesson 4 Procedure: To Add a Transaction to Personal Favorites 1. The short text of the transaction now appears under the Favorites context menu.

Business Example Users in your company must be able to start their ABAP programs as transactions or define them as personal favorites. Create the new transaction in your package. 1. Task 1 Create a report transaction (suggested name: ZBC400_##_HELLO) that you can use to start your executable program ZBC400_##_HELLO. Save and test the transaction. 2. Include the new transaction in your personal favorites in the SAP Easy Access menu. . Choose the correct transaction classification and make sure that it is GUI-enabled. Enter a short description and select the appropriate transaction type (start object). 3. Refer to the program that is to be executed. Create a report transaction.TAW10_1 Unit 6 Exercise 12 Exercise 12: Create a Transaction .

Double-click the new favorite entry and execute the program. Task 2 Include the new transaction in your personal favorites in the SAP Easy Access menu. 1. 2. Confirm that the program can now be started by entering the transaction code in the command field. . Open the SAP Easy Access menu. and enter the transaction code. 4. choose the function Insert Transaction under Favorites.TAW10_1 Unit 6 Exercise 12 Exercise 12: Create a Transaction .

Enter a short description and select the appropriate transaction type (start object). Include the new transaction in your personal favorites in the SAP Easy Access menu. Task 1 Create a report transaction (suggested name: ZBC400_##_HELLO) that you can use to start your executable program ZBC400_##_HELLO. Create the new transaction in your package. Create a report transaction.TAW10_1 Unit 6 Solution 12 Solution 12: Create a Transaction . 2. a) Make sure that you select the Program and Selection Screen (Report Transaction) radio button as the start object. . Choose the correct transaction classification and make sure that it is GUI-enabled. Refer to the program that is to be executed. Business Example Users in your company must be able to start their ABAP programs as transactions or define them as personal favorites. 1.

Task 2 Include the new transaction in your personal favorites in the SAP Easy Access menu. choose the function Insert Transaction under Favorites. . Confirm that the program can now be started by entering the transaction code in the command field. a) Perform this step as described in the Participant Handbook.TAW10_1 Unit 6 Solution 12 Solution 12: Create a Transaction . Open the SAP Easy Access menu. 3. Make sure that the transaction is classified as a Professional User Transaction and set it as GUIenabled for SAP GUI for Windows. a) Choose Save and Test for this purpose 4. 1. and enter the transaction code. Save and test the transaction.

a) Carry out this step in the usual way.TAW10_1 Unit 6 Solution 12 Solution 12: Create a Transaction . . a) Carry out this step as described in the Participant Handbook. 2. Double-click the new favorite entry and execute the program.

TAW10_1 Figure 98: The Developer Releases the Task Unit 6 Lesson 4 .

TAW10_1 Figure 99: Closing the Project by Releasing the Request (Project Manager) Unit 6 Lesson 4 .

TAW10_1 Summary You should now be able to: ● Create transactions ● Release change requests .

Object Navigator D. Definitions of database tables .TAW10_1 Which of the following system development objects are included in the Repository? Choose the correct answers. Programs B. Function modules C. Unit 6 A.

Function modules D.TAW10_1 Which of the following system development objects are included in the Repository? Unit 6 A. Programs B. Definitions of database tables .

Unit 6 A. Repository Information System D. ABAP Dictionary C. Menu Painter . ABAP Editor B.TAW10_1 Which of the following ABAP Workbench tools is used for editing the source code? Choose the correct answer.

TAW10_1 Which of the following ABAP Workbench tools is used for editing the source code? Unit 6 A. ABAP Editor .

Multiple Choice Unit 6 A.TAW10_1 Which of the following are package types? Choose the correct answers. Application component B. Software component . Standard package C. Main package D.

TAW10_1 Which of the following are package types? Multiple Choice Unit 6 B. Standard package C. Main package .

When an object is activated C.TAW10_1 When is the transport of development objects for a development request triggered? Choose the correct answer. When an object is saved B. When a request is released . Unit 6 A. When a task is released D.

When a request is released .TAW10_1 When is the transport of development objects for a development request triggered? Unit 6 D.

the system stores two inactive versions in the Repository. Unit 6 "Whenever you create or change a development object and save it." .TAW10_1 Determine whether this statement is true or false.

TAW10_1 Determine whether this statement is true or false. Unit 6 "Whenever you create or change a development object and save it. the system stores two inactive versions in the Repository." False .

It is typed. A. D. It enables multi-language applications.TAW10_1 Multiple Choice Unit 6 Which of the following statements is correct about the ABAP programming language? Choose the correct answers. C. E. It is downward-compatible. B. It enables SQL access. . It is platform-dependent.

It is typed. It enables multi-language applications. E. . It enables SQL access.TAW10_1 Multiple Choice Unit 6 Which of the following statements is correct about the ABAP programming language? A. B.

" . Unit 6 "ABAP Objects are object-oriented enhancements of the ABAP programming language.TAW10_1 Determine whether this statement is true or false.

Unit 6 "ABAP Objects are object-oriented enhancements of the ABAP programming language.TAW10_1 Determine whether this statement is true or false." True .

End the line with a pound # in the last column.TAW10_1 How do you include comment lines? Choose the correct answer. B. D. Begin the line with an asterisk * in the first column. End the line with an asterisk * in the last column. Begin the line with a pound # in the first column. . C. Unit 6 A.

.TAW10_1 How do you include comment lines? Unit 6 B. Begin the line with an asterisk * in the first column.

Export the Project Request . A. Unlock and export the task to the Transport Directory D. Transfer the task to the Production System B. Release the task within the Change request C.TAW10_1 Unit 6 After a project employee completes the required development task. he or she should do the following: Choose the correct answer.

he or she should do the following: B. Release the task within the Change request .TAW10_1 Unit 6 After a project employee completes the required development task.

Unit 7: Basic ABAP Language Elements Lesson 1: Defining Elementary Data Objects Lesson 2: Using Basic ABAP Statements Lesson 3: Working with the ABAP Debugger .

TAW10_1 Unit 7 Lesson 1 Lesson 1: Defining Elementary Data Objects Lesson Objectives After completing this lesson. you will be able to: ● Know the differences between types and variables and how to use them .

TAW10_1 Figure 100: Using Data Types Unit 7 Lesson 1 .

length 8 bytes with 16 decimal places (fixed) (since 7. length 6 (fixed) Type for integer (I).0 EhP2) . length 8 (fixed) Type for time (T). length 4 (fixed) Type for floating point number (F). length 8 (fixed) Type for dynamic length character string Type for dynamic length byte sequence (HeXadecimal string) Type for saving (DECimal FLOATing point) numbers with mantissa and exponent.TAW10_1 Unit 7 Lesson 1 Table 1: Complete ABAP Standard Data Types Standard Types D T I F STRING XSTRING DECFLOAT16 Description Type for date (D). format: YYYYMMDD. format: HHMMSS.

length 16 bytes with 34 decimal places (fixed) (since 7.0 EhP2) .TAW10_1 Unit 7 Lesson 1 Table 1: Complete ABAP Standard Data Types Standard Types DECFLOAT34 Description Type for saving (DECimal FLOATing point) numbers with mantissa and exponent.

) X P .TAW10_1 Unit 7 Lesson 1 Table 2: Incomplete ABAP Standard Data Types Standard Types C N Description Type for character string (Character) for which the length is to be specified Type for numerical character string (Numerical character) for which the length is to be specified Type for byte sequence (HeXadecimal string) for which the length is to be specified Type for packed number (Packed number) for which the length is to be specified (In the definition of a packed number. the number of decimal points may also be specified.

TAW10_1 Figure 101: Declaring Local Types Unit 7 Lesson 1 .

TAW10_1 Figure 102: Global Data Types in the Dictionary Unit 7 Lesson 1 .

TAW10_1 Figure 103: Defining Data Objects Unit 7 Lesson 1 .

TAW10_1 Figure 104: Examples of the Definition of Elementary Data Objects Unit 7 Lesson 1 .

TAW10_1 Figure 105: Literals and Constants (Fixed Data Objects) Unit 7 Lesson 1 .

TAW10_1 Figure 106: Text Symbols Unit 7 Lesson 1 .

TAW10_1 Figure 107: Local Versus Global Data Types Unit 7 Lesson 1 .

TAW10_1 Summary You should now be able to: ● Know the differences between types and variables and how to use them .

TAW10_1 Unit 7 Lesson 2 Lesson 2: Using Basic ABAP Statements Lesson Objectives After completing this lesson. you will be able to: ● Use the ABAP syntax of standard basic programming concepts .

TAW10_1 Figure 108: Value Assignments Unit 7 Lesson 2 .

TAW10_1 Figure 109: Calculations Unit 7 Lesson 2 .

TAW10_1 Figure 110: Conditional Branches Unit 7 Lesson 2 .

TAW10_1 Figure 111: Examples .IF Statement Unit 7 Lesson 2 .

TAW10_1 Figure 112: Loops Unit 7 Lesson 2 .

TAW10_1 Unit 7 Lesson 2 Table 3: Some Interesting System Fields System Field sy-mandt sy-uname sy-langu sy-datum sy-uzeit sy-tcode sy-repid sy-index Meaning Logon Client Logon Name of the User Logon Language of the User Local Date of the ABAP System Local Time of the ABAP System Current Transaction Code Name of the Current ABAP Program Loop Counter at DO and WHILE Loops .

TAW10_1 Figure 113: Return Code of an ABAP Statement Unit 7 Lesson 2 .

You must be able to enter the values and the arithmetic operator on a selection screen. 1. The result should be displayed in a list. Create the executable program ZBC400_##_COMPUTE without a TOP include and assign it to your package. . Business Example You are to create a simple ABAP program for the four basic calculation types.TAW10_1 Unit 7 Exercise 13 Exercise 13: Use Basic ABAP Statements . Template None Solution BC400_DOS_COMPUTE Task 1 Create a program.

1. . pa_int2) and one character type arithmetic operator of one character in length (suggested name: pa_op). Define it as a packed number type of 16 digits in length and two decimal places. Use the ABAP keyword PARAMETERS to do this. Task 2 Define a selection screen with three input parameters. 1. Create an elementary data object (suggested name: gv_result) using the DATA statement for the calculation result.TAW10_1 Unit 7 Exercise 13 Exercise 13: Use Basic ABAP Statements . Task 3 Implement the basic calculation types and output the result in a list. Define two input parameters for integers as operands (suggested names: pa_int1.

Display an error message on the list if the user has specified an invalid arithmetic operator. Use the IF statement for checking. Task 4 Catch any errors that may occur. 2. If you want to output texts in the process. Use the CASE statement for a case distinction. Hint: Create text symbols and use these instead of literals. Use a translatable text. Output the result in a list using the WRITE statement. 3.TAW10_1 Unit 7 Exercise 13 Exercise 13: Use Basic ABAP Statements . . Calculate the result dependent on the specified arithmetic operator. make sure that these texts can be translated and are displayed as language-dependent. 1.

Activate your program. 2.TAW10_1 Unit 7 Exercise 13 Exercise 13: Use Basic ABAP Statements . . 1. Test your program. 2. Display an error message on the list if the user tries to divide by zero. Task 5 Activate and test your program.

You must be able to enter the values and the arithmetic operator on a selection screen. 1. Template None Solution BC400_DOS_COMPUTE Task 1 Create a program. Create the executable program ZBC400_##_COMPUTE without a TOP include and assign it to your package. .TAW10_1 Unit 7 Solution 13 Solution 13: Use Basic ABAP Statements . a) Perform this step in the same way as in the previous exercises. Business Example You are to create a simple ABAP program for the four basic calculation types. The result should be displayed in a list.

Task 3 Implement the basic calculation types and output the result in a list. Define two input parameters for integers as operands (suggested names: pa_int1. pa_int2) and one character type arithmetic operator of one character in length (suggested name: pa_op).TAW10_1 Unit 7 Solution 13 Solution 13: Use Basic ABAP Statements . . Task 2 Define a selection screen with three input parameters. Use the ABAP keyword PARAMETERS to do this. a) See the source code excerpt from the model solution below. 1.

. Create an elementary data object (suggested name: gv_result) using the DATA statement for the calculation result. 1. a) See the source code excerpt from the model solution below. make sure that these texts can be translated and are displayed as language-dependent. If you want to output texts in the process.TAW10_1 Unit 7 Solution 13 Solution 13: Use Basic ABAP Statements . 3. 2. Define it as a packed number type of 16 digits in length and two decimal places. a) See the source code excerpt from the model solution below. Use the CASE statement for a case distinction. Output the result in a list using the WRITE statement. Hint: Create text symbols and use these instead of literals. Calculate the result dependent on the specified arithmetic operator.

Task 5 Activate and test your program. Use the IF statement for checking. Display an error message on the list if the user tries to divide by zero. a) See the source code excerpt from the model solution below.TAW10_1 Unit 7 Solution 13 Solution 13: Use Basic ABAP Statements . 1. Display an error message on the list if the user has specified an invalid arithmetic operator. . Use a translatable text. a) See the source code excerpt from the model solution below. a) See the source code excerpt from the model solution below. Task 4 Catch any errors that may occur. 2.

1. . choose ( Direct Processing). ( Activate). b) Supply the selection screen parameters with values and choose Model solution: *&----------------------------------------* *& Report BC400_DOS_COMPUTE *&----------------------------------------* *& Simple calculator *&----------------------------------------* REPORT bc400_dos_compute. a) In the ABAP Editor toolbar. Activate your program. a) In the ABAP Editor toolbar. Test your program. Test the message output in the event of an error too. c) Check the result. choose 2. ( Execute).TAW10_1 Unit 7 Solution 13 Solution 13: Use Basic ABAP Statements .

pa_op TYPE c LENGTH 1. pa_int2 TYPE i.TAW10_1 Unit 7 Solution 13 Solution 13: Use Basic ABAP Statements . DATA gv_result TYPE p LENGTH 16 DECIMALS 2. CASE pa_op. IF ( pa_op pa_op pa_op pa_op = = = = '+' '-' '*' '/' OR OR OR AND pa_int2 <> 0 ). PARAMETERS: pa_int1 TYPE i. .

gv_result ENDCASE. ELSEIF pa_op = '/' AND pa_int2 = 0. WRITE 'No division by zero!'(dbz). gv_result WHEN '-'.TAW10_1 Unit 7 Solution 13 Solution 13: Use Basic ABAP Statements . gv_result. WHEN '+'.pa_int2. . gv_result WHEN '*'. = pa_int1 + pa_int2. = pa_int1 . gv_result WHEN '/'. WRITE: 'Result'(res). = pa_int1 / pa_int2. = pa_int1 * pa_int2. ELSE.

WRITE 'Invalid operator!'(iop). ENDIF.TAW10_1 Unit 7 Solution 13 Solution 13: Use Basic ABAP Statements . .

TAW10_1 Figure 114: Dialog Messages Unit 7 Lesson 2 .

TAW10_1 Summary You should now be able to: ● Use the ABAP syntax of standard basic programming concepts .

.TAW10_1 Unit 7 Lesson 3 Lesson 3: Working with the ABAP Debugger Lesson Objectives After completing this lesson. you will be able to: ● Use the ABAP Debugger to analyse values of elementary data objects during program execution.

TAW10_1 Figure 115: Executing a Program in Debugging Mode Unit 7 Lesson 3 .

TAW10_1 Figure 116: Switching to Debugging Mode at Runtime Unit 7 Lesson 3 .

Single Step and Field Contents Unit 7 Lesson 3 .TAW10_1 Figure 117: ABAP Debugger .

TAW10_1 Figure 118: ABAP Debugger .Breakpoints Unit 7 Lesson 3 .

TAW10_1 Figure 119: ABAP Debugger .Tracing Data Changes Unit 7 Lesson 3 .

Changing Field Contents Unit 7 Lesson 3 .TAW10_1 Figure 120: ABAP Debugger .

0) ● Quick Info in the source code area for data object value display (As of SAP NetWeaver 7.0) ● Watchpoint in internal tables and object references (As of SAP NetWeaver 7. structures.0) .0) ● Value comparison of strings.TAW10_1 Unit 7 Lesson 3 The new ABAP Debugger allows the following additional functions: ● ABAP Debugger in second session Inputs for the application program visible in parallel ● Parallel display options through freely configurable display areas ● Integration of the new ABAP Editor (As of SAP NetWeaver 7. and internal tables (As of SAP NetWeaver 7.

0 EhP2 has the following features: ● Request-based debugging of HTTP and RFC requests ● Software-layer aware debugging (SLAD) ● Automated debugging-debugger scripting ● Memory consumption analysis ● Enhanced Web Dynpro tool ● Enhanced table tool ● Statement debugging .TAW10_1 Unit 7 Lesson 3 The new ABAP Debugger of SAP NetWeaver 7.

Task 1 Execute program BC400_DED_DEBUG_EXERCISE in debugging mode and trace the content of GV_COUNT. 2. Business Example You are given a program and have to use the ABAP Debugger to work out its semantic behavior. . You will need to execute a program in the ABAP Debugger. set content-dependent breakpoints (watchpoints). Take a look at the typing of fields too.TAW10_1 Unit 7 Exercise 14 Exercise 14: Debug Statements on Elementary Data Objects . 1. include all data objects defined in the program and the SY-INDEX system field in the variable view. and change field contents during debugging. Start program BC400_DED_DEBUG_EXERCISE in debugging mode by way of the object list in the Object Navigator. set breakpoints in the ABAP Debugger. Check the content of the data objects in the program at the start. To do this.

Choose (Continue) to restart the program and observe changes to the field content. Execute the program again in debugging mode. 1. Choose Continue to restart the program and observe the change to the content of the data object and the SY-INDEX system field. Repeat the final step until the program has run its course and the list is displayed. 2. . Follow the program flow in single steps until you have run through the WHILE loop twice. In each case. Set a breakpoint at the statement that assigns a new value to the GV_COUNT data object. Task 2 Analyze the WHILE loop by setting breakpoints and tracking the content of GV_COUNT and SY-INDEX. track how the field content changes.TAW10_1 Unit 7 Exercise 14 Exercise 14: Debug Statements on Elementary Data Objects . 3. Analyze the change to the GV_COUNT data object by creating a watchpoint for the field.

What effect does the EXIT statement have in a loop? The EXIT statement causes the system to cease processing the current DO loop. and when it is output. 1. Set breakpoints at all WRITE and EXIT statements in the program (choose Breakpoints → Breakpoint at → Breakpoint at Statement). Task 3 Analyze the nested DO loop by setting a breakpoint at WRITE and EXIT statements. the information that is output.TAW10_1 Unit 7 Exercise 14 Exercise 14: Debug Statements on Elementary Data Objects . 2. Analyze how the contents of loop counters GV_IDX_OUTER and GV_IDX_INNER change. . Restart the program in debugging mode.

Task 4 Use the ABAP Debugger option to change the program flow in such a way that the last statement in the program is also executed.TAW10_1 Unit 7 Exercise 14 Exercise 14: Debug Statements on Elementary Data Objects . . Use the option of changing the content of data objects in debugging mode. 1. Execute the last statement in the program.

set breakpoints in the ABAP Debugger. a) Display the program in the Object Navigator. 1. and change field contents during debugging. set content-dependent breakpoints (watchpoints). in the ABAP Editor. You will need to execute a program in the ABAP Debugger. Task 1 Execute program BC400_DED_DEBUG_EXERCISE in debugging mode and trace the content of GV_COUNT. Start program BC400_DED_DEBUG_EXERCISE in debugging mode by way of the object list in the Object Navigator. b) Alternatively. set a breakpoint at the first executable statement. right-click the program and choose Execute → Debugging.TAW10_1 Unit 7 Solution 14 Solution 14: Debug Statements on Elementary Data Objects . Business Example You are given a program and have to use the ABAP Debugger to work out its semantic behavior. .

Take a look at the typing of fields too. and SY-INDEX fields. Check the content of the data objects in the program at the start.TAW10_1 Unit 7 Solution 14 Solution 14: Debug Statements on Elementary Data Objects . include all data objects defined in the program and the SY-INDEX system field in the variable view. Follow the program flow in single steps until you have run through the WHILE loop twice. Scroll to the right of the variable display to display field types. GV_IDX_INNER. a) In the source code in the ABAP Debugger. . GV_IDX_OUTER. 2. 1. To do this. Task 2 Analyze the WHILE loop by setting breakpoints and tracking the content of GV_COUNT and SY-INDEX. double-click the GV_COUNT. In each case. track how the field content changes.

a) Carry out the single step analysis by choosing Debugger → Single Step. a) Click once in the first column in front of the value assignment to set a breakpoint there. . (Single Step). Analyze the change to the GV_COUNT data object by creating a watchpoint for the field. Repeat the final step until the program has run its course and the list is displayed. (Continue). Execute the program again in debugging mode. or F8. b) Choose Debugger → Continue from the menu. Choose (Continue) to restart the program and observe changes to the field content. or F5. Choose Continue to restart the program and observe the change to the content of the data object and the SY-INDEX system field. 3.TAW10_1 Unit 7 Solution 14 Solution 14: Debug Statements on Elementary Data Objects . 2. Set a breakpoint at the statement that assigns a new value to the GV_COUNT data object.

1. Analyze how the contents of loop counters GV_IDX_OUTER and GV_IDX_INNER change. b) Position the cursor on the GV_COUNT data object in the source code displayed in the ABAP Debugger. Set breakpoints at all WRITE and EXIT statements in the program (choose Breakpoints → Breakpoint at → Breakpoint at Statement). the information that is output. (Continue). repeat the first step in this exercise (see step 1 of Task 1).TAW10_1 Unit 7 Solution 14 Solution 14: Debug Statements on Elementary Data Objects . Restart the program in debugging mode. c) To restart the program. and when it is output. choose Task 3 Analyze the nested DO loop by setting a breakpoint at WRITE and EXIT statements. a) To access the ABAP Debugger. . Choose the Watchpoint pushbutton and confirm the dialog box that appears with .

What effect does the EXIT statement have in a loop? The EXIT statement causes the system to cease processing the current DO loop. a) To access the ABAP Debugger. Confirm the dialog box that appears with . . Task 4 Use the ABAP Debugger option to change the program flow in such a way that the last statement in the program is also executed. b) In the ABAP Debugger. proceed as before.TAW10_1 Unit 7 Solution 14 Solution 14: Debug Statements on Elementary Data Objects . choose Breakpoints → Breakpoint at → Breakpoint at Statement and enter the WRITE statement in the dialog box that appears. 2. c) Choose (Continue) and analyze the program flow.

Double-click the icon in the variable view.TAW10_1 Unit 7 Solution 14 Solution 14: Debug Statements on Elementary Data Objects . place the cursor on this line at any event and choose Debugger → Goto Statement. b) Include the GV_IDX_INNER field in the variable view. Change the field value from 6 to 5 and confirm the change by choosing Enter. a) Set a breakpoint at the last IF statement and choose Continue to run the program to this point. Note: Alternatively. Execute the last statement in the program. 1. Use the option of changing the content of data objects in debugging mode. In debugging mode. c) Restart the program by choosing Single Step or Continue. you can also execute the last statement using the Goto Statement function. .

.TAW10_1 Summary You should now be able to: ● Use the ABAP Debugger to analyse values of elementary data objects during program execution.

N (Numerical character) D. D (Date) .TAW10_1 Which of the following are complete ABAP standard types? Choose the correct answers. C (Character) C. T (Time) B. Unit 7 A.

TAW10_1 Which of the following are complete ABAP standard types? Unit 7 A. D (Date) . T (Time) D.

A. AND B. negations are usually formulated by placing the ______ operator before the logical expression. END D. Choose the correct answer. NOT . OR C.TAW10_1 Unit 7 In IF statements.

TAW10_1 Unit 7 In IF statements. negations are usually formulated by placing the ______ operator before the logical expression. NOT . D.

Message number B. Message type C.TAW10_1 Which of the following are required in the syntax of the Message statement? Choose the correct answers. Message role . Unit 7 A. Message class D.

Message class .TAW10_1 Which of the following are required in the syntax of the Message statement? Unit 7 A. Message number B. Message type C.

Unit 7 A. which of the following contains the loop pass number of the loop in which it is located? Choose the correct answer.TAW10_1 In nested loops. sy-uname D. sy-index B. sy-mandt . sy-repid C.

TAW10_1 In nested loops. which of the following contains the loop pass number of the loop in which it is located? Unit 7 A. sy-index .

/d B. Choose the correct answer. /a . we can enter _______ in the command field . /i D. Unit 7 A.TAW10_1 To switch to debugging mode at run time. /h C.

Unit 7 B.TAW10_1 To switch to debugging mode at run time. we can enter _______ in the command field . /h .

Unit 8: Modularization Lesson 1: Introducing Modularization Lesson 2: Modularizing Using Subroutines Lesson 3: Modularizing Using Function Modules Lesson 4: Implementing Function Modules Lesson 5: Modularizing Using BAPIs Lesson 6: Modularizing Using Global Classes Lesson 7: Implementing Simple Global Classes and Static Methods Lesson 8: Modularizing Using Local Classes .

you will be able to: ● Describe the basics and an overview of modularization .TAW10_1 Unit 8 Lesson 1 Lesson 1: Introducing Modularization Lesson Objectives After completing this lesson.

TAW10_1 Figure 121: Options for Using Modularization Units Unit 8 Lesson 1 .

TAW10_1 Figure 122: Local Program Modularization Unit 8 Lesson 1 .

TAW10_1 Figure 123: Global Modularization Unit 8 Lesson 1 .

TAW10_1 Figure 124: Separating Data Unit 8 Lesson 1 .

TAW10_1 Figure 125: Data Transports Between the Program and the Modularization Unit Unit 8 Lesson 1 .

TAW10_1 Summary You should now be able to: ● Describe the basics and an overview of modularization .

you will be able to: ● Modularize using subroutines .TAW10_1 Unit 8 Lesson 2 Lesson 2: Modularizing Using Subroutines Lesson Objectives After completing this lesson.

TAW10_1 Figure 126: Simple Example of a Subroutine Unit 8 Lesson 2 .

TAW10_1 Figure 127: Passing Parameters – Visibility of Global Variables Unit 8 Lesson 2 .

TAW10_1 Figure 128: Passing Parameters – Defining an Interface Unit 8 Lesson 2 .

TAW10_1 Figure 129: Ways of Passing Interface Parameters Unit 8 Lesson 2 .

TAW10_1 Figure 130: Defining and Calling Subroutines Unit 8 Lesson 2 .

TAW10_1 Figure 131: Typing the Interface Parameters Unit 8 Lesson 2 .

TAW10_1 Figure 132: Visibility of Global and Local Data Objects Unit 8 Lesson 2 .

TAW10_1 Figure 133: Syntax Example – Local Auxiliary Variables for Rounding Unit 8 Lesson 2 .

TAW10_1 Figure 134: Implementing a Subroutine Call Unit 8 Lesson 2 .

TAW10_1 Figure 135: Subroutine in Debugging Mode Unit 8 Lesson 2 .

Copy your program or the template.TAW10_1 Unit 8 Exercise 15 Exercise 15: Implement Subroutines . Template: BC400_DOS_COMPUTE Solution: BC400_MOS_SUBROUTINE Create subroutines and use the subroutine interface to pass data. 1. . Task 1 Copy your program ZBC400_##_COMPUTE or the template and give it the name ZBC400_##_SUBROUTINE. Business Example Modify your calculator program for the basic calculation types so that you can perform another form of calculation (percentage calculation) in a subroutine.

TAW10_1 Unit 8 Exercise 15 Exercise 15: Implement Subroutines . 1. 2. create a subroutine for percentage calculation. Define two USING parameters for transferring the operands (suggested names: PV_ACT and PV_MAX) as well as a CHANGING parameter for returning the result (suggested name: CV_RESULT). Task 2 Create a subroutine (suggested name: CALC_PERCENTAGE) that carries out a percentage calculation using two input parameters and returns the result. At the end of your program. The value of the first parameter can be determined as a percentage of the second parameter. if the value of the second parameter represents 100%. . Type the parameters appropriately to the corresponding global data objects in the main program.

3. declare a local program type at the start of your program with the TYPES statement. Make sure that you avoid the error of division by zero. .TAW10_1 Unit 8 Exercise 15 Exercise 15: Implement Subroutines . You can then use this local program type for the actual parameter and the formal parameter. In this case. Instead. Implement the percentage calculation in the subroutine. Task 3 Extend the main program so that you call a new subroutine when the user enters the arithmetic operator “%”. output a warning text on the list. Hint: You cannot use implicit typing for return parameters (TYPE p LENGTH 16 DECIMALS 2).

Execute your program and check the result.TAW10_1 Unit 8 Exercise 15 Exercise 15: Implement Subroutines . call the subroutine and supply the parameters with suitable actual parameters. . Task 4 Test and debug your program. Extend the IF or CASE structure with a branch that is processed when the parameter contains the value “%”. In the branch created in step 1. 1. 2. Hint: Generate the subroutine call by using the drag-and-drop function in the navigation area or by choosing the Pattern pushbutton. 1.

Follow the program flow with the ABAP Debugger. 2. Use the appropriate function keys or pushbuttons to exit or skip the subroutine.TAW10_1 Unit 8 Exercise 15 Exercise 15: Implement Subroutines . .

Template: BC400_DOS_COMPUTE Solution: BC400_MOS_SUBROUTINE Create subroutines and use the subroutine interface to pass data. Copy your program or the template. . a) Display your template in the navigation area of the Object Navigator. Business Example Modify your calculator program for the basic calculation types so that you can perform another form of calculation (percentage calculation) in a subroutine. Task 1 Copy your program ZBC400_##_COMPUTE or the template and give it the name ZBC400_##_SUBROUTINE. 1.TAW10_1 Unit 8 Solution 15 Solution 15: Implement Subroutines .

Task 2 Create a subroutine (suggested name: CALC_PERCENTAGE) that carries out a percentage calculation using two input parameters and returns the result. c) In the dialog box that follows.TAW10_1 Unit 8 Solution 15 Solution 15: Implement Subroutines . b) Right-click the selected program to open the context menu and choose Copy. . The value of the first parameter can be determined as a percentage of the second parameter. enter the name of the target program and confirm your entry with  (Copy). (Select All) and confirm this with  e) Assign this program to your package and your request in the usual way. if the value of the second parameter represents 100%. d) Select all parts of the program using (Copy).

Instead. 2.TAW10_1 Unit 8 Solution 15 Solution 15: Implement Subroutines . 1. a) See the source code excerpt from the model solution. . You can then use this local program type for the actual parameter and the formal parameter. declare a local program type at the start of your program with the TYPES statement. Define two USING parameters for transferring the operands (suggested names: PV_ACT and PV_MAX) as well as a CHANGING parameter for returning the result (suggested name: CV_RESULT). create a subroutine for percentage calculation. Hint: You cannot use implicit typing for return parameters (TYPE p LENGTH 16 DECIMALS 2). a) See the source code excerpt from the model solution. At the end of your program. Type the parameters appropriately to the corresponding global data objects in the main program.

3. a) See the source code excerpt from the model solution. call the subroutine and supply the parameters with suitable actual parameters. a) See the source code excerpt from the model solution. output a warning text on the list. In the branch created in step 1.TAW10_1 Unit 8 Solution 15 Solution 15: Implement Subroutines . Implement the percentage calculation in the subroutine. Task 3 Extend the main program so that you call a new subroutine when the user enters the arithmetic operator “%”. . 1. Make sure that you avoid the error of division by zero. Extend the IF or CASE structure with a branch that is processed when the parameter contains the value “%”. In this case. 2.

TAW10_1 Unit 8 Solution 15 Solution 15: Implement Subroutines . 2. Execute your program and check the result. Task 4 Test and debug your program. Use the appropriate function keys or pushbuttons to exit or skip the subroutine. 1. . a) Carry out this step as usual. a) See the source code excerpt from the model solution. Follow the program flow with the ABAP Debugger. Hint: Generate the subroutine call by using the drag-and-drop function in the navigation area or by choosing the Pattern pushbutton.

TAW10_1 Unit 8 Solution 15 Solution 15: Implement Subroutines . IF ( pa_op = '+' OR pa_op = '-' OR . pa_op TYPE c LENGTH pa_int2 TYPE i. TYPES gty_result TYPE p LENGTH 16 DECIMALS 2. a) Perform this step as described in the course materials. Solution: BC400_MOS_SUBROUTINE *&------------------------------------------* *& Report BC400_MOS_SUBROUTINE *&------------------------------------------* REPORT bc400_mos_subroutine. 1. PARAMETERS: pa_int1 TYPE i. DATA gv_result TYPE gty_result.

WHEN '+'. gv_result = pa_int1 .pa_int2. gv_result = pa_int1 + pa_int2. PERFORM calc_percentage USING pa_int1 pa_int2 CHANGING gv_result. . gv_result = pa_int1 / pa_int2. pa_op = '*' OR pa_op = '/' AND pa_int2 <> 0 OR pa_op = '%' ). gv_result = pa_int1 * pa_int2. CASE pa_op. WHEN '%'. WHEN '*'. ENDCASE.TAW10_1 Unit 8 Solution 15 Solution 15: Implement Subroutines . WHEN '/'. WHEN '-'.

CV_RESULT result *&------------------------------------------* . ELSE. WRITE: 'No division by zero!'(dbz). WRITE: 'Result:'(res). ELSEIF pa_op = '/' AND pa_int2 = 0. ENDIF. *&------------------------------------------* *& Form calc_percentage *&------------------------------------------* * Calculate percentage value *&------------------------------------------* * -> PV_ACT actual value * -> PV_MAX maximum value * <. gv_result.TAW10_1 Unit 8 Solution 15 Solution 15: Implement Subroutines . WRITE: 'Invalid operator!'(iop).

cv_result = 0. " calc_percentage . ENDIF. FORM calc_percentage USING pv_act TYPE i pv_max TYPE i CHANGING cv_result TYPE gty_result. WRITE 'Error in percentage calculation'. * Calculate result cv_result = pv_act / pv_max * 100. * Simple Error Handling IF pv_max = 0. ELSE.TAW10_1 Unit 8 Solution 15 Solution 15: Implement Subroutines . ENDFORM.

TAW10_1 Summary You should now be able to: ● Modularize using subroutines .

you will be able to: ● Use function modules of function groups .TAW10_1 Unit 8 Lesson 3 Lesson 3: Modularizing Using Function Modules Lesson Objectives After completing this lesson.

TAW10_1 Figure 136: Function Group Unit 8 Lesson 3 .

TAW10_1 Figure 137: Function Modules Unit 8 Lesson 3 .

TAW10_1 Figure 138: Data Objects Within a Function Group Unit 8 Lesson 3 .

TAW10_1 Unit 8 Lesson 3 You can search for function modules as follows: ● Application-related search Search within a particular application component (application hierarchy). activate the ABAP Debugger and set a breakpoint at the CALL FUNCTION statement. ● Program-related search Search for the CALL FUNCTION statement within the program source code. choosing a pushbutton) using “/h”. and execute the “Where-Used List in Programs”. ● Application-independent search Perform a free search. Before triggering a program function (for example. When the searched function module passes a screen. independent of application components (Repository Information System). . use F1 and “Technical Information” to determine the screen number. navigate to it by double-clicking on it.

TAW10_1 Figure 139: Function Module Interface Unit 8 Lesson 3 .

TAW10_1 Figure 140: Documentation and Test Environment Unit 8 Lesson 3 .

TAW10_1 Figure 141: Calling a Function Module Unit 8 Lesson 3 .

TAW10_1 Figure 142: Creating Source Code for a Function Module Call Unit 8 Lesson 3 .

TAW10_1 Figure 143: Handling Exceptions Unit 8 Lesson 3 .

TAW10_1 Unit 8 Exercise 16 Exercise 16: Use a Function Module . Search in the Repository for a function module that calculates a result from a base number and an exponent. Template BC400_MOS_SUBROUTINE Solution BC400_MOS_FUNCTION_MODULE_1 Search for a function module in the Repository and determine its interface and function. Business Example You need to use a globally defined function module in your program to calculate powers. . Task 1 Search for a function module to calculate powers and determine its interface and function 1.

TAW10_1 Unit 8 Exercise 16 Exercise 16: Use a Function Module . use function module BC400_MOS_POWER. Analyze the function module interface and read the documentation. Hint: If the options described do not yield a suitable function module (Pattern pushbutton or Repository Information System). Answer the following: . 3. 2.

Which parameters do you have to pass with the call? How are they typed? .TAW10_1 Unit 8 Exercise 16 Exercise 16: Use a Function Module .

TAW10_1 Unit 8 Exercise 16 Exercise 16: Use a Function Module . How are they typed? .

TAW10_1 Unit 8 Exercise 16 Exercise 16: Use a Function Module . What restrictions apply to the value range? .

TAW10_1 Unit 8 Exercise 16 Exercise 16: Use a Function Module . 4. Answer the following: .

Which parameter contains the calculation result and how is it typed? .TAW10_1 Unit 8 Exercise 16 Exercise 16: Use a Function Module .

2. Extend the corresponding IF or CASE structure with a branch that is processed when the corresponding parameter contains the value "P". Transfer the two values entered by the user and receive the result. Task 2 Copy your program ZBC400_##_SUBROUTINE or copy the template to the new name ZBC400_##_FUNCTION_MODULE and implement a function module call in the event that the user enters the operator "P". Which exceptions can the function module raise ? 6. Copy your program or the template. 5. Call the function module in this processing branch.TAW10_1 Unit 8 Exercise 16 Exercise 16: Use a Function Module . 1. . 3. Test the function module.

TAW10_1 Unit 8 Exercise 16 Exercise 16: Use a Function Module . Evaluate any exceptions that occur and output an explanatory text in the result list. 4. . Hint: Generate the function module call by using the drag-and-drop function in the navigation area or by choosing the Pattern pushbutton.

Business Example You need to use a globally defined function module in your program to calculate powers. Search in the Repository for a function module that calculates a result from a base number and an exponent. Task 1 Search for a function module to calculate powers and determine its interface and function 1. Template BC400_MOS_SUBROUTINE Solution BC400_MOS_FUNCTION_MODULE_1 Search for a function module in the Repository and determine its interface and function. .TAW10_1 Unit 8 Solution 16 Solution 16: Use a Function Module .

Search in the Repository Information System for function modules that have the term "power" in the short text. use function module BC400_MOS_POWER. a) Perform this step as described in the Participant Handbook. for example. Answer the following: . Analyze the function module interface and read the documentation. Hint: If the options described do not yield a suitable function module (Pattern pushbutton or Repository Information System). a) Perform this step as described in the Participant Handbook. 3.TAW10_1 Unit 8 Solution 16 Solution 16: Use a Function Module . 2.

TAW10_1 Unit 8 Solution 16 Solution 16: Use a Function Module . Which parameters do you have to pass with the call? How are they typed? . Since parameter iv_power is optional. . it does not have to be specified (the number is then squared).

TAW10_1 Unit 8 Solution 16 Solution 16: Use a Function Module . Parameter iv_base and iv_power are whole numbers. How are they typed? . .

.TAW10_1 Unit 8 Solution 16 Solution 16: Use a Function Module . The parameter iv_power can have no value greater than 4. What restrictions apply to the value range? .

Answer the following: . 4.TAW10_1 Unit 8 Solution 16 Solution 16: Use a Function Module .

Which parameter contains the calculation result and how is it typed? .TAW10_1 Unit 8 Solution 16 Solution 16: Use a Function Module . Parameter ev_result is a packed number with 31 figures. . two of which are decimal places.

Error Exponent too high (>4) Result too high Task 2 Copy your program ZBC400_##_SUBROUTINE or copy the template to the new name ZBC400_##_FUNCTION_MODULE and implement a function module call in the event that the user enters the operator "P".TAW10_1 Unit 8 Solution 16 Solution 16: Use a Function Module . Test the function module. a) Perform this step as described in the Participant Handbook. Which exceptions can the function module raise ? a) To which errors do these exceptions refer? Exception POWER_VALUE_TOO_HIGH RESULT_VALUE_TOO_HIGH 6. . 5.

4. Evaluate any exceptions that occur and output an explanatory text in the result list. 2. a) See the source code excerpt from the model solution. Call the function module in this processing branch. 1. a) Carry out this step in the usual way. Copy your program or the template. Hint: Generate the function module call by using the drag-and-drop function in the navigation area or by choosing the Pattern pushbutton. a) See the source code excerpt from the model solution. Extend the corresponding IF or CASE structure with a branch that is processed when the corresponding parameter contains the value "P".TAW10_1 Unit 8 Solution 16 Solution 16: Use a Function Module . . 3. Transfer the two values entered by the user and receive the result.

. TYPES gty_result TYPE p LENGTH 16 DECIMALS 2. a) See the source code excerpt from the model solution. Source Code Excerpt: *&----------------------------------------* *& Report BC400_MOS_FUNCTION_MODULE_1 *&----------------------------------------* REPORT bc400_mos_function_module_1. pa_int2 TYPE i. IF ( pa_op = '+' OR pa_op = '-' OR pa_op = '*' OR pa_op = '/' AND pa_int2 <> 0 OR pa_op = '%' OR pa_op = 'P').TAW10_1 Unit 8 Solution 16 Solution 16: Use a Function Module . DATA gv_result TYPE gty_result. PARAMETERS: pa_int1 TYPE i. pa_op TYPE c LENGTH 1.

gv_result = pa_int1 * WHEN '/'. gv_result = pa_int1 WHEN '*'. WHEN '+'. CALL FUNCTION 'BC400_MOS_POWER' EXPORTING iv_base = pa_int1 .TAW10_1 Unit 8 Solution 16 Solution 16: Use a Function Module . CASE pa_op. USING pa_int1 pa_int2 CHANGING gv_result. gv_result = pa_int1 + WHEN '-'. PERFORM calc_percentage pa_int2. pa_int2. WHEN 'P'. pa_int2. gv_result = pa_int1 / WHEN '%'. pa_int2.

WRITE 'Unknown error' (uer). WHEN 3. * . WRITE 'Max value of power is 4' (mvp). WHEN 2. WRITE 'Result value too high' (rvh).TAW10_1 Unit 8 Solution 16 Solution 16: Use a Function Module . no action needed WHEN 1. iv_power = pa_int2 IMPORTING ev_result = gv_result EXCEPTIONS power_value_too_high = 1 result_value_too_high = 2 OTHERS = 3. CASE sy-subrc. WHEN 0.

ELSEIF pa_op = '/' AND pa_int2 = 0. WRITE: 'Invalid operator!'(iop). WRITE: 'Result:'(res). WRITE: 'No division by zero!'(dbz). ELSE. *&-----------------------------------------------* *& Form calc_percentage *&-----------------------------------------------* * calculate percentage value *------------------------------------------------* * -->PV_ACT actual value * -->PV_MAX maximum value * <--CV_RESULT result . ENDCASE. gv_result.TAW10_1 Unit 8 Solution 16 Solution 16: Use a Function Module . ENDCASE. ENDIF.

" calc_percentage . *------------------------------------------------* FORM calc_percentage USING pv_act TYPE i pv_max TYPE i CHANGING cv_result TYPE gty_result.TAW10_1 Unit 8 Solution 16 Solution 16: Use a Function Module . * Simple Error Handling IF pv_max = 0. ENDFORM. ENDIF. ELSE. * Calculate result cv_result = pv_act / pv_max * 100. WRITE 'WARNING!!! Error in percentage calculation'(epc). cv_result = 0.

TAW10_1 Summary You should now be able to: ● Use function modules of function groups .

you will be able to: ● ● Create function groups Create function modules .TAW10_1 Unit 8 Lesson 4 Lesson 4: Implementing Function Modules Lesson Objectives After completing this lesson.

TAW10_1 Figure 144: Creating a Function Group Unit 8 Lesson 4 .

3. A dialog box with the attributes of the function group appears. 2. Choose Yes to confirm. A dialog box appears. and choose Create -> Function Group from the context menu. asking you whether you want to create the new function group.TAW10_1 Unit 8 Lesson 4 Procedure: How to Create a Function Group To create the function group. Enter a short text and save it by choosing Save. Assign the function group to a package and a correction in the usual manner in the dialog boxes that follow. 5. proceed as follows: 1. Be sure to use the customer namespace. Enter the name of the new function group and choose the Enter or Display pushbutton. Choose the object list for a package in the Object Navigator. 4. .

Create the function group ZBC400_##_COMP. You are in charge of implementing calculation functions. . Implement this project successively in this exercise and the subsequent exercises in this unit.TAW10_1 Unit 8 Exercise 17 Exercise 17: Create a Function Group . Template None Solution BC400_MOS (function group) Create a function group. Business Example Your company wants to develop an application in which several functions are used in different programs. You decide to program the application as a function group with function modules. 1.

.TAW10_1 Unit 8 Solution 17 Solution 17: Create a Function Group . You are in charge of implementing calculation functions. Business Example Your company wants to develop an application in which several functions are used in different programs. a) Perform this step as described in the Participant Handbook. Create the function group ZBC400_##_COMP. 1. Implement this project successively in this exercise and the subsequent exercises in this unit. Template None Solution BC400_MOS (function group) Create a function group. You decide to program the application as a function group with function modules.

TAW10_1 Figure 145: Creating a Function Module Unit 8 Lesson 4 .

TAW10_1 Figure 146: Editing the Source Code Unit 8 Lesson 4 .

6. Choose a function group in which to create the new function module. 2. Be sure to use the customer namespace for function modules (customer function modules start with "Z_" or "Y_"). proceed as follows: 1. assign the function module to a package and a correction in the dialog boxes that follow.TAW10_1 Unit 8 Lesson 4 Procedure: To Create a Function Module To create the function module. 3. 5. A dialog box with the attributes of the function module appears. open the context menu for the function group and choose Create → Function Module. In the tree structure. . 4. When necessary. Choose Save to save your entries. Enter a name and a short text for the function module. Display the object list for the function group in the navigation area of the Object Navigator.

. Business Example You want to create a global function module to calculate percentage values. Template BC400_MOS_FUNCTION_MODULE_1 (program) Solution BC400_MOS_FUNCTION_MODULE_2 (program) BC400_MOS_PERCENTAGE (function module) Create and use a function module. create a function module named Z_BC400_##_COMP_PERCENTAGE that can be used to calculate percentage values.TAW10_1 Unit 8 Exercise 18 Exercise 18: Create a Function Module . This is meant to replace the subroutine from a previous exercise. Task 1 In the function group you defined in the last exercise (ZBC400_##_COMP).

raise the exception instead of outputting an error text. 2. Implement the function module. Create the function module.TAW10_1 Unit 8 Exercise 18 Exercise 18: Create a Function Module . Use the subroutine in the template for orientation. To do this. 1. Create an exception that is raised when the values that are transferred result in a division by zero (suggested name: DIVISION_BY_ZERO). Maintain the interface for the function module. create the following parameters and type them with the specified data elements: Parameter Name Parameter Type Data element iv_max iv_act ev_percentage Import Import Export BC400_MAX BC400_ACT BC400_PERC 3. . If an error occurs. 4.

Task 2 Copy your program ZBC400_##_FUNCTION_MODULE or the template to the new name ZBC400_##_FUNCTION_MODULE_2 and replace the subroutine call with a call for the new function module. 1. Hint: To raise the exception.TAW10_1 Unit 8 Exercise 18 Exercise 18: Create a Function Module . Copy the program. Remove the subroutine call and implement a call for the new function module in its place. . 2. use the RAISE <exception name> statement.

TAW10_1 Unit 8 Exercise 18 Exercise 18: Create a Function Module . 3. . Hint: Generate the function module call by using the drag-and-drop function in the navigation area or the Pattern pushbutton. Handle the exception and output a corresponding text if an error occurs.

TAW10_1 Unit 8 Solution 18 Solution 18: Create a Function Module . Template BC400_MOS_FUNCTION_MODULE_1 (program) Solution BC400_MOS_FUNCTION_MODULE_2 (program) BC400_MOS_PERCENTAGE (function module) Create and use a function module. Task 1 In the function group you defined in the last exercise (ZBC400_##_COMP). Business Example You want to create a global function module to calculate percentage values. create a function module named Z_BC400_##_COMP_PERCENTAGE that can be used to calculate percentage values. This is meant to replace the subroutine from a previous exercise. .

a) Perform this step as described in the Participant Handbook. Create an exception that is raised when the values that are transferred result in a division by zero (suggested name: DIVISION_BY_ZERO). create the following parameters and type them with the specified data elements: Parameter Name Parameter Type Data element iv_max iv_act ev_percentage Import Import Export BC400_MAX BC400_ACT BC400_PERC a) Perform this step as described in the Participant Handbook. Create the function module. Maintain the interface for the function module.TAW10_1 Unit 8 Solution 18 Solution 18: Create a Function Module . 2. To do this. . 3. 1.

If an error occurs. a) See the source code excerpt from the model solution. raise the exception instead of outputting an error text. use the RAISE <exception name> statement. Implement the function module. a) Perform this step as described in the Participant Handbook. Hint: To raise the exception. 4. Task 2 Copy your program ZBC400_##_FUNCTION_MODULE or the template to the new name ZBC400_##_FUNCTION_MODULE_2 and replace the subroutine call with a call for the new function module. . Use the subroutine in the template for orientation.TAW10_1 Unit 8 Solution 18 Solution 18: Create a Function Module .

a) Carry out this step in the usual manner. a) See the source code excerpt from the model solution. a) See the source code excerpt from the model solution. Copy the program. Handle the exception and output a corresponding text if an error occurs. Hint: Generate the function module call by using the drag-and-drop function in the navigation area or the Pattern pushbutton. Remove the subroutine call and implement a call for the new function module in its place. . 3.TAW10_1 Unit 8 Solution 18 Solution 18: Create a Function Module . 1. 2.

. 2.TAW10_1 Unit 8 Solution 18 Solution 18: Create a Function Module . DATA gv_result TYPE p LENGTH IF ( pa_op = pa_op = pa_int2 pa_op = '+' '*' <> 'P' 16 DECIMALS OR pa_op = '-' OR OR pa_op = '/' AND 0 OR pa_op = '%' OR ). TYPE c LENGTH TYPE i. PARAMETERS: pa_int1 pa_op pa_int2 TYPE i. 1. Source Code Excerpt *&----------------------------------------* *& Report BC400_MOS_FUNCTION_MODULE_2 *&----------------------------------------* REPORT bc400_mos_function_module_2.

CALL FUNCTION 'BC400_MOS_POWER' EXPORTING iv_base = pa_int1 iv_power = pa_int2 IMPORTING ev_result = gv_result EXCEPTIONS . WHEN '+'.TAW10_1 Unit 8 Solution 18 Solution 18: Create a Function Module .pa_int2. CASE pa_op. gv_result = pa_int1 * pa_int2. WHEN '-'. WHEN '/'. WHEN '*'. WHEN 'P'. gv_result = pa_int1 / pa_int2. gv_result = pa_int1 + pa_int2. gv_result = pa_int1 .

CASE sy-subrc. WHEN '%'. WRITE 'Max value of power is 4'(mvp). WRITE 'Unknown error'(uer). CALL FUNCTION 'BC400_MOS_PERCENTAGE' EXPORTING iv_act = pa_int1 * . WHEN 3. power_value_too_high = 1 result_value_too_high = 2 OTHERS = 3. WHEN 0. WHEN 2. ENDCASE.TAW10_1 Unit 8 Solution 18 Solution 18: Create a Function Module . WRITE 'Result value too high'(rvh). no action needed WHEN 1.

TAW10_1 Unit 8 Solution 18 Solution 18: Create a Function Module iv_max = pa_int2 IMPORTING ev_percentage = gv_result EXCEPTIONS division_by_zero = 1 OTHERS = 2. . ENDIF. ELSE. . ENDCASE. WRITE: 'Result:'(res). WRITE: 'No division by zero!'(dbz). WRITE: 'Invalid operator!'(iop). IF sy-subrc <> 0. WRITE 'Error in Function Module' (efm). ELSEIF pa_op = '/' AND pa_int2 = 0. gv_result. ENDIF.

* Source code extract from the function module: FUNCTION BC400_MOS_PERCENTAGE. .TAW10_1 Unit 8 Solution 18 Solution 18: Create a Function Module . ev_percentage = 0. *&------------------------------------------------* * IMPORTING * REFERENCE(IV_ACT) TYPE BC400_ACT * REFERENCE(IV_MAX) TYPE BC400_MAX * EXPORTING * REFERENCE(EV_PERCENTAGE) TYPE BC400_PERC * EXCEPTIONS * DIVISION_BY_ZERO *&------------------------------------------------* * Error handling IF iv_max = 0.

. ELSE. ENDFUNCTION. . * Calculate result ev_percentage = iv_act / iv_max * 100. ENDIF.TAW10_1 Unit 8 Solution 18 Solution 18: Create a Function Module RAISE division_by_zero.

TAW10_1 Summary You should now be able to: ● Create function groups ● Create function modules .

TAW10_1 Unit 8 Lesson 5 Lesson 5: Modularizing Using BAPIs Lesson Objectives After completing this lesson. you will be able to: ● Modularize using BAPIs .

TAW10_1 Figure 147: Business Objects and BAPIs Unit 8 Lesson 5 .

TAW10_1 Figure 148: Using BAPIs Unit 8 Lesson 5 .

● AddItem.TAW10_1 Unit 8 Lesson 5 Standard BAPIs: ● GetList All GetList BAPIs returns a list of available objects that meet the specified selection criteria. an item for an order). RemoveItem All AddItem. Delete. RemoveItem BAPIs adds and removes subobjects (for example. Cancel BAPIs allows you to create. ● GetDetail All GetDetail BAPIs returns detailed information (attributes) for an object (the complete key must be specified). and delete objects. Change. . Delete. change. ● Create. Change. Cancel All Create.

TAW10_1 Figure 149: BAPI Explorer Unit 8 Lesson 5 .

TAW10_1 Figure 150: Properties of a BAPI Function Module Unit 8 Lesson 5 .

TAW10_1 Figure 151: BAPI Call in an ABAP Program Unit 8 Lesson 5 .

TAW10_1 Summary You should now be able to: ● Modularize using BAPIs .

you will be able to: ● ● ● Describe object-oriented programming Use methods of global classes Handle instances .TAW10_1 Unit 8 Lesson 6 Lesson 6: Modularizing Using Global Classes Lesson Objectives After completing this lesson.

TAW10_1 Figure 152: Representation of a Global Class Unit 8 Lesson 6 .

TAW10_1 Figure 153: Example of Access Options for a Global Class Unit 8 Lesson 6 .

TAW10_1 Figure 154: Classes and Objects Unit 8 Lesson 6 .

TAW10_1 Figure 155: Definition of Attributes Unit 8 Lesson 6 .

TAW10_1 Figure 156: Definition of Methods Unit 8 Lesson 6 .

TAW10_1 Figure 157: Method Parameters Unit 8 Lesson 6 .

TAW10_1 Figure 158: Method Exceptions Unit 8 Lesson 6 .

TAW10_1 Figure 159: The Class Builder Testing Environment Unit 8 Lesson 6 .

TAW10_1 Figure 160: Method Calls Using Drag-and-Drop Unit 8 Lesson 6 .

WRITE gv_result. WHEN 0. WHEN 1. WHEN 2. CASE sy-subrc.TAW10_1 Unit 8 Lesson 6 Classic Exception Handling CALL METHOD cl_bc400_compute=>get_power EXPORTING iv_base = pa_int1 iv_power = pa_int2 IMPORTING ev_result = gv_result EXCEPTIONS POWER_VALUE_TOO_HIGH = 1 RESULT_VALUE_TOO_HIGH = 2. ENDCASE. . WRITE 'Max Value for Power is 4'. WRITE 'Result value was too high'.

CALL METHOD cl_bc400_compute=>get_power  EXPORTING       iv_base   = pa_int1      iv_power  = pa_int2    IMPORTING      ev_result = gv_result. WRITE 'Max Value for Power is 4'. WRITE 'Result value was too high'. ENDTRY. CATCH cx_bc400_power_too_high . WRITE gv_result. . CATCH cx_bc400_result_too_high .TAW10_1 Unit 8 Lesson 6 Class-Based Exception Handling TRY.

TAW10_1 Figure 161: Exception Handling with Exception Classes Unit 8 Lesson 6 .

This is meant to replace the function module call from a previous exercise. Business Example You want to use a static method of a global class to calculate powers. Task 1 Open the CL_BC400_COMPUTE global class and familiarize yourself with the interface and the scope of functions of the method(s) it contains. . Template BC400_MOS_FUNCTION_MODULE_2 (program) Solution BC400_MOS_GLOBAL_CLASS_1 (program) Call a static method of a global class.TAW10_1 Unit 8 Exercise 19 Exercise 19: Use a Global Static Method .

Task 2 Copy your program ZBC400_##_FUNCTION_MODULE_2 or the copy template to the new name ZBC400_##_GLOBAL_CLASS_1 and replace the function module call for the power calculation with a call for the get_power method. Test the get_power static method. Copy your program or the template. . Analyze the interface of the get_power method and read the documentation about the class. 1. 2. 2.TAW10_1 Unit 8 Exercise 19 Exercise 19: Use a Global Static Method . 1. Remove the call of the BC400_MOS_POWER function module and implement a call of the cl_bc400_compute=>get_power method in the same place.

3. . Handle exceptions and output a corresponding text if an error occurs.TAW10_1 Unit 8 Exercise 19 Exercise 19: Use a Global Static Method . Hint: Generate the method call by using the drag-and-drop function in the navigation area or the Pattern pushbutton.

Task 1 Open the CL_BC400_COMPUTE global class and familiarize yourself with the interface and the scope of functions of the method(s) it contains. Business Example You want to use a static method of a global class to calculate powers. This is meant to replace the function module call from a previous exercise. Template BC400_MOS_FUNCTION_MODULE_2 (program) Solution BC400_MOS_GLOBAL_CLASS_1 (program) Call a static method of a global class.TAW10_1 Unit 8 Solution 19 Solution 19: Use a Global Static Method . .

1.TAW10_1 Unit 8 Solution 19 Solution 19: Use a Global Static Method . a) Perform this step as described in the course materials. 2. Analyze the interface of the get_power method and read the documentation about the class. Copy your program or the template. a) Carry out this step in the usual way. Task 2 Copy your program ZBC400_##_FUNCTION_MODULE_2 or the copy template to the new name ZBC400_##_GLOBAL_CLASS_1 and replace the function module call for the power calculation with a call for the get_power method. . 1. Test the get_power static method. a) Perform this step as described in the course materials.

a) See the source code extract from the model solution. PARAMETERS: pa_int1 TYPE i. Handle exceptions and output a corresponding text if an error occurs. pa_op TYPE c LENGTH 1. Hint: Generate the method call by using the drag-and-drop function in the navigation area or the Pattern pushbutton. Remove the call of the BC400_MOS_POWER function module and implement a call of the cl_bc400_compute=>get_power method in the same place. a) See the source code extract from the model solution. Source Code Extract REPORT BC400_MOS_GLOBAL_CLASS_2. . 2.TAW10_1 Unit 8 Solution 19 Solution 19: Use a Global Static Method . 3.

gv_result = pa_int1 / pa_int2. DATA gv_result TYPE p LENGTH IF ( pa_op = '+' OR pa_op = '-' OR pa_op = '*' OR pa_op = '/' AND pa_int2 <> 0 OR pa_op = '%' OR pa_op = 'P' ).TAW10_1 Unit 8 Solution 19 Solution 19: Use a Global Static Method . CASE pa_op. gv_result = pa_int1 . gv_result = pa_int1 * pa_int2. pa_int2 TYPE i. 16 DECIMALS 2. WHEN '-'. WHEN '*'. gv_result = pa_int1 + pa_int2. WHEN '/'. WHEN '+'.pa_int2. .

TAW10_1 Unit 8 Solution 19 Solution 19: Use a Global Static Method . WRITE 'Max value of Power is 4'(mvp). CALL METHOD cl_bc400_mos_compute=>get_percentage EXPORTING iv_act = pa_int1 . WHEN 'P'. ENDTRY. CALL METHOD cl_bc400_compute=>get_power EXPORTING iv_base = pa_int1 iv_power = pa_int2 IMPORTING ev_result = gv_result. WHEN '%'. CATCH cx_bc400_result_too_high . TRY. WRITE 'Result value was too high'(rvh). CATCH cx_bc400_power_too_high .

ENDIF.TAW10_1 Unit 8 Solution 19 Solution 19: Use a Global Static Method . WRITE: 'No division by zero!'(dbz). WRITE: 'Invalid operator!'(iop). ev_percentage = 0. . Source code extract for the method: METHOD GET_PERCENTAGE. ELSEIF pa_op = '/' AND pa_int2 = 0. WRITE: 'Result:'(res). ELSE. gv_result. ENDCASE. iv_max = pa_int2 IMPORTING ev_percentage = gv_result. *Simple error handling IF iv_max = 0.

ENDMETHOD. ENDIF. .TAW10_1 Unit 8 Solution 19 Solution 19: Use a Global Static Method . * Calculate result ev_percentage = iv_act / iv_max * 100. ELSE.

TAW10_1 Figure 162: Creating Objects and Calling Methods Unit 8 Lesson 6 .

Static D. Instance . Public B. Private C. A.TAW10_1 Test Your Knowledge Unit 8 Lesson 6 Which of the following can be used as a visibility option for an attribute ? Choose the correct answers.

Public B.TAW10_1 Test Your Knowledge Unit 8 Lesson 6 Which of the following can be used as a visibility option for an attribute ? A. Private .

TAW10_1 Summary You should now be able to: ● Describe object-oriented programming ● Use methods of global classes ● Handle instances .

you will be able to: ● Create simple global classes .TAW10_1 Unit 8 Lesson 7 Lesson 7: Implementing Simple Global Classes and Static Methods Lesson Objectives After completing this lesson.

TAW10_1 Figure 163: Creating Global Classes in the Object Navigator Unit 8 Lesson 7 .

TAW10_1 Figure 164: Calling the Source Code Editor Unit 8 Lesson 7 .

TAW10_1 Figure 165: Showing the Signature in the Source Code Editor Unit 8 Lesson 7 .

Create the ZCL_##_COMPUTE global class and activate it. Business Example Your company wants to develop an application in which several functions are used in various programs. Implement this project successively in this exercise and subsequent exercises. 1. You are in charge of implementing calculation functions. Template None Solution CL_BC400_MOS_COMPUTE (global class) Create a global class. . You decide to program it as a global class with static methods.TAW10_1 Unit 8 Exercise 20 Exercise 20: Create a Simple Global Class .

a) Run transaction SE80 to open the Object Navigator. . Create the ZCL_##_COMPUTE global class and activate it. You decide to program it as a global class with static methods. Template None Solution CL_BC400_MOS_COMPUTE (global class) Create a global class. Implement this project successively in this exercise and subsequent exercises. You are in charge of implementing calculation functions. Business Example Your company wants to develop an application in which several functions are used in various programs.TAW10_1 Unit 8 Solution 20 Solution 20: Create a Simple Global Class . 1.

choose Class/Interface from the dropdown list and enter the name of the new class in the field below it. f) Make no other entries and confirm your description by choosing (Save).TAW10_1 Unit 8 Solution 20 Solution 20: Create a Simple Global Class . c) Choose (Display). assign your class to your package and the ABAP Workbench request allocated to you by your instructor. d) In the modal dialog box that appears. confirm that you want to create a new class. h) Activate the global class using (Activate). . b) In the navigation area. g) In the dialog box that appears. e) Enter a short text to explain the function of this class in the Description field.

Create the GET_PERCENTAGE static method in your class ZCL_##_COMPUTE. A new percentage calculation method is to be created for this. Template BC400_MOS_GLOBAL_CLASS_1 (program) Solution BC400_MOS_GLOBAL_CLASS_2 (program) CL_BC400_MOS_COMPUTE (global class) Task 1 Create a static method for calculating percentage in the global class that you defined previously. . For orientation. use the function module that has served as the copy template up to this point 1. Business Example You want to use global static methods to calculate percentages.TAW10_1 Unit 8 Exercise 21 Exercise 21: Create a Simple Static Method . These are meant to replace the function module calls from a previous exercise.

. For orientation. Implement the source code for the GET_PERCENTAGE static method. For orientation. Task 2 Copy your program ZBC400_##_GLOBAL_CLASS_1 or the copy template to the new name ZBC400_##_GLOBAL_CLASS_2 and replace the function module call for the percentage calculation with a call for your new method. 1. use the function module that is to be replaced. Create parameters for the method. 3. 2. Two parameters are to be passed to the method for the calculation and one parameter returned as the result.TAW10_1 Unit 8 Exercise 21 Exercise 21: Create a Simple Static Method . Remove the call of the function module and implement a call of the new method in the same location. Copy the program. 2. use the function module that is to be replaced.

. Hint: Generate the method call using the drag-and-drop function in the navigation area or the Pattern pushbutton.TAW10_1 Unit 8 Exercise 21 Exercise 21: Create a Simple Static Method .

Business Example You want to use global static methods to calculate percentages. A new percentage calculation method is to be created for this. . Template BC400_MOS_GLOBAL_CLASS_1 (program) Solution BC400_MOS_GLOBAL_CLASS_2 (program) CL_BC400_MOS_COMPUTE (global class) Task 1 Create a static method for calculating percentage in the global class that you defined previously. These are meant to replace the function module calls from a previous exercise.TAW10_1 Unit 8 Solution 21 Solution 21: Create a Simple Static Method . For orientation. Create the GET_PERCENTAGE static method in your class ZCL_##_COMPUTE. use the function module that has served as the copy template up to this point 1.

b) Choose Parameters. Create parameters for the method.TAW10_1 Unit 8 Solution 21 Solution 21: Create a Simple Static Method . e) Enter an explanatory text in the Description column. d) In the Visibility column. select Public from the input help. Two parameters are to be passed to the method for the calculation and one parameter returned as the result. . a) Select the GET_PERCENTAGE method with a single-click of the mouse. For orientation. select Static Method from the input help. b) Switch to the Methods tab page and enter the name of the new method in the Methods column. c) In the Level column. a) Display the global class in change mode. 2. use the function module that is to be replaced.

c) Define the following parameters: Parameter Name iv_act iv_max ev_percentage Parameter Type Import Import Export Associated Type BC400_ACT BC400_MAX BC400_PERC 3. For orientation. Implement the source code for the GET_PERCENTAGE static method.TAW10_1 Unit 8 Solution 21 Solution 21: Create a Simple Static Method . b) Choose Source Code. c) Implement the function as specified in the model solution for the GET_PERCENTAGE method. . use the function module that is to be replaced. a) Switch to the method list and select the method by clicking on it.

TAW10_1 Unit 8 Solution 21 Solution 21: Create a Simple Static Method . Hint: Generate the method call using the drag-and-drop function in the navigation area or the Pattern pushbutton. 2. Copy the program. . Task 2 Copy your program ZBC400_##_GLOBAL_CLASS_1 or the copy template to the new name ZBC400_##_GLOBAL_CLASS_2 and replace the function module call for the percentage calculation with a call for your new method. 1. a) Carry out this step in the usual manner. Remove the call of the function module and implement a call of the new method in the same location.

Source Code Excerpt: REPORT BC400_MOS_GLOBAL_CLASS_2. DATA gv_result TYPE p LENGTH 16 DECIMALS 2. IF ( pa_op pa_op pa_op pa_op pa_op = = = = = '+' '-' '*' '/' '%' OR OR OR AND pa_int2 <> 0 OR OR . pa_op TYPE c LENGTH 1. a) See the source code excerpt from the model solution. PARAMETERS: pa_int1 TYPE i.TAW10_1 Unit 8 Solution 21 Solution 21: Create a Simple Static Method . pa_int2 TYPE i.

. WHEN '-'.TAW10_1 Unit 8 Solution 21 Solution 21: Create a Simple Static Method . gv_result = pa_int1 + pa_int2. WHEN '+'. WHEN 'P'. TRY. WHEN '*'. WHEN '/'. gv_result = pa_int1 .pa_int2. gv_result = pa_int1 * pa_int2. pa_op = 'P' ). gv_result = pa_int1 / pa_int2. CASE pa_op.

CALL METHOD cl_bc400_mos_compute=>get_percentage EXPORTING iv_act = pa_int1 iv_max = pa_int2 . WRITE 'Max value of Power is 4'(mvp). WRITE 'Result value was too high'(rvh). CATCH cx_bc400_power_too_high . CATCH cx_bc400_result_too_high . CALL METHOD cl_bc400_compute=>get_power EXPORTING iv_base = pa_int1 iv_power = pa_int2 IMPORTING ev_result = gv_result.TAW10_1 Unit 8 Solution 21 Solution 21: Create a Simple Static Method . WHEN '%'. ENDTRY.

WRITE: 'Invalid operator!'(iop). ELSE. ELSEIF pa_op = '/' AND pa_int2 = 0. WRITE: 'No division by zero!'(dbz). ENDCASE.TAW10_1 Unit 8 Solution 21 Solution 21: Create a Simple Static Method . WRITE: 'Result:'(res). . gv_result. IMPORTING ev_percentage = gv_result. ENDIF.

. * Simple error handling IF iv_max = 0. Source Code Extract for the method: METHOD GET_PERCENTAGE. ELSE. ENDIF.TAW10_1 Unit 8 Solution 21 Solution 21: Create a Simple Static Method . ENDMETHOD. * Calculate result ev_percentage = iv_act / iv_max * 100. ev_percentage = 0.

TAW10_1 Summary You should now be able to: ● Create simple global classes .

you will be able to: ● Handle local classes .TAW10_1 Unit 8 Lesson 8 Lesson 8: Modularizing Using Local Classes Lesson Objectives After completing this lesson.

TAW10_1 Figure 166: Defining a Local Class Unit 8 Lesson 8 .

TAW10_1 Figure 167: Syntax for Static Methods Unit 8 Lesson 8 .

TAW10_1 Figure 168: Implementing and Using a Static Method Unit 8 Lesson 8 .

TAW10_1 Summary You should now be able to: ● Handle local classes .

Multiple Choice Unit 8 A. To provide a better overview of program layout C. To encapsulate a function that is required many times within a program for multiple use D. To make a function available across the system .TAW10_1 What are the uses of modularization? Choose the correct answers. To implement the central maintainability of a function within a program E. To improve performance B.

To implement the central maintainability of a function within a program . To provide a better overview of program layout C. To encapsulate a function that is required many times within a program for multiple use D.TAW10_1 What are the uses of modularization? Multiple Choice Unit 8 B.

parameter passing C. Unit 8 A. interface assignment B.TAW10_1 The assignment of actual parameters to formal parameters when calling a subroutine is called _______________. Choose the correct answer. interface call D. subroutine call .

Unit 8 B. parameter passing .TAW10_1 The assignment of actual parameters to formal parameters when calling a subroutine is called _______________.

global data objects B. local and global data types . Unit 8 A. Choose the correct answer. local data types C.TAW10_1 Variables defined in the main program are ____________.

TAW10_1 Variables defined in the main program are ____________. Unit 8 A. global data objects .

A. Export parameter B. Subroutines C.TAW10_1 Multiple Choice Unit 8 Which of the following elements does the interface of a function module contain? Choose the correct answers. Changing parameter D. Screen .

Export parameter C. Changing parameter .TAW10_1 Multiple Choice Unit 8 Which of the following elements does the interface of a function module contain? A.

Choose the correct answer. code C. A. attributes . standard B. you can switch to the ______________ tab page to implement the functions of the function module.TAW10_1 Unit 8 After defining the corresponding IMPORTING and EXPORTING parameters. source code D.

C.TAW10_1 Unit 8 After defining the corresponding IMPORTING and EXPORTING parameters. you can switch to the ______________ tab page to implement the functions of the function module. source code .

TAW10_1 The comment block directly under the keyword FUNCTION is created automatically by the ___________. Choose the correct answer. Function Builder C. Function Module . Object Navigator B. Unit 8 A.

Function Builder . Unit 8 B.TAW10_1 The comment block directly under the keyword FUNCTION is created automatically by the ___________.

Unit 8 "Data in the SAP system can be accessed by means of a Business Application Programming Interface (BAPI)." .TAW10_1 Determine whether this statement is true or false.

Unit 8 "Data in the SAP system can be accessed by means of a Business Application Programming Interface (BAPI).TAW10_1 Determine whether this statement is true or false." True .

TAW10_1 Which of the following can be used as a visibility option for an attribute ? Choose the correct answers. Unit 8 A. Static D. Instance . Private C. Public B.

TAW10_1 Which of the following can be used as a visibility option for an attribute ? Unit 8 A. Private . Public B.

Unit 8 "The system calls the methods using the CALL CLASS METHOD statement." .TAW10_1 Determine whether this statement is true or false.

Unit 8 "The system calls the methods using the CALL CLASS METHOD statement." False .TAW10_1 Determine whether this statement is true or false.

TAW10_1 Determine whether this statement is true or false." . it can be called directly without the need to generate an instance of the class first. Unit 8 "When you identify a method as a static method.

it can be called directly without the need to generate an instance of the class first.TAW10_1 Determine whether this statement is true or false. Unit 8 "When you identify a method as a static method." True .

all you need to do is enter its name in the Constructor list. Unit 8 "To create a static method." .TAW10_1 Determine whether this statement is true or false.

Unit 8 "To create a static method. all you need to do is enter its name in the Constructor list." False .TAW10_1 Determine whether this statement is true or false.

Method Builder D. Attribute Builder . Unit 8 A. Object Builder B.TAW10_1 Which of the following special tools maintains global classes? Choose the correct answer. Class Builder C.

TAW10_1 Which of the following special tools maintains global classes? Unit 8 B. Class Builder .

Unit 8 "To define an instance method as opposed to a static method in a local class.TAW10_1 Determine whether this statement is true or false. the METHODS statement is used instead of CLASS-METHODS. " .

the METHODS statement is used instead of CLASS-METHODS. Unit 8 "To define an instance method as opposed to a static method in a local class.TAW10_1 Determine whether this statement is true or false. " True .

Unit 9: Complex Data Objects Lesson 1: Working with Structures Lesson 2: Working with Internal Tables .

you will be able to: ● ● ● Define structured data objects Implement basic ABAP statements for structured data objects Analyze structured data objects in debugging mode .TAW10_1 Unit 9 Lesson 1 Lesson 1: Working with Structures Lesson Objectives After completing this lesson.

TAW10_1 Figure 169: Definition of Structures with Global Types Unit 9 Lesson 1 .

TAW10_1 Figure 170: Defining Structures with Local Types Unit 9 Lesson 1 .

TAW10_1 Figure 171: Access to Structure Components Unit 9 Lesson 1 .

TAW10_1 Figure 172: Copying Structure Components with the Same Name Unit 9 Lesson 1 .

TAW10_1 Figure 173: Structures in Debugging Mode Unit 9 Lesson 1 .

TAW10_1 Unit 9 Exercise 22 Exercise 22: Work with Structures . and the flight date. merge the data into one output structure for your report. Template None Solution BC400_STS_STRUCTURE Task 1 Create a program and define a selection screen for entering an airline. a flight number. Use the ABAP statement MOVE-CORRESPONDING to assign values between structures and use the ABAP Debugger to trace the data flow and understand the connections between processing blocks. Using structures during data retrieval. Business Example You want to display airline and flight data based on a particular date input by your user. .

1. Create the executable program ZBC400_##_STRUCTURE without TOP include. refer to suitable fields of the Dictionary structure type BC400_S_FLIGHT. 1. and flight date (suggested name: pa_date). Define the input options for an airline (suggested name: pa_car). Task 2 Create two structures based on the Dictionary structure types for data retrieval at a later stage and one structure intended for output defined by a local type. flight number (suggested name: pa_con). Define two structures in the program with reference to the Dictionary structure types BC400_S_CARRIER (suggested name: gs_carrier) and BC400_S_FLIGHT (suggested name: gs_flight). When typing the input fields. 2. Assign the program to your package and your change request. .TAW10_1 Unit 9 Exercise 22 Exercise 22: Work with Structures .

Include the methods in your program by drag-anddrop and supply the signature of the methods with the correct type of data. The reference type should be implemented locally in the program (suggested name: gty_s_carrierflight). To retrieve the data. Task 3 Retrieve the flight data for the flight date along with information about the selected airline. Output this data in a simple list.TAW10_1 Unit 9 Exercise 22 Exercise 22: Work with Structures . . 1. use the GET_CARRIER and GET_FLIGHT methods of class CL_BC400_FLIGHTMODEL. The input parameters of the selection screen serve as import parameters and the first two structures serve as export parameters here. Use this local structure type to define a structure variable (suggested name: gs_carrierflight). Define a third structure that combines all the components of the two previous structures. Use the TYPES statement for the definition. 2.

4. use the MOVE-CORRESPONDING statement. (OPTIONAL) Suppress the list output if no flight was found. Hint: You can check with IS INITIAL to determine whether the output structure is filled with data. output a short message in the error handling of the methods using the WRITE statement. Merge the received data from the first two structures into your output structure. 2.TAW10_1 Unit 9 Exercise 22 Exercise 22: Work with Structures . Use the WRITE statement to output the content of the output structure in a simple list. . 3. Task 4 Execute your program and check the result. Instead. To do this.

TAW10_1 Unit 9 Exercise 22 Exercise 22: Work with Structures . Test the case when no flight data is found. 1. Check the filling of all the structures in the ABAP Debugger. .

Use the ABAP statement MOVE-CORRESPONDING to assign values between structures and use the ABAP Debugger to trace the data flow and understand the connections between processing blocks. and the flight date. . a flight number. Template None Solution BC400_STS_STRUCTURE Task 1 Create a program and define a selection screen for entering an airline. merge the data into one output structure for your report.TAW10_1 Unit 9 Solution 22 Solution 22: Work with Structures . Business Example You want to display airline and flight data based on a particular date input by your user. Using structures during data retrieval.

and flight date (suggested name: pa_date). Task 2 Create two structures based on the Dictionary structure types for data retrieval at a later stage and one structure intended for output defined by a local type. flight number (suggested name: pa_con). Assign the program to your package and your change request. 2. Define the input options for an airline (suggested name: pa_car). . Create the executable program ZBC400_##_STRUCTURE without TOP include. a) Carry out this step in the usual way.TAW10_1 Unit 9 Solution 22 Solution 22: Work with Structures . 1. When typing the input fields. a) See the source code extract from the model solution. refer to suitable fields of the Dictionary structure type BC400_S_FLIGHT.

Define two structures in the program with reference to the Dictionary structure types BC400_S_CARRIER (suggested name: gs_carrier) and BC400_S_FLIGHT (suggested name: gs_flight). The reference type should be implemented locally in the program (suggested name: gty_s_carrierflight). Use this local structure type to define a structure variable (suggested name: gs_carrierflight). Output this data in a simple list. a) See the source code extract from the model solution. Use the TYPES statement for the definition. . Task 3 Retrieve the flight data for the flight date along with information about the selected airline. Define a third structure that combines all the components of the two previous structures.TAW10_1 Unit 9 Solution 22 Solution 22: Work with Structures . a) See the source code extract from the model solution. 2. 1.

(OPTIONAL) Suppress the list output if no flight was found. The input parameters of the selection screen serve as import parameters and the first two structures serve as export parameters here. 2. use the GET_CARRIER and GET_FLIGHT methods of class CL_BC400_FLIGHTMODEL. 1. a) See the source code extract from the model solution.TAW10_1 Unit 9 Solution 22 Solution 22: Work with Structures . a) See the source code extract from the model solution. To retrieve the data. 4. Merge the received data from the first two structures into your output structure. Instead. To do this. a) See the source code extract from the model solution. use the MOVE-CORRESPONDING statement. output a short message in the error handling of the methods using the WRITE statement. Include the methods in your program by drag-anddrop and supply the signature of the methods with the correct type of data. Use the WRITE statement to output the content of the output structure in a simple list. . 3.

TAW10_1 Unit 9 Solution 22 Solution 22: Work with Structures . Hint: You can check with IS INITIAL to determine whether the output structure is filled with data. 1. Task 4 Execute your program and check the result. a) Set a session breakpoint in the ABAP Editor and execute the program directly using (Direct Processing). a) See the source code excerpt from the model solution. Test the case when no flight data is found. Check the filling of all the structures in the ABAP Debugger. .

PARAMETERS: pa_car TYPE bc400_s_flight-carrid. seatsmax TYPE bc400_s_flight-seatsmax. pa_date TYPE bc400_s_flight-fldate. pa_con TYPE bc400_s_flight-connid. connid TYPE bc400_s_flight-connid. TYPES: BEGIN OF gty_s_carrierflight. fldate TYPE bc400_s_flight-fldate. .TAW10_1 Unit 9 Solution 22 Solution 22: Work with Structures . carrid TYPE bc400_s_flight-carrid. seatsocc TYPE bc400_s_flight-seatsocc. gs_flight TYPE bc400_s_flight. percentage TYPE bc400_s_flight-percentage. Source Code Excerpt: REPORT bc400_sts_structure. DATA: gs_carrier TYPE bc400_s_carrier.

TAW10_1 Unit 9 Solution 22 Solution 22: Work with Structures . carrname TYPE bc400_s_carrier-carrname. currcode TYPE bc400_s_carrier-currcode. * Get data TRY. END OF gty_s_carrierflight. CALL METHOD cl_bc400_flightmodel=>get_flight EXPORTING iv_carrid = pa_car iv_connid = pa_con iv_fldate = pa_date IMPORTING es_flight = gs_flight. DATA: gs_carrierflight TYPE gty_s_carrierflight. . url TYPE bc400_s_carrier-url.

WRITE: 'No data found!'(ndf). . CATCH cx_bc400_no_data . CALL METHOD cl_bc400_flightmodel=>get_carrier EXPORTING iv_carrid = pa_car IMPORTING es_carrier = gs_carrier. ENDTRY. IF gs_carrierflight IS NOT INITIAL. * Fill gs_carrierflight MOVE-CORRESPONDING gs_carrier TO gs_carrierflight. WRITE: 'No authority for this carrier!'(nau). MOVE-CORRESPONDING gs_flight TO gs_carrierflight.TAW10_1 Unit 9 Solution 22 Solution 22: Work with Structures . CATCH cx_bc400_no_auth .

gs_carrierflight-seatsmax. gs_carrierflight-carrname. WRITE: / gs_carrierflight-carrid. . gs_carrierflight-url. gs_carrierflight-percentage. ENDIF. '%'.TAW10_1 Unit 9 Solution 22 Solution 22: Work with Structures . gs_carrierflight-fldate. gs_carrierflight-connid. gs_carrierflight-seatsocc. gs_carrierflight-currcode.

TAW10_1 Summary You should now be able to: ● Define structured data objects ● Implement basic ABAP statements for structured data objects ● Analyze structured data objects in debugging mode .

TAW10_1 Unit 9 Lesson 2 Lesson 2: Working with Internal Tables Lesson Objectives After completing this lesson. you will be able to: ● ● ● Define internal tables Implement basic ABAP statements with internal tables Analyze internal tables in debugging mode .

TAW10_1 Figure 174: Internal Tables – Usage Options Unit 9 Lesson 2 .

TAW10_1 Figure 175: Attributes of Internal Tables Unit 9 Lesson 2 .

TAW10_1 Figure 176: Attributes and Uses of Table Kinds Unit 9 Lesson 2 .

TAW10_1 Figure 177: Defining Internal Tables with Global Types Unit 9 Lesson 2 .

TAW10_1 Figure 178: Defining Internal Tables with Local Types Unit 9 Lesson 2 .

TAW10_1 Figure 179: Independent Definition of Internal Tables Unit 9 Lesson 2 .

TAW10_1 Figure 180: Possible Definitions of Internal Tables Unit 9 Lesson 2 .

TAW10_1 Figure 181: Accessing Single Records (Overview) Unit 9 Lesson 2 .

TAW10_1 Figure 182: Processing Sets of Records (Overview) Unit 9 Lesson 2 .

TAW10_1 Figure 183: Syntax Example – Inserting a Row Unit 9 Lesson 2 .

TAW10_1 Figure 184: Syntax example – Outputting an Internal Table Row-by-Row Unit 9 Lesson 2 .

TAW10_1 Figure 185: Syntax Example – Reading by Index Unit 9 Lesson 2 .

TAW10_1 Figure 186: Syntax Example – Reading by Key Unit 9 Lesson 2 .

TAW10_1 Figure 187: Syntax Example – Sorting and Deleting Content Unit 9 Lesson 2 .

TAW10_1 Figure 188: Anaylze table in debugging mode Unit 9 Lesson 2 .

TAW10_1 Figure 189: Comparison – Internal Tables with and Without Header Lines Unit 9 Lesson 2 .

Task 1 Create a program and define an internal table for flight connections within it. and process the content of internal tables using a loop.TAW10_1 Unit 9 Exercise 23 Exercise 23: Work with Internal Tables . 1. Business Example You want to transfer flight connection data from a database table to an internal table (as temporary storage) and output it in a list. define internal tables based on a global table type. . Create the executable program ZBC400_##_LOOP without a TOP include. Template None Solution BC400_ITS_ITAB_LOOP Search for suitable table types in the ABAP Dictionary. Assign the program to your package and your change request.

3. In the ABAP Dictionary. search for all table types that match this condition. it is recommended that you define your internal table in such a way that your line type is compatible with the structure type BC400_S_CONNECTION. Define an internal table (suggested name: gt_connections) based on one of the global table types that were found. To buffer flight connection data in an internal table. . 2. (Pay attention to the correct selection when triggering the where-used list).TAW10_1 Unit 9 Exercise 23 Exercise 23: Work with Internal Tables . Use the appropriate pushbutton to list (where-used list) for BC400_S_CONNECTION. 4. Define a suitable work area for the internal table (suggested name: gs_connection). Hint: Display structure BC400_S_CONNECTION in the ABAP Dictionary (the cursor should be placed on the structure name).

1. 2. Use the LOOP statement to output the buffered data in the internal table in a list. output a short message to the list. Choose the internal table you defined as the passed parameter. If no flight connection was found. 4. (OPTIONAL) Use the SORT statement to sort the internal table in ascending order according to the departure time before the data is output in the list. Use the errorhandling of the method call to do this. Get the flight connection data by calling the GET_CONNECTIONS method of class CL_BC400_FLIGHTMODEL.TAW10_1 Unit 9 Exercise 23 Exercise 23: Work with Internal Tables . Task 2 Fill your internal table and output the content in a list. 3. Task 3 .

Use the ABAP Debugger to check the output of the internal table in the list. . Execute your program and check the result.TAW10_1 Unit 9 Exercise 23 Exercise 23: Work with Internal Tables . 1.

and process the content of internal tables using a loop. define internal tables based on a global table type. . Assign the program to your package and your change request.TAW10_1 Unit 9 Solution 23 Solution 23: Work with Internal Tables . Create the executable program ZBC400_##_LOOP without a TOP include. Task 1 Create a program and define an internal table for flight connections within it. Template None Solution BC400_ITS_ITAB_LOOP Search for suitable table types in the ABAP Dictionary. Business Example You want to transfer flight connection data from a database table to an internal table (as temporary storage) and output it in a list. 1.

To buffer flight connection data in an internal table. search for all table types that match this condition. 3. Hint: Display structure BC400_S_CONNECTION in the ABAP Dictionary (the cursor should be placed on the structure name). Define an internal table (suggested name: gt_connections) based on one of the global table types that were found. (Pay attention to the correct selection when triggering the where-used list). Use the appropriate pushbutton to list (where-used list) for BC400_S_CONNECTION. In the ABAP Dictionary. 2. a) Carry out this step in the usual way. .TAW10_1 Unit 9 Solution 23 Solution 23: Work with Internal Tables . a) Carry out this step as described. it is recommended that you define your internal table in such a way that your line type is compatible with the structure type BC400_S_CONNECTION.

TAW10_1 Unit 9 Solution 23 Solution 23: Work with Internal Tables . a) See the source code excerpt from the model solution. a) See the source code excerpt from the model solution. Define a suitable work area for the internal table (suggested name: gs_connection). a) See the source code excerpt from the model solution. output a short message to the list. 2. . Get the flight connection data by calling the GET_CONNECTIONS method of class CL_BC400_FLIGHTMODEL. If no flight connection was found. Task 2 Fill your internal table and output the content in a list. 1. 4. Choose the internal table you defined as the passed parameter. Use the errorhandling of the method call to do this.

a) See the source code excerpt from the model solution. a) See the source code excerpt from the model solution.TAW10_1 Unit 9 Solution 23 Solution 23: Work with Internal Tables . Task 3 Execute your program and check the result. . 1. Use the LOOP statement to output the buffered data in the internal table in a list. (OPTIONAL) Use the SORT statement to sort the internal table in ascending order according to the departure time before the data is output in the list. 3. 4. a) Set a session breakpoint in the ABAP Editor and execute the program directly using (Direct Processing). a) See the source code excerpt from the model solution. Use the ABAP Debugger to check the output of the internal table in the list.

WRITE: / 'No data found!'(ndf). Source Code Excerpt: REPORT bc400_its_itab_loop. . SORT gt_connections ASCENDING BY deptime. DATA: gt_connections TYPE bc400_t_connections. * Get data TRY. CATCH cx_bc400_no_data . gs_connection TYPE bc400_s_connection. CALL METHOD cl_bc400_flightmodel=>get_connections IMPORTING et_connections = gt_connections.TAW10_1 Unit 9 Solution 23 Solution 23: Work with Internal Tables . ENDTRY.

gs_connection-cityto. gs_connection-connid. * Output LOOP AT gt_connections INTO gs_connection. WRITE: / gs_connection-carrid. gs_connection-airpfrom. gs_connection-fltime. gs_connection-cityfrom. gs_connection-airpto.TAW10_1 Unit 9 Solution 23 Solution 23: Work with Internal Tables . gs_connection-arrtime. gs_connection-deptime. . ENDLOOP.

TAW10_1 Summary You should now be able to: ● Define internal tables ● Implement basic ABAP statements with internal tables ● Analyze internal tables in debugging mode .

MOVE-CORRESPONDING D. A. one component at a time? Choose the correct answer.TAW10_1 Unit 9 Which of the following statements copies the content of the source structure to the target structure. REPLACE-CORRESPONDING C. REMOVE-CORRESPONDING . COPY-CORRESPONDING B.

TAW10_1 Unit 9 Which of the following statements copies the content of the source structure to the target structure. MOVE-CORRESPONDING . one component at a time? C.

TYPES B. BEGIN C. END D. START .TAW10_1 Which of the following statements is used for defining local structure types? Choose the correct answer. Unit 9 A.

TAW10_1 Which of the following statements is used for defining local structure types? Unit 9 A. TYPES .

Table kind . Secondary key D. Line type B. Unit 9 A. Primary key C.TAW10_1 Which of the following specifications are required in the definition of an internal table? Choose the correct answers.

TAW10_1 Which of the following specifications are required in the definition of an internal table? Unit 9 A. Primary key D. Table kind . Line type B.

APPEND D. INSERT ROW C. ADD LINE B.TAW10_1 Which of the following is used for adding a row into an internal table ? Choose the correct answer. UPDATE TABLE . Unit 9 A.

TAW10_1 Which of the following is used for adding a row into an internal table ? Unit 9 C. APPEND .

Unit 10: Data Modeling and Data Retrieval Lesson 1: Modeling Data Lesson 2: Reading Single Database Records Lesson 3: Reading Multiple Database Records Lesson 4: Handling Other Aspects of Database Access Lesson 5: Working with Authorization Checks .

you will be able to: ● ● ● Explain the purpose and benefits of data models Describe the SAP flight data model Explain transparent tables .TAW10_1 Unit 10 Lesson 1 Lesson 1: Modeling Data Lesson Objectives After completing this lesson.

TAW10_1 Figure 190: Data Modeling Unit 10 Lesson 1 .

TAW10_1 Figure 191: SAP Flight Data Model for ABAP Training Courses Unit 10 Lesson 1 .

utilization of capacity or availability. pricing.TAW10_1 Unit 10 Lesson 1 Typical inquiries at the travel agency: ● Relevant airports ● Relevant flight connections ● Relevant flight times ● Relevant information about flights. and so on . for example.

TAW10_1 Figure 192: Relational Data Model Unit 10 Lesson 1 .

TAW10_1 Figure 193: Implementation Using Transparent Tables Unit 10 Lesson 1 .

TAW10_1 Figure 194: Technical Structure of Transparent Tables Unit 10 Lesson 1 .

TAW10_1 Figure 195: Transparent Tables in the ABAP Dictionary Unit 10 Lesson 1 .

TAW10_1 Figure 196: Structures in the ABAP Dictionary Unit 10 Lesson 1 .

TAW10_1 Figure 197: Transparent Table as an ABAP Data Type Unit 10 Lesson 1 .

To do this. Task 1 Examine the properties of the database table SPFLI and analyze the name and data types of the table fields. Business Example You want to familiarize yourself with the flight data model.TAW10_1 Unit 10 Exercise 24 Exercise 24: Analyze Transparent Tables in the Data Dictionary . Answer the following: . Display the relevant transparent table. you analyze some of the relevant transparent tables in the ABAP Dictionary and display the table content using the Data Browser. Analyze the properties of the transparent tables in the ABAP Dictionary and use the Data Browser to acquire an overview of the table content. 1. 2.

3 C. No key is defined . How many of these make up the key to this table? Choose the correct answer. 1 D. The table SPFLI has 16 fields.TAW10_1 Unit 10 Exercise 24 Exercise 24: Analyze Transparent Tables in the Data Dictionary . A. 16 B.

Answer the following: . 3.TAW10_1 Unit 10 Exercise 24 Exercise 24: Analyze Transparent Tables in the Data Dictionary .

TAW10_1 Unit 10 Exercise 24 Exercise 24: Analyze Transparent Tables in the Data Dictionary . How long are the fields for the points of departure (CITYFROM) and destination (CITYTO)? Why do they have the same technical properties? .

. Task 2 Search for other database tables to use with the flight data model. list all of the transparent tables that belong to the same package as the database table SPFLI.TAW10_1 Unit 10 Exercise 24 Exercise 24: Analyze Transparent Tables in the Data Dictionary . Take advantage of the fact that the relevant transparent tables are in the same package. In the navigation area of the Object Navigator. 1. Hint: Access the object list more quickly and without the name of the package by choosing the Display Object List pushbutton from the database table SPFLI display.

Find the most immediate flight. In which database table is the flight customer data located? What is the name of the field for the name of a flight customer? Task 3 Find the flight customer number of customer SAP AG. . determine the point of departure and destination of this flight. Use the Data Browser to display the content of the SCUSTOM database table for customer SAP AG. 2. Determine the number of flights for which customer SAP AG has a booking. and determine whether the flight is fully booked. 1.TAW10_1 Unit 10 Exercise 24 Exercise 24: Analyze Transparent Tables in the Data Dictionary .

so no general statement can be made regarding the most immediate flight at a particular point in time. . What is the flight customer number for SAP AG? 3. Display the content of the SBOOK database table to determine the number of bookings for customer SAP AG and find the most immediate flight. Hint: The data is regenerated before each training course.TAW10_1 Unit 10 Exercise 24 Exercise 24: Analyze Transparent Tables in the Data Dictionary . 2.

6. Use the content of the database table SPFLI to determine the point of departure and destination of the flight that was found. Is the flight fully booked? . 4.TAW10_1 Unit 10 Exercise 24 Exercise 24: Analyze Transparent Tables in the Data Dictionary . Which fields can be used to uniquely identify the corresponding flight? 5.

a) Choose the Other Object pushbutton. 1. Business Example You want to familiarize yourself with the flight data model. To do this. you analyze some of the relevant transparent tables in the ABAP Dictionary and display the table content using the Data Browser. c) Under Database Table.TAW10_1 Unit 10 Solution 24 Solution 24: Analyze Transparent Tables in the Data Dictionary . Display the relevant transparent table. b) Choose the Dictionary tab page. enter the table names and choose (Display). Analyze the properties of the transparent tables in the ABAP Dictionary and use the Data Browser to acquire an overview of the table content. . Task 1 Examine the properties of the database table SPFLI and analyze the name and data types of the table fields.

TAW10_1 Unit 10 Solution 24 Solution 24: Analyze Transparent Tables in the Data Dictionary . Answer the following: . 2.

How many of these make up the key to this table? B. 3 .TAW10_1 Unit 10 Solution 24 Solution 24: Analyze Transparent Tables in the Data Dictionary . The table SPFLI has 16 fields.

TAW10_1 Unit 10 Solution 24 Solution 24: Analyze Transparent Tables in the Data Dictionary . Answer the following: . 3.

The fields are 20 characters in length. S_CITY.TAW10_1 Unit 10 Solution 24 Solution 24: Analyze Transparent Tables in the Data Dictionary . . How long are the fields for the points of departure (CITYFROM) and destination (CITYTO)? Why do they have the same technical properties? . They have the same technical properties because they refer to the same domain.

. In the navigation area of the Object Navigator. open the object list for this package in the usual way. 1. Task 2 Search for other database tables to use with the flight data model.TAW10_1 Unit 10 Solution 24 Solution 24: Analyze Transparent Tables in the Data Dictionary . You will find the transparent table under the node Dictionary Objects → Database Tables. b) In the navigation area. a) You will find the name of the package on the Properties tab page for the transparent table (SAPBC_DATAMODEL). Take advantage of the fact that the relevant transparent tables are in the same package. list all of the transparent tables that belong to the same package as the database table SPFLI.

2. Find the most immediate flight.TAW10_1 Unit 10 Solution 24 Solution 24: Analyze Transparent Tables in the Data Dictionary . the name of the customer is in the NAME table field. Task 3 Find the flight customer number of customer SAP AG. In which database table is the flight customer data located? What is the name of the field for the name of a flight customer? The flight customer data is located in the SCUSTOM table. determine the . Hint: Access the object list more quickly and without the name of the package by choosing the Display Object List pushbutton from the database table SPFLI display. Determine the number of flights for which customer SAP AG has a booking.

TAW10_1 Unit 10 Solution 24 Solution 24: Analyze Transparent Tables in the Data Dictionary . a) Open the SCUSTOM transparent table in the Object Navigator as you did before. Display the content of the SBOOK database table to determine the number of bookings for customer SAP AG and find the most immediate flight. b) Choose the Content pushbutton to branch to the Data Browser. c) Enter the customer name as a selection and choose the Execute pushbutton. Use the Data Browser to display the content of the SCUSTOM database table for customer SAP AG. point of departure and destination of this flight. What is the flight customer number for SAP AG? The flight customer number for SAP AG is 00000001. 2. and determine whether the flight is fully booked. . 3. 1.

so no general statement can be made regarding the most immediate flight at a particular point in time. a) Proceed in a similar manner to the previous step to display the content of the SBOOK database table. Specify the flight customer number to limit the content. b) The number of bookings found (hits) is specified in the title bar of the display. c) Sort the display according to the flight date to determine the most immediate booking. Hint: The data is regenerated before each training course. .TAW10_1 Unit 10 Solution 24 Solution 24: Analyze Transparent Tables in the Data Dictionary .

4. Which fields can be used to uniquely identify the corresponding flight? The necessary key fields are Client (MANDT). and Flight Date (FLDATE). Airline ID (CARRID). . Is the flight fully booked? a) Display the content of the database table SFLIGHT. Use the content of the database table SPFLI to determine the point of departure and destination of the flight that was found. 6. a) When displaying the data. 5. restrict the airline ID and flight number to the flight that was found previously.TAW10_1 Unit 10 Solution 24 Solution 24: Analyze Transparent Tables in the Data Dictionary . Connection Number (CONNID). b) You will find the point of departure and destination in the CITYFROM and CITYTO fields and the departure and arrival airports in the AIRPFROM and AIRPTO fields.

flight number. b) Limit the display to the airline ID. . and date of the previously determined flight. c) You will find the number of occupied seats and the maximum number of available seats in the SEATSOCC and SEATSMAX fields.TAW10_1 Unit 10 Solution 24 Solution 24: Analyze Transparent Tables in the Data Dictionary .

TAW10_1 Summary You should now be able to: ● Explain the purpose and benefits of data models ● Describe the SAP flight data model ● Explain transparent tables .

you will be able to: ● Read single database records .TAW10_1 Unit 10 Lesson 2 Lesson 2: Reading Single Database Records Lesson Objectives After completing this lesson.

TAW10_1 Figure 198: Database Access (Architecture) Unit 10 Lesson 2 .

.Screen field information: display a corresponding structure field using F1 + Technical Information. ● Search by program Search within a program that accesses the table being searched for: .Source code search: search for SELECT statements in the ABAP Editor.TAW10_1 Unit 10 Lesson 2 Options for searching required database tables: ● Search by application Search within a particular application component. navigate to the relevant data element and query Where-Used List in Table Fields. . . in the application hierarchy.Function debugging: switch to debugging mode (/h) prior to executing a subfunction and set a breakpoint at the SELECT statement.

TAW10_1 Figure 199: Reuse Components for Data Retrieval Unit 10 Lesson 2 .

TAW10_1 Figure 200: Database Read Access (Overview) Unit 10 Lesson 2 .

TAW10_1 Figure 201: Reading Single Records Unit 10 Lesson 2 .

TAW10_1 Figure 202: Corresponding Target Structure for the Field List Unit 10 Lesson 2 .

TAW10_1 Figure 203: Fields in the Target Structure with the Same Names as Those in the Field List Unit 10 Lesson 2 .

Task 1 Create a function group. Business Example You want to develop a program in which data for a single flight connection is read from the database. .TAW10_1 Unit 10 Exercise 25 Exercise 25: Implement Single Record Access . You encapsulate the required database access by a single record access in a function module so that you can reuse it. Template None Solution BC400_DDS (function group) BC400_DDS_CONNECTION_GET (function module) Create a function group and a function module and read from the database using a single record access.

use the Dictionary structure type BC400_S_CONNECTION. Maintain the interface for the function module in such a way that it imports an airline ID and a flight connection number and returns flight connection data. Create a new function module in your function group (suggested name: Z_BC400_##_CONNECTION_GET).TAW10_1 Unit 10 Exercise 25 Exercise 25: Implement Single Record Access . Raise an exception for the case in which no data is found. For the data type of the parameter. Create an export parameter for the detailed data for a flight connection (suggested name: ES_CONNECTION). . 1. Task 2 Create a new function module in the function group. Create a new function group in your package (suggested name: ZBC400_##). 2. 1.

Make sure that the order of the fields matches the order of the structure components. 4. choose suitable components from the Dictionary structure type BC400_S_CONNECTION. Create a (classic) exception (suggested name: NO_DATA). For the data type of the parameter. 1. 3. List all of the table fields that appear as components in the export parameter. implement a single record access to the database table SPFLI. Task 3 In the source code of the function module. Use the interface parameters of the function module to do this. Create a separate import parameter for the airline ID and the connection number (suggested names: IV_CARRID and IV_CONNID). Implement a single record access (SELECT SINGLE) to the database table SPFLI that fills the export parameter of the function module with values. Raise an exception for the case in which no data can be found for the selection.TAW10_1 Unit 10 Exercise 25 Exercise 25: Implement Single Record Access . .

Raise the exception for the function module if the database access returns no data (sy-subrc <> 0). . 2. Test your function module. 2. Hint: Check the raising of the exception. Use both import parameters of the function module to do this. 1. Task 4 Activate and test your function module.TAW10_1 Unit 10 Exercise 25 Exercise 25: Implement Single Record Access . Activate the function module. if an error occurs. 3. Apply a selection condition (WHERE clause) to the SELECT statement.

You encapsulate the required database access by a single record access in a function module so that you can reuse it. Task 1 Create a function group. Business Example You want to develop a program in which data for a single flight connection is read from the database.TAW10_1 Unit 10 Solution 25 Solution 25: Implement Single Record Access . Template None Solution BC400_DDS (function group) BC400_DDS_CONNECTION_GET (function module) Create a function group and a function module and read from the database using a single record access. .

1. b) Enter the name of the function group and a short text and choose Save. Create a new function module in your function group (suggested name: Z_BC400_##_CONNECTION_GET). Task 2 Create a new function module in the function group. open the context menu for the package and choose Create → Function Group.TAW10_1 Unit 10 Solution 25 Solution 25: Implement Single Record Access . Maintain the interface for the function module in such a way that it imports an airline ID and a flight connection number and returns flight connection data. . c) Assign the function group to your package and your request in the usual way. 1. Create a new function group in your package (suggested name: ZBC400_##). Raise an exception for the case in which no data is found. a) In the navigation area.

open the context menu for your function group and choose Create → Function Module. Create an export parameter for the detailed data for a flight connection (suggested name: ES_CONNECTION). 2. b) Enter the name of the function module and a short text and choose Save. a) Open the Export tab page. For the data type of the parameter. Enter the name of the parameter and the data type. choose suitable components from the Dictionary structure type BC400_S_CONNECTION. a) In the navigation area. use the Dictionary structure type BC400_S_CONNECTION. 3.TAW10_1 Unit 10 Solution 25 Solution 25: Implement Single Record Access . Create a separate import parameter for the airline ID and the connection number (suggested names: IV_CARRID and IV_CONNID). . Enter the names of the parameters and the data types. a) Open the Import tab page. For the data type of the parameter.

Implement a single record access (SELECT SINGLE) to the database table SPFLI that fills the export parameter of the function module with values. List all of the table fields that appear as components in the export parameter. 4. . a) See the source code extract from the model solution. You must not select the Exception Classes field. Make sure that the order of the fields matches the order of the structure components. implement a single record access to the database table SPFLI. 1.TAW10_1 Unit 10 Solution 25 Solution 25: Implement Single Record Access . Task 3 In the source code of the function module. Enter the name of the exception and a short text. Use the interface parameters of the function module to do this. Raise an exception for the case in which no data can be found for the selection. Create a (classic) exception (suggested name: NO_DATA). a) Open the Exceptions tab page.

a) See the source code extract from the model solution. Apply a selection condition (WHERE clause) to the SELECT statement. 1. a) See the source code extract from the model solution. 3. 2. Test your function module. Raise the exception for the function module if the database access returns no data (sy-subrc <> 0). . Activate the function module. a) In the Function Builder toolbar. Use both import parameters of the function module to do this. Task 4 Activate and test your function module. 2.TAW10_1 Unit 10 Solution 25 Solution 25: Implement Single Record Access . choose the Activate pushbutton.

if an error occurs. choose the Test/Execute pushbutton. a) In the Function Builder toolbar. c) Check the result. b) Supply the import parameters with values and choose the Execute pushbutton. Hint: Check the raising of the exception.TAW10_1 Unit 10 Solution 25 Solution 25: Implement Single Record Access .Function Module: FUNCTION BC400_DDS_CONNECTION_GET . Source Code Excerpt . *"--------------------------------------------------------*" IMPORTING *" REFERENCE(IV_CARRID) TYPE BC400_S_CONNECTION-CARRID *" REFERENCE(IV_CONNID) TYPE BC400_S_CONNECTION-CONNID *" EXPORTING .

IF sy-subrc <> 0.TAW10_1 Unit 10 Solution 25 Solution 25: Implement Single Record Access . ENDFUNCTION. ENDIF. . *" REFERENCE(ES_CONNECTION) TYPE BC400_S_CONNECTION *" EXCEPTIONS *" NO_DATA *"--------------------------------------------------------SELECT SINGLE carrid connid cityfrom airpfrom cityto airpto fltime deptime arrtime FROM spfli INTO es_connection WHERE carrid = iv_carrid AND connid = iv_connid. RAISE no_data.

TAW10_1 Summary You should now be able to: ● Read single database records .

you will be able to: ● ● Implement a SELECT loop Implement an array fetch .TAW10_1 Unit 10 Lesson 3 Lesson 3: Reading Multiple Database Records Lesson Objectives After completing this lesson.

TAW10_1 Figure 204: Reading Several Rows Using a Loop Unit 10 Lesson 3 .

Business Example You want to develop a program in which all of the flight times for a single flight connection are read from the database. Template None Solution BC400_DDS (function group) BC400_DDS_FLIGHTLIST_GET (function module) Task 1 Create a function group. You encapsulate the required database access by a SELECT loop in a function module so that you can reuse it. Create a new function group in your package (suggested name: ZBC400_##). 1. Read from the database using a SELECT loop and fill an internal table record by record.TAW10_1 Unit 10 Exercise 26 Exercise 26: Implement a SELECT Loop . . if one does not already exist.

1. For typing. Create a new function module in your function group (suggested name: Z_BC400_##_FLIGHTLIST_GET). Create a separate import parameter for airline ID and the connection number (suggested names: IV_CARRID and IV_CONNID). choose suitable components of structure type BC400_S_FLIGHT (line type of table type BC400_T_FLIGHTS). 2. .TAW10_1 Unit 10 Exercise 26 Exercise 26: Implement a SELECT Loop . Maintain the interface for the function module in such a way that it imports an airline ID and a flight connection number and returns a list of flight times. Task 2 Create a new function module in the function group. Type the parameter as Dictionary table type BC400_T_FLIGHTS. Raise an exception for the case in which no data can be found for the selection. 3. Create an export parameter for the list of flight dates (suggested name: ET_FLIGHTS).

List all of the table fields that appear as components in the line type of the export parameter. 4. . Declare a local. 2. Implement a SELECT loop in database table SFLIGHT that fills the local data object with values on every loop pass. Raise an exception for the case in which no data can be found for the selection. Define a classic exception (suggested name: NO_DATA). Make sure that the order of the fields matches the order of the structure components. implement a SELECT loop to the database table SFLIGHT. structured data object in the function module (suggested name: ls_flight) that can be used as a work area for the export parameter (internal table). Make sure that the export parameter of the function module is filled with a new row in each loop pass.TAW10_1 Unit 10 Exercise 26 Exercise 26: Implement a SELECT Loop . Task 3 In the source code of the function module. 1.

Make sure that the export parameter does not contain any data before the first loop pass. 4. . Calculate the utilization for each data record as a percentage beforehand within the loop (structure component PERCENTAGE). use the maximum number of seats and the number of occupied seats (structure components SEATSMAX and SEATSOCC). Apply a selection condition (WHERE clause) to the SELECT statement. 5. Use the local data object to add a new row to the export parameter for each loop pass (APPEND statement). Use both import parameters of the function module to do this.TAW10_1 Unit 10 Exercise 26 Exercise 26: Implement a SELECT Loop . To do this. 3.

In this case. Task 4 . Hint: If you set the call by value for the export parameter. the export parameter can already contain data if the function module is called with a non-initial actual parameter. Raise the exception for the function module if the database access returns no data (sy-subrc <> 0). See the source code extract from the model solution. 7. 6. For parameters of table type. the parameter is initial before each function module call. (OPTIONAL) After the select statement has successfully been called. sort the flight list in descending order by percentage utilization before returning the data. call by reference is recommended for performance reasons.TAW10_1 Unit 10 Exercise 26 Exercise 26: Implement a SELECT Loop .

1. 2. Activate the function module. Activate and test your function module.TAW10_1 Unit 10 Exercise 26 Exercise 26: Implement a SELECT Loop . . Test your function module.

Create a new function group in your package (suggested name: ZBC400_##). .TAW10_1 Unit 10 Solution 26 Solution 26: Implement a SELECT Loop . Business Example You want to develop a program in which all of the flight times for a single flight connection are read from the database. if one does not already exist. You encapsulate the required database access by a SELECT loop in a function module so that you can reuse it. 1. Template None Solution BC400_DDS (function group) BC400_DDS_FLIGHTLIST_GET (function module) Task 1 Create a function group. Read from the database using a SELECT loop and fill an internal table record by record.

Create a new function module in your function group (suggested name: Z_BC400_##_FLIGHTLIST_GET). Raise an exception for the case in which no data can be found for the selection. b) Enter the name of the function group and a short text and choose Save. open the context menu for the package and choose Create → Function Group. 1. a) In the navigation area.TAW10_1 Unit 10 Solution 26 Solution 26: Implement a SELECT Loop . . Maintain the interface for the function module in such a way that it imports an airline ID and a flight connection number and returns a list of flight times. Task 2 Create a new function module in the function group. c) Assign the function group to your package and submit your request in the usual way.

Enter the name of the parameter and the data type. Define a classic exception (suggested name: NO_DATA). Type the parameter as Dictionary table type BC400_T_FLIGHTS. b) Enter the name of the function module and a short text and choose Save. a) Open the Export tab page. open the context menu for your function group and choose Create → Function Module. 2.TAW10_1 Unit 10 Solution 26 Solution 26: Implement a SELECT Loop . For typing. Create a separate import parameter for airline ID and the connection number (suggested names: IV_CARRID and IV_CONNID). a) Open the Import tab page. . a) In the navigation area. Enter the names of the parameters and the data types. choose suitable components of structure type BC400_S_FLIGHT (line type of table type BC400_T_FLIGHTS). 3. Create an export parameter for the list of flight dates (suggested name: ET_FLIGHTS). 4.

a) Open the Exceptions tab page. a) Declare the data object either with direct reference to the line type (Dictionary structure type BC400_S_FLIGHT) or relative to the export parameter (LIKE LINE OF). Raise an exception for the case in which no data can be found for the selection.TAW10_1 Unit 10 Solution 26 Solution 26: Implement a SELECT Loop . . implement a SELECT loop to the database table SFLIGHT. Task 3 In the source code of the function module. 1. Do not choose the Exception Classes field. Declare a local. Make sure that the export parameter of the function module is filled with a new row in each loop pass. structured data object in the function module (suggested name: ls_flight) that can be used as a work area for the export parameter (internal table). Enter the name of the exception and a short text.

Make sure that the order of the fields matches the order of the structure components. a) See the source code extract from the model solution.TAW10_1 Unit 10 Solution 26 Solution 26: Implement a SELECT Loop . 4. Use the local data object to add a new row to the export parameter for each loop pass (APPEND statement). To do this. . 2. b) See the source code extract from the model solution. Implement a SELECT loop in database table SFLIGHT that fills the local data object with values on every loop pass. use the maximum number of seats and the number of occupied seats (structure components SEATSMAX and SEATSOCC). Apply a selection condition (WHERE clause) to the SELECT statement. Calculate the utilization for each data record as a percentage beforehand within the loop (structure component PERCENTAGE). 3. Use both import parameters of the function module to do this. List all of the table fields that appear as components in the line type of the export parameter. a) See the source code extract from the model solution.

Make sure that the export parameter does not contain any data before the first loop pass. a) See the source code extract from the model solution. Raise the exception for the function module if the database access returns no data (sy-subrc <> 0). . 5. 6. Hint: If you set the call by value for the export parameter.TAW10_1 Unit 10 Solution 26 Solution 26: Implement a SELECT Loop . the export parameter can already contain data if the function module is called with a non-initial actual parameter. a) REFRESH statement. For parameters of table type. See the source code extract from the model solution. In this case. the parameter is initial before each function module call. a) See the source code extract from the model solution. call by reference is recommended for performance reasons.

b) Supply the import parameters with values and choose the Execute pushbutton. 2. sort the flight list in descending order by percentage utilization before returning the data. choose the Active pushbutton. (OPTIONAL) After the select statement has successfully been called. Activate the function module. Test your function module. Task 4 Activate and test your function module. a) In the Function Builder toolbar. 7. choose the Test/Execute pushbutton. a) In the Function Builder toolbar. . See the source code extract from the model solution.TAW10_1 Unit 10 Solution 26 Solution 26: Implement a SELECT Loop . c) Check the result. 1.

. Source Code Extract .Function Module: FUNCTION bc400_dds_flightlist_get. Note: Check also the raising of the exception if an error occurs.TAW10_1 Unit 10 Solution 26 Solution 26: Implement a SELECT Loop . *"----------------------------------------------------*" IMPORTING *" REFERENCE(IV_CARRID) TYPE BC400_S_FLIGHT-CARRID *" REFERENCE(IV_CONNID) TYPE BC400_S_FLIGHT-CONNID *" EXPORTING *" REFERENCE(ET_FLIGHTS) TYPE BC400_T_FLIGHTS *" EXCEPTIONS *" NO_DATA *"----------------------------------------------------DATA ls_flight TYPE bc400_s_flight.

APPEND ls_flight TO et_flights. . SELECT carrid connid fldate seatsmax seatsocc FROM sflight INTO ls_flight WHERE carrid = iv_carrid AND connid = iv_connid. SORT et_flights BY percentage DESCENDING. ELSE. ls_flight-percentage = ls_flight-seatsocc / ls_flight-seatsmax * 100. REFRESH et_flights. ENDFUNCTION. ENDSELECT. RAISE no_data.TAW10_1 Unit 10 Solution 26 Solution 26: Implement a SELECT Loop . IF sy-subrc <> 0. ENDIF.

TAW10_1 Figure 205: Reading Several Rows of Data Using an Array Fetch Unit 10 Lesson 3 .

Business Example You want to develop a program in which all of the flight times for a single flight connection are read from the database. You encapsulate the required database access using an array fetch in a function module so that you can reuse it. Template BC400_DDS (function group) BC400_DDS_FLIGHTLIST_GET (function module) Solution BC400_DDS (function group) BC400_DDS_FLIGHTLIST_GET_OPT (function module) Read from the database using an array fetch and completely fill an internal table. Task 1 Create a function group. if one does not already exist.TAW10_1 Unit 10 Exercise 27 Exercise 27: Implement an Array Fetch . .

Task 3 Turn the SELECT loop into a comment and replace it with a database access in which the export parameter of the function module (internal table) is filled directly with data (array fetch). Create a new function group in your package (suggested name: ZBC400_##).TAW10_1 Unit 10 Exercise 27 Exercise 27: Implement an Array Fetch . . Implement a loop through the internal table to calculate the utilization percentage for each flight time. Copy the function module (new name: Z_BC400_##_FLIGHTLIST_GET_OPT). 1. Task 2 Copy function module BC400_DDS_FLIGHTLIST_GET from the function group BC400_DDS or your own function module Z_BC400_##_FLIGHTLIST_GET under a new name to your own function module. 1.

Implement a loop through the internal table (LOOP . 4. which fills the export parameter of the function module directly. Task 4 . Replace the SELECT loop with an array fetch. Use the same field list and the WHERE condition as for the SELECT loop. 3. The loop should only be executed if the database access has delivered data.. 2. ENDLOOP).TAW10_1 Unit 10 Exercise 27 Exercise 27: Implement an Array Fetch . 1. Turn the entire SELECT loop from SELECT to ENDSELECT into a comment. Use the INDEX sy-tabix addition to change the current line. Use the TRANSPORTING percentage addition to update only the changed field.. Use the MODIFY statement to write the changed line back to the internal table within the loop after the calculation. Use the local structured data object as the work area and calculate the utilization percentage within the loop as before.

Test your function module. Activate the function module.TAW10_1 Unit 10 Exercise 27 Exercise 27: Implement an Array Fetch . 1. Activate and test your function module. 2. .

Task 1 Create a function group. Template BC400_DDS (function group) BC400_DDS_FLIGHTLIST_GET (function module) Solution BC400_DDS (function group) BC400_DDS_FLIGHTLIST_GET_OPT (function module) Read from the database using an array fetch and completely fill an internal table. . if one does not already exist. You encapsulate the required database access using an array fetch in a function module so that you can reuse it.TAW10_1 Unit 10 Solution 27 Solution 27: Implement an Array Fetch . Business Example You want to develop a program in which all of the flight times for a single flight connection are read from the database.

. a) In the navigation area. 1. 1. Copy the function module (new name: Z_BC400_##_FLIGHTLIST_GET_OPT). Task 2 Copy function module BC400_DDS_FLIGHTLIST_GET from the function group BC400_DDS or your own function module Z_BC400_##_FLIGHTLIST_GET under a new name to your own function module. Create a new function group in your package (suggested name: ZBC400_##). b) Enter the name of the function group and a short text and choose Save.TAW10_1 Unit 10 Solution 27 Solution 27: Implement an Array Fetch . c) Assign the function group to your package and your request in the usual way. open the context menu for the package and choose Create → Function Group.

1.TAW10_1 Unit 10 Solution 27 Solution 27: Implement an Array Fetch . display the function group that contains the function module to be copied. c) Enter the name of the new function module as well as the function group in which it should be created. Implement a loop through the internal table to calculate the utilization percentage for each flight time. . b) Open the context menu for the function module and choose Copy. a) In the navigation area. Task 3 Turn the SELECT loop into a comment and replace it with a database access in which the export parameter of the function module (internal table) is filled directly with data (array fetch). Turn the entire SELECT loop from SELECT to ENDSELECT into a comment. and choose Copy.

The loop should only be executed if the database access has delivered data. Implement a loop through the internal table (LOOP . 3. a) See the source code excerpt from the model solution. depending on which editor is set. 2. Replace the SELECT loop with an array fetch.. Use the same field list and the WHERE condition as for the SELECT loop. ENDLOOP). choose either Comment or Format → Comment Lines. you can use Ctrl + < in both editors. Use the local structured data object as the work area and calculate the utilization percentage within the loop as before. a) See the source code excerpt from the model solution. b) Open the context menu in this area and. ..TAW10_1 Unit 10 Solution 27 Solution 27: Implement an Array Fetch . a) Select the corresponding area in the ABAP Editor. Alternatively. which fills the export parameter of the function module directly.

Use the INDEX sy-tabix addition to change the current line. 4. . a) In the Function Builder toolbar.TAW10_1 Unit 10 Solution 27 Solution 27: Implement an Array Fetch . a) See the source code excerpt from the model solution. Test your function module. choose the Activate pushbutton. Use the TRANSPORTING percentage addition to update only the changed field. Activate the function module. Task 4 Activate and test your function module. a) In the Function Builder toolbar. 1. 2. Use the MODIFY statement to write the changed line back to the internal table within the loop after the calculation. choose the Test/Execute pushbutton.

c) Check the result. if an error occurs. Source Code Excerpt .TAW10_1 Unit 10 Solution 27 Solution 27: Implement an Array Fetch .Function Module: FUNCTION bc400_dds_flightlist_get_opt . Hint: Check the raising of the exception. *"----------------------------------------------------*" IMPORTING *" REFERENCE(IV_CARRID) TYPE BC400_S_FLIGHT-CARRID *" REFERENCE(IV_CONNID) TYPE BC400_S_FLIGHT-CONNID *" EXPORTING *" REFERENCE(ET_FLIGHTS) TYPE BC400_T_FLIGHTS *" EXCEPTIONS . b) Supply the import parameters with values and choose the Execute pushbutton.

* * * * * * * * * * SELECT carrid connid fldate seatsmax seatsocc FROM sflight INTO ls_flight WHERE carrid = iv_carrid AND connid = iv_connid. *" NO_DATA *"----------------------------------------------------DATA ls_flight TYPE bc400_s_flight. SELECT carrid connid fldate seatsmax seatsocc . ENDSELECT. ls_flight-percentage = ls_flight-seatsocc / ls_flight-seatsmax *100. APPEND ls_flight TO et_flights.TAW10_1 Unit 10 Solution 27 Solution 27: Implement an Array Fetch .

ENDFUNCTION. . MODIFY et_flights FROM ls_flight INDEX sy-tabix TRANSPORTING percentage. RAISE no_data. SORT et_flights BY percentage DESCENDING.TAW10_1 Unit 10 Solution 27 Solution 27: Implement an Array Fetch . ENDIF. IF sy-subrc <> 0. ENDLOOP. ELSE. FROM sflight INTO TABLE et_flights WHERE carrid = iv_carrid AND connid = iv_connid. ls_flight-percentage = ls_flight-seatsocc / ls_flight-seatsmax * 100. LOOP AT et_flights INTO ls_flight.

TAW10_1 Summary You should now be able to: ● Implement a SELECT loop ● Implement an array fetch .

TAW10_1 Unit 10 Lesson 4 Lesson 4: Handling Other Aspects of Database Access Lesson Objectives After completing this lesson. you will be able to: ● ● ● ● ● Read client-specific data Use database indexes Explain the SAP table buffer Read data from several database tables Identify ways to change data in a database table .

TAW10_1 Figure 206: Reading Data from Client-Specific Tables Unit 10 Lesson 4 .

TAW10_1 Figure 207: Access Through Key Fields Unit 10 Lesson 4 .

TAW10_1 Figure 208: Access Through Non-Key Fields Unit 10 Lesson 4 .

TAW10_1 Figure 209: Access Through a Secondary Index Unit 10 Lesson 4 .

TAW10_1 Figure 210: Access Through the SAP Table Buffer Unit 10 Lesson 4 .

TAW10_1 Figure 211: Example of a Table Join Unit 10 Lesson 4 .

TAW10_1 Figure 212: Entries for Defining a Table Join Unit 10 Lesson 4 .

TAW10_1 Figure 213: Implementation Options for Table Joins Unit 10 Lesson 4 .

TAW10_1 Figure 214: Database Change Accesses Unit 10 Lesson 4 .

TAW10_1 Summary You should now be able to: ● Read client-specific data ● Use database indexes ● Explain the SAP table buffer ● Read data from several database tables ● Identify ways to change data in a database table .

you will be able to: ● ● Explain the SAP authorization concept Implement authorization checks .TAW10_1 Unit 10 Lesson 5 Lesson 5: Working with Authorization Checks Lesson Objectives After completing this lesson.

TAW10_1 Figure 215: SAP Authorization Concept Unit 10 Lesson 5 .

TAW10_1 Figure 216: Authorization Objects and Authorizations (Example) Unit 10 Lesson 5 .

TAW10_1 Figure 217: Authorization Check (Principle) Unit 10 Lesson 5 .

TAW10_1 Figure 218: Displaying Authorization Objects Unit 10 Lesson 5 .

TAW10_1 Figure 219: Authorization Check (Syntax Example) Unit 10 Lesson 5 .

TAW10_1 Figure 220: Implementing Authorization Checks in Programs Unit 10 Lesson 5 .

Task 1 Create a new function module in the function group. therefore. Access to the data for this model is controlled using authorizations in authorization object S_CARRID. .TAW10_1 Unit 10 Exercise 28 Exercise 28: Implement an Authorization Check . Business Example You want to develop a program in which data for the flight model is read from the database. Template None Solution BC400_DDS_AUTH_CHECK (function module) Implement authorization checks. you encapsulate it in a function module. To make the authorization check reusable. Maintain the interface for the function module so that it imports an airline ID and an activity for the authorization check. need to perform an authorization check. You.

. Create two exceptions for the confirmation: one in case no authorization exists and another in case the caller has specified an invalid activity. Create a separate import parameter for the airline ID and the activity (suggested names: IV_CARRID and IV_ACTIVITY). 1. To type the data element. To do this. You will find the relevant data element (second column) for each authorization field (first column) here.TAW10_1 Unit 10 Exercise 28 Exercise 28: Implement an Authorization Check . choose S_CARR_ID and ACTIV_AUTH. 2. Hint: The correct data elements are defined in the authorization object. open authorization object S_CARRID in display mode and choose the input help for one of the authorization fields. Create a new function module in your function group (suggested name: Z_BC400_##_AUTH_CHECK).

. Create two (classic) exceptions (suggested names: NO_AUTH and WRONG_ACTIVITY). Task 2 Implement an authorization check in the source code for authorization object S_CARRID. 3. 1. Evaluate the return value (sy-subrc) and raise an exception for the case in which authorization is missing.TAW10_1 Unit 10 Exercise 28 Exercise 28: Implement an Authorization Check . Implement an authorization check for authorization object S_CARRID. Supply the authorization fields with the import parameters for the function module. Raise an exception for the case in which the authorization does not exist or the caller has not specified any of the relevant activities.

If necessary. Before the authorization check. open the authorization object in display mode and choose the Permitted Activities pushbutton at the bottom of the screen.TAW10_1 Unit 10 Exercise 28 Exercise 28: Implement an Authorization Check . raise an exception. Hint: Use the Pattern function to make the authorization check. . Task 3 Activate and test your function module. 2. Hint: The relevant activities are defined in the authorization object. make sure that the caller has specified only one of the relevant activities. because it is very intolerant of typos and uppercase/lowercase errors. To do this.

. Activate the function module. 2.TAW10_1 Unit 10 Exercise 28 Exercise 28: Implement an Authorization Check . 1. Test your function module.

Maintain the interface for the function module so that it imports an airline ID and an activity for the authorization check. Business Example You want to develop a program in which data for the flight model is read from the database. You. .TAW10_1 Unit 10 Solution 28 Solution 28: Implement an Authorization Check . Access to the data for this model is controlled using authorizations in authorization object S_CARRID. Template None Solution BC400_DDS_AUTH_CHECK (function module) Implement authorization checks. therefore. Task 1 Create a new function module in the function group. you encapsulate it in a function module. need to perform an authorization check. To make the authorization check reusable.

2. open the context menu for your function group and choose Create → Function Module. 1. choose S_CARR_ID and ACTIV_AUTH. a) In the navigation area. To type the data element.TAW10_1 Unit 10 Solution 28 Solution 28: Implement an Authorization Check . Create a new function module in your function group (suggested name: Z_BC400_##_AUTH_CHECK). Create a separate import parameter for the airline ID and the activity (suggested names: IV_CARRID and IV_ACTIVITY). Create two exceptions for the confirmation: one in case no authorization exists and another in case the caller has specified an invalid activity. b) Enter the name of the function module and a short text and choose Save. .

Create two (classic) exceptions (suggested names: NO_AUTH and WRONG_ACTIVITY). a) Open the Exceptions tab page. Do not set the Exception Classes indicator. 3. a) Open the Import tab page. You will find the relevant data element (second column) for each authorization field (first column) here. Hint: The correct data elements are defined in the authorization object. To do this. Task 2 . Enter the names of the exceptions and a short text. open authorization object S_CARRID in display mode and choose the input help for one of the authorization fields. Enter the names of the parameters and the data types.TAW10_1 Unit 10 Solution 28 Solution 28: Implement an Authorization Check .

Implement an authorization check in the source code for authorization object S_CARRID. 2. make sure that the caller has specified only one of the relevant activities.TAW10_1 Unit 10 Solution 28 Solution 28: Implement an Authorization Check . 1. . because it is very intolerant of typos and uppercase/lowercase errors. Before the authorization check. Implement an authorization check for authorization object S_CARRID. Hint: Use the Pattern function to make the authorization check. Raise an exception for the case in which the authorization does not exist or the caller has not specified any of the relevant activities. Evaluate the return value (sy-subrc) and raise an exception for the case in which authorization is missing. a) See the source code excerpt from the model solution. Supply the authorization fields with the import parameters for the function module. raise an exception. If necessary.

. a) See the source code excerpt from the model solution. Task 3 Activate and test your function module.TAW10_1 Unit 10 Solution 28 Solution 28: Implement an Authorization Check . Activate the function module. choose the Activate pushbutton. Test your function module. Hint: The relevant activities are defined in the authorization object. a) In the Function Builder toolbar. open the authorization object in display mode and choose the Permitted Activities pushbutton at the bottom of the screen. To do this. 2. 1.

*"--------------------------------------------------*" IMPORTING *" REFERENCE(IV_CARRID) TYPE S_CARR_ID *" REFERENCE(IV_ACTIVITY) TYPE ACTIV_AUTH *" EXCEPTIONS . a) In the Function Builder toolbar. b) Supply the import parameters with values and choose the Execute pushbutton. Source Code Excerpt .TAW10_1 Unit 10 Solution 28 Solution 28: Implement an Authorization Check . c) Check the result. choose the Test/Execute pushbutton. Hint: Check the raising of the exception. if an error occurs.Function Module: FUNCTION bc400_dds_auth_check.

RAISE no_auth. WHEN '01' OR '02' OR '03'. ENDCASE.TAW10_1 Unit 10 Solution 28 Solution 28: Implement an Authorization Check . IF sy-subrc <> 0. ENDIF. WHEN OTHERS. *" NO_AUTH *" WRONG_ACTIVITY *"--------------------------------------------------CASE iv_activity. ENDFUNCTION. RAISE wrong_activity. AUTHORITY-CHECK OBJECT 'S_CARRID' ID 'CARRID' FIELD iv_carrid ID 'ACTVT' FIELD iv_activity. .

TAW10_1 Summary You should now be able to: ● Explain the SAP authorization concept ● Implement authorization checks .

data field D.TAW10_1 Multiple Choice Unit 10 For each entity fixed in the data model. the developer creates a transparent table in the _________. A. database . Choose the correct answers. transparent field B. ABAP Dictionary C.

TAW10_1 Multiple Choice Unit 10 For each entity fixed in the data model. B. the developer creates a transparent table in the _________. ABAP Dictionary .

" . such as the key definition or the technical properties. Unit 10 "When using the transparent table as a data type. other properties.TAW10_1 Determine whether this statement is true or false. are relevant.

Unit 10 "When using the transparent table as a data type. are relevant. other properties.TAW10_1 Determine whether this statement is true or false." False . such as the key definition or the technical properties.

Methods of local classes . Business Application Programming Interfaces (BAPIs) D. Function modules C.TAW10_1 Multiple Choice Unit 10 Which of the following are the types of reuse components that encapsulate database access? Choose the correct answers. Conceptual database B. A.

Methods of local classes .TAW10_1 Multiple Choice Unit 10 Which of the following are the types of reuse components that encapsulate database access? B. Function modules C. Business Application Programming Interfaces (BAPIs) D.

" . Unit 10 "The SELECT clause determines which lines are read into the target structure and processed using the statement block which you specify in the loop body.TAW10_1 Determine whether this statement is true or false.

" False .TAW10_1 Determine whether this statement is true or false. Unit 10 "The SELECT clause determines which lines are read into the target structure and processed using the statement block which you specify in the loop body.

Choose the correct answer. you can use the _________ addition. INTO CORRESPONDING FIELD OF TABLE D. Unit 10 A. END SELECT .TAW10_1 If you want to append rows in a Select statement. APPENDING TABLE C. INTO TABLE B.

TAW10_1 If you want to append rows in a Select statement. Unit 10 B. APPENDING TABLE . you can use the _________ addition.

data records from the current and all other clients are read. Unit 10 "If you select data from client-specific tables without specifying the client." .TAW10_1 Determine whether this statement is true or false.

" False .TAW10_1 Determine whether this statement is true or false. data records from the current and all other clients are read. Unit 10 "If you select data from client-specific tables without specifying the client.

direct search B. A. sequential search D. binary search C.TAW10_1 Unit 10 In the worst-case scenario. Choose the correct answer. This concept is referred to as ________. the system has to search the entire table. for the required entries. or at least a very large part thereof. indirect search .

C. This concept is referred to as ________.TAW10_1 Unit 10 In the worst-case scenario. or at least a very large part thereof. for the required entries. the system has to search the entire table. sequential search .

Join conditions C. Join columns .TAW10_1 Multiple Choice Unit 10 Which of the following should you specify when defining a table join? Choose the correct answers. Join tables B. A. Join rows D.

TAW10_1 Multiple Choice Unit 10 Which of the following should you specify when defining a table join? A. Join conditions D. Join tables B. Join columns .

Unit 10 "If an ABAP program reads a buffered table.TAW10_1 Determine whether this statement is true or false. the database interface tries to get the required data from the SAP table buffer." .

the database interface tries to get the required data from the SAP table buffer.TAW10_1 Determine whether this statement is true or false. Unit 10 "If an ABAP program reads a buffered table." True .

A. UPDATE C.TAW10_1 Multiple Choice Unit 10 Which of the following statements are contained within Open SQL? Choose the correct answers. CREATE B. SELECT . INSERT D.

UPDATE C. INSERT D. SELECT .TAW10_1 Multiple Choice Unit 10 Which of the following statements are contained within Open SQL? B.

TAW10_1 Determine whether this statement is true or false." . Unit 10 "You can define authorization objects within object classes.

" True . Unit 10 "You can define authorization objects within object classes.TAW10_1 Determine whether this statement is true or false.

AUTHORITY B. A. AUTHORITY-CHECK D.TAW10_1 Unit 10 At runtime. SELECT C. VALID AUTHORITY . which of the following statements can you use to check whether the actual user has the authorization required for executing the function in the user master record? Choose the correct answer.

TAW10_1 Unit 10 At runtime. which of the following statements can you use to check whether the actual user has the authorization required for executing the function in the user master record? C. AUTHORITY-CHECK .

" . you should generate the AUTHORITY-CHECK statement into your source code by means of the Object pushbutton.TAW10_1 Determine whether this statement is true or false. Unit 10 "To avoid spelling errors in object and field names.

Unit 10 "To avoid spelling errors in object and field names. " False .TAW10_1 Determine whether this statement is true or false. you should generate the AUTHORITY-CHECK statement into your source code by means of the Object pushbutton.

Unit 11: Classic ABAP Report Lesson 1: Implementing ABAP Lists Lesson 2: Implementing Selection Screens Lesson 3: Implementing Events of ABAP Reports .

you will be able to: ● Implement ABAP lists .TAW10_1 Unit 11 Lesson 1 Lesson 1: Implementing ABAP Lists Lesson Objectives After completing this lesson.

TAW10_1 Figure 221: Features of Lists Unit 11 Lesson 1 .

TAW10_1 Figure 222: Standard List Functions Unit 11 Lesson 1 .

TAW10_1 Figure 223: List and Column Headers Unit 11 Lesson 1 .

TAW10_1 Summary You should now be able to: ● Implement ABAP lists .

TAW10_1 Unit 11 Lesson 2 Lesson 2: Implementing Selection Screens Lesson Objectives After completing this lesson. you will be able to: ● ● Describe the attributes and benefits of selection screens Implement options for restricting selections of selection screens .

TAW10_1 Figure 224: Architecture and Purpose of Selection Screens Unit 11 Lesson 2 .

TAW10_1 Figure 225: Selection Screen Attributes Unit 11 Lesson 2 .

TAW10_1 Figure 226: Using Selection Options Unit 11 Lesson 2 .

TAW10_1 Figure 227: Semantic Information About Global Types on the Selection Screen Unit 11 Lesson 2 .

TAW10_1 Figure 228: Selection Texts Unit 11 Lesson 2 .

TAW10_1 Figure 229: Single-Value Input (PARAMETERS Statement) Unit 11 Lesson 2 .

TAW10_1 Figure 230: Entering Complex Selections (SELECT-OPTIONS Statement) Unit 11 Lesson 2 .

possibly. and use icons and colors in a classic list (optional). use translatable text elements on the selection screen and in the ABAP list. colors and icons. transfer complex selections to a data retrieval method.TAW10_1 Unit 11 Exercise 29 Exercise 29: Create a Selection Screen and a Classic ABAP List . Task 1 . Furthermore. you want to be able to enter complex selection criteria on the flight selection screen. Business Example Instead of a single flight number. you want to make the design of the selection screen and the ABAP list more appealing by using translatable texts and. Template BC400_RPT_REP_A Solution BC400_RPS_REP_A Use the ABAP SELECT-OPTIONS statement to implement a complex selection option on the selection screen.

To adjust the data retrieval in such a way that the selectoptions is used. Replace the declaration of parameter PA_CON with the declaration of a selectoptions (suggested name: so_con). Copy the template to the name ZBC400_##_REP_A. call a method of class CL_BC400_FLIGHTMODEL to which you can transfer the select-options table.TAW10_1 Unit 11 Exercise 29 Exercise 29: Create a Selection Screen and a Classic ABAP List . . Hint: Reference the same structure type in the Dictionary when typing the selectoptions and parameter PA_CAR so that the corresponding search help on the selection screen is context-dependent. 1. 1. Task 2 Replace the parameter for the flight number on the selection screen with a complex selection (select-options).

3. The parameters can only be transferred if you explicitly transfer the body of the table (also SO_CON[]). Replace the call of method CL_BC400_FLIGHTMODEL=>GET_FLIGHTS with a call of method CL_BC400_FLIGHTMODEL=>GET_FLIGHTS_RANGE. Activate and test your program. Transfer the select option table to the method as an actual parameter. Hint: Data object SO_CON is an internal table with a header. 2. . Task 3 Make sure language-dependent texts are displayed on the selection screen instead of the names of the data objects.TAW10_1 Unit 11 Exercise 29 Exercise 29: Create a Selection Screen and a Classic ABAP List .

Maintain the text elements of the program and define selection texts. 1. Activate and test your program. Maintain a text symbol and output it with the WRITE statement if the method returns no data. 2. 1. Task 4 If no data is available. output a translatable text in the list and create translatable headers. Use texts that have already been defined and translated in the ABAP Dictionary.TAW10_1 Unit 11 Exercise 29 Exercise 29: Create a Selection Screen and a Classic ABAP List . Maintain the headers for the list. 2. Task (Optional) .

Use red for fully booked flights. Output an icon at the start of each row to show utilization by means of a traffic light. and green for flights with few or no bookings. yellow for well-booked flights. Use one of the constants ICON_RED_LIGHT.TAW10_1 Unit 11 Exercise 29 Exercise 29: Create a Selection Screen and a Classic ABAP List . 2. CONNID. Define the key fields for the flight times as light blue. FLDATE) with a COLOR addition and the color constant for key fields from the COL type group. . Provide the output of each of the key fields (CARRID. ICON_YELLOW_LIGHT. depending on the utilization percentage of the flight. Output a traffic light icon at the start of each row. 1. and ICON_GREEN_LIGHT from the ICON type group.

Business Example Instead of a single flight number. you want to make the design of the selection screen and the ABAP list more appealing by using translatable texts and. possibly. Furthermore. and use icons and colors in a classic list (optional). use translatable text elements on the selection screen and in the ABAP list.TAW10_1 Unit 11 Solution 29 Solution 29: Create a Selection Screen and a Classic ABAP List . Task 1 . transfer complex selections to a data retrieval method. you want to be able to enter complex selection criteria on the flight selection screen. colors and icons. Template BC400_RPT_REP_A Solution BC400_RPS_REP_A Use the ABAP SELECT-OPTIONS statement to implement a complex selection option on the selection screen.

1. To adjust the data retrieval in such a way that the selectoptions is used. Replace the declaration of parameter PA_CON with the declaration of a selectoptions (suggested name: so_con). 1. Copy the template to the name ZBC400_##_REP_A. call a method of class CL_BC400_FLIGHTMODEL to which you can transfer the select-options table. Task 2 Replace the parameter for the flight number on the selection screen with a complex selection (select-options). a) Carry out this step in the usual manner. .TAW10_1 Unit 11 Solution 29 Solution 29: Create a Selection Screen and a Classic ABAP List .

. Hint: Reference the same structure type in the Dictionary when typing the selectoptions and parameter PA_CAR so that the corresponding search help on the selection screen is context-dependent. Replace the call of method CL_BC400_FLIGHTMODEL=>GET_FLIGHTS with a call of method CL_BC400_FLIGHTMODEL=>GET_FLIGHTS_RANGE.TAW10_1 Unit 11 Solution 29 Solution 29: Create a Selection Screen and a Classic ABAP List . Transfer the select option table to the method as an actual parameter. 2. Hint: Data object SO_CON is an internal table with a header. a) See the source code excerpt from the model solution. a) See the source code excerpt from the model solution. The parameters can only be transferred if you explicitly transfer the body of the table (also SO_CON[]).

a) Carry out this step in the usual manner. 1.TAW10_1 Unit 11 Solution 29 Solution 29: Create a Selection Screen and a Classic ABAP List . Activate and test your program. b) Select the checkbox in the Dictionary Reference column for all the listed elements of the selection screen. 3. Task 3 Make sure language-dependent texts are displayed on the selection screen instead of the names of the data objects. a) Open the maintenance of the selection screen by choosing Goto → Text Elements → Selection Texts. Maintain the text elements of the program and define selection texts. . Use texts that have already been defined and translated in the ABAP Dictionary.

2. Task 4 . a) Carry out this step in the usual manner.TAW10_1 Unit 11 Solution 29 Solution 29: Create a Selection Screen and a Classic ABAP List . Hint: You have to activate the texts (REPT type Repository object) before they are displayed when the program is executed. Activate and test your program. Hint: Only those parameters and select options offered here have been defined in the active version of the source code. c) Save and activate the texts.

c) Save and activate the texts. If no data is available. Maintain the headers for the list. 2. a) Open the maintenance of the text symbols by choosing Goto → Text Elements → Text Symbols. output a translatable text in the list and create translatable headers. . d) Output the text symbol on the list as shown in the source code excerpt from the model solution. Maintain a text symbol and output it with the WRITE statement if the method returns no data.TAW10_1 Unit 11 Solution 29 Solution 29: Create a Selection Screen and a Classic ABAP List . 1. b) Assign a three-character abbreviation and enter a text. a) Execute the program.

yellow for well-booked flights. c) Maintain the headers. Use red for fully booked flights. Output an icon at the start of each row to show utilization by means of a traffic light. . The headers will only be displayed when you restart the program. b) Branch from the list display to header maintenance (System → List → List Header). Hint: The list will be buffered on the presentation server. Task (Optional) Define the key fields for the flight times as light blue. d) Restart the program for testing.TAW10_1 Unit 11 Solution 29 Solution 29: Create a Selection Screen and a Classic ABAP List . and green for flights with few or no bookings.

2. a) See the source code excerpt from the model solution. Provide the output of each of the key fields (CARRID. Output a traffic light icon at the start of each row. TYPE-POOLS: icon. and ICON_GREEN_LIGHT from the ICON type group. .TAW10_1 Unit 11 Solution 29 Solution 29: Create a Selection Screen and a Classic ABAP List . FLDATE) with a COLOR addition and the color constant for key fields from the COL type group. Use one of the constants ICON_RED_LIGHT. 1. a) See the source code excerpt from the model solution. CONNID. ICON_YELLOW_LIGHT. depending on the utilization percentage of the flight. Source Code Excerpt: *&----------------------------------------------* *& Report BC400_RPS_REP_A *&----------------------------------------------* REPORT bc400_rps_rep_a.

SELECT-OPTIONS: so_con FOR gs_flight-connid. DATA: gt_flights TYPE bc400_t_flights. CONSTANTS: gc_limit_red TYPE s_flghtocc VALUE 98. . col. TRY.TAW10_1 Unit 11 Solution 29 Solution 29: Create a Selection Screen and a Classic ABAP List . PARAMETERS: pa_car TYPE bc400_s_flight-carrid. gs_flight TYPE bc400_s_flight. gc_limit_yellow TYPE s_flghtocc VALUE 75.

WRITE / 'No flights for selected flight connection'(non). CALL METHOD cl_bc400_flightmodel=>get_flights_range EXPORTING iv_carrid = pa_car it_connid = so_con[] " brackets needed for so_con IMPORTING et_flights = gt_flights. WRITE icon_red_light AS ICON. . "alternative usage of text symbol ENDTRY. WRITE icon_yellow_light AS ICON. ELSEIF gs_flight-percentage >= gc_limit_yellow. IF gs_flight-percentage >= gc_limit_red. NEW-LINE. * WRITE / text-non. LOOP AT gt_flights INTO gs_flight. CATCH cx_bc400_no_data.TAW10_1 Unit 11 Solution 29 Solution 29: Create a Selection Screen and a Classic ABAP List .

gs_flight-connid color COL_KEY. . WRITE: icon_green_light AS ICON. gs_flight-percentage. gs_flight-seatsmax. ENDLOOP. gs_flight-seatsocc. ELSE. gs_flight-carrid color COL_KEY.TAW10_1 Unit 11 Solution 29 Solution 29: Create a Selection Screen and a Classic ABAP List . gs_flight-fldate color COL_KEY. WRITE ENDIF.

TAW10_1 Summary You should now be able to: ● Describe the attributes and benefits of selection screens ● Implement options for restricting selections of selection screens .

you will be able to: ● Implement the events of ABAP reports    .TAW10_1 Unit 11 Lesson 3 Lesson 3: Implementing Events of ABAP Reports Lesson Objectives After completing this lesson.

TAW10_1 Figure 231: Structures and Procedures of an Executable ABAP Program Unit 11 Lesson 3 .

TAW10_1 Figure 232: Using ABAP Events Unit 11 Lesson 3 .

TAW10_1 Unit 11 Lesson 3 Event block characteristics: ● Introduced with an event keyword ● Ends by beginning the next processing block ● Cannot be nested ● Existence is not absolutely necessary ● Sequence of event blocks is unimportant ● Implicit standard event block in executable program: START-OF-SELECTION .

TAW10_1 Figure 233: Event Block Characteristics Unit 11 Lesson 3 .

TAW10_1 Figure 234: Example Program Unit 11 Lesson 3 .

TAW10_1 Figure 235: AT SELECTION-SCREEN Event Unit 11 Lesson 3 .

TAW10_1 Figure 236: Error Messages in AT SELECTIONSCREEN Unit 11 Lesson 3 .

TAW10_1 Figure 237: Syntax Example – Authorization Check with Error Dialog Unit 11 Lesson 3 .

If users enter an airline for which they do not have display authorization. Business Example You want to make a dynamic pre-assignment for the airline ID on the selection screen. Task 1 Copy your program ZBC400_##_REP_A or the copy template.TAW10_1 Unit 11 Exercise 30 Exercise 30: Implement Events of ABAP Reports . 1. Copy the template to the name ZBC400_##_REP_B. . an error message should appear and the selection screen should display again. Template BC400_RPS_REP_A Solution BC400_RPS_REP_B Implement a dynamic pre-assignment on the selection screen and error dialogs for the standard selection screen.

Hint: You have to assign the previous executable part of your program explicitly to the START-OF-SELECTION event block before you define the INITIALIZATION block. 1.TAW10_1 Unit 11 Exercise 30 Exercise 30: Implement Events of ABAP Reports . Create event block INITIALIZATION and fill parameter PA_CAR dynamically with the value LH. Implement the check in . Task 2 Create an ABAP event block that is run before the selection screen is displayed and implement a dynamic pre-assignment of the parameter for the airline ID. the system checks whether the user is authorized to display data for the airline that was entered. Task 3 Make sure that after a user action on the selection screen.

1. 2. use the method check _authority of class CL_BC400_FLIGHTMODEL.TAW10_1 Unit 11 Exercise 30 Exercise 30: Implement Events of ABAP Reports . 3. such a way that you can display the selection screen again with an error message if the authorization does not exist. Which message type do you have to use so that the selection screen is displayed again and the user cannot access the START-OF-SELECTION processing block without authorization? . send an appropriate message from message class BC400. If the authorization is missing. To do this. Create the AT SELECTION-SCREEN event block and implement an authorization check.

Business Example You want to make a dynamic pre-assignment for the airline ID on the selection screen. Template BC400_RPS_REP_A Solution BC400_RPS_REP_B Implement a dynamic pre-assignment on the selection screen and error dialogs for the standard selection screen. If users enter an airline for which they do not have display authorization. . 1. Task 1 Copy your program ZBC400_##_REP_A or the copy template.TAW10_1 Unit 11 Solution 30 Solution 30: Implement Events of ABAP Reports . Copy the template to the name ZBC400_##_REP_B. an error message should appear and the selection screen should display again.

Task 2 Create an ABAP event block that is run before the selection screen is displayed and implement a dynamic pre-assignment of the parameter for the airline ID. Hint: You have to assign the previous executable part of your program explicitly to the START-OF-SELECTION event block before you define the INITIALIZATION block. a) Carry out this step in the usual manner. . Create event block INITIALIZATION and fill parameter PA_CAR dynamically with the value LH. 1.TAW10_1 Unit 11 Solution 30 Solution 30: Implement Events of ABAP Reports . a) See the source code excerpt from the model solution.

. send an appropriate message from message class BC400. Task 3 Make sure that after a user action on the selection screen. If the authorization is missing. To do this. a) See the source code excerpt from the model solution. the system checks whether the user is authorized to display data for the airline that was entered. 2.TAW10_1 Unit 11 Solution 30 Solution 30: Implement Events of ABAP Reports . use the method check _authority of class CL_BC400_FLIGHTMODEL. a) See the source code excerpt from the model solution. 1. Create the AT SELECTION-SCREEN event block and implement an authorization check. Implement the check in such a way that you can display the selection screen again with an error message if the authorization does not exist.

col. Source Code Excerpt: *&-------------------------------------------*& Report BC400_RPS_REP_B *&-------------------------------------------REPORT bc400_rps_rep_b. . Which message type do you have to use so that the selection screen is displayed again and the user cannot access the START-OF-SELECTION processing block without authorization? a) See the source code excerpt from the model solution Error message. message type E.TAW10_1 Unit 11 Solution 30 Solution 30: Implement Events of ABAP Reports . 3. TYPE-POOLS: icon.

gs_flight TYPE bc400_s_flight.TAW10_1 Unit 11 Solution 30 Solution 30: Implement Events of ABAP Reports . PARAMETERS: pa_car TYPE bc400_s_flight-carrid. . pa_car = 'LH'. DATA: gt_flights TYPE bc400_t_flights. gc_actvt_display TYPE activ_auth VALUE '03'. SELECT-OPTIONS: so_con FOR gs_flight-connid. CONSTANTS: gc_limit_red TYPE s_flghtocc VALUE 98. INITIALIZATION. gc_limit_yellow TYPE s_flghtocc VALUE 75.

ENDTRY. START-OF-SELECTION.TAW10_1 Unit 11 Solution 30 Solution 30: Implement Events of ABAP Reports . MESSAGE e046(bc400) WITH pa_car. CATCH cx_bc400_no_auth . CALL METHOD cl_bc400_flightmodel=>check_authority EXPORTING iv_carrid = pa_car iv_activity = gc_actvt_display. TRY. TRY. AT SELECTION-SCREEN. CALL METHOD cl_bc400_flightmodel=>get_flights_range EXPORTING iv_carrid = pa_car .

WRITE / 'No flights for the selected flight connection'(non).TAW10_1 Unit 11 Solution 30 Solution 30: Implement Events of ABAP Reports . . IF gs_flight-percentage >= gc_limit_red. ELSE. WRITE icon_yellow_light AS ICON. LOOP AT gt_flights INTO gs_flight. CATCH cx_bc400_no_data. WRITE icon_green_light AS ICON. WRITE icon_red_light AS ICON. ENDTRY. NEW-LINE. ELSEIF gs_flight-percentage >= gc_limit_yellow. it_connid = so_con[] "brackets needed for so_con IMPORTING et_flights = gt_flights.

gs_flight-fldate COLOR COL_KEY. gs_flight-seatsmax. gs_flight-percentage. . gs_flight-connid COLOR COL_KEY.TAW10_1 Unit 11 Solution 30 Solution 30: Implement Events of ABAP Reports . WRITE: gs_flight-carrid COLOR COL_KEY. gs_flight-seatsocc. ENDIF. ENDLOOP.

TAW10_1 Summary You should now be able to: ● Implement the events of ABAP reports    .

Unit 11 A. Choose the correct answer.TAW10_1 You can use the __________ to adapt the default list interface to your own needs. WRITE statement B. Menu Painter C. Pattern function .

Unit 11 B. Menu Painter .TAW10_1 You can use the __________ to adapt the default list interface to your own needs.

Value entry . Singular capability B. A. Variants D. Type check C.TAW10_1 Multiple Choice Unit 11 Which of the following are standard functionality on a selection screen? Choose the correct answers.

Value entry . Type check C. Variants D.TAW10_1 Multiple Choice Unit 11 Which of the following are standard functionality on a selection screen? B.

DATA B.TAW10_1 Which of the following statements is used for defining an input variable? Choose the correct answer. DEFAULT . Unit 11 A. VALUE C. PARAMETERS D.

TAW10_1 Which of the following statements is used for defining an input variable? Unit 11 C. PARAMETERS .

Sequence of event blocks important . A. Ends by beginning the next processing block B. Can be nested C. Existence not absolutely necessary D.TAW10_1 Multiple Choice Unit 11 Which of the following are the characteristics of an event block? Choose the correct answers.

Ends by beginning the next processing block C.TAW10_1 Multiple Choice Unit 11 Which of the following are the characteristics of an event block? A. Existence not absolutely necessary .

Unit 12: Program Analysis Tools Lesson 1: Using the Code Inspector .

you will be able to: ● ● Explain the purpose and use of the Code Inspector Use the Code Inspector for simple analysis of programs .TAW10_1 Unit 12 Lesson 1 Lesson 1: Using the Code Inspector Lesson Objectives After completing this lesson.

TAW10_1 Figure 238: Calling the Code Inspector Unit 12 Lesson 1 .

TAW10_1 Figure 239: Inspection result Unit 12 Lesson 1 .

TAW10_1 Figure 240: Advanced Code Inspector Check Unit 12 Lesson 1 .

TAW10_1 Figure 241: Check variant Unit 12 Lesson 1 .

TAW10_1 Summary You should now be able to: ● Explain the purpose and use of the Code Inspector ● Use the Code Inspector for simple analysis of programs .

B. object sets. Standard inspection is carried out when check is performed through context menu from the Object Navigator. A. You can only use the DEFAULT check variant. and inspections using transaction SCI. D. You can create a check variant to define the details of what to check. You can define check variants. .TAW10_1 Multiple Choice Unit 12 Which of the following statements about the Code Inspector are true? Choose the correct answers. C.

and inspections using transaction SCI. object sets. You can define check variants. C. You can create a check variant to define the details of what to check. .TAW10_1 Multiple Choice Unit 12 Which of the following statements about the Code Inspector are true? B. D. Standard inspection is carried out when check is performed through context menu from the Object Navigator.

Formatting of the source code (for example. Security (for example. AUTHORITY-CHECK statement without subsequent SY-SUBRC check) C. Unit 12 A. Syntax check B. indenting of the program lines within loops) .TAW10_1 Which aspects does the Code Inspector take into consideration when examining a program? Choose the correct answers. Performance (for example. nested SELECT statements) D. cross-client data accesses) E. Typical semantic errors (for example.

Security (for example. AUTHORITY-CHECK statement without subsequent SY-SUBRC check) C. Typical semantic errors (for example.TAW10_1 Which aspects does the Code Inspector take into consideration when examining a program? Unit 12 B. Performance (for example. nested SELECT statements) D. cross-client data accesses) .

Unit 13: Program Calls and Memory Management Lesson 1: Calling Programs Synchronously Lesson 2: Understanding the ABAP Runtime and Memory Management .

you will be able to: ● Call programs synchronously .TAW10_1 Unit 13 Lesson 1 Lesson 1: Calling Programs Synchronously Lesson Objectives After completing this lesson.

TAW10_1 Figure 242: Synchronous Program Calls Unit 13 Lesson 1 .

TAW10_1 Figure 243: Calling an Executable Program Unit 13 Lesson 1 .

TAW10_1 Figure 244: Passing Data Using the Program Interface Unit 13 Lesson 1 .

TAW10_1 Figure 245: Pre-assignment of Input Fields Unit 13 Lesson 1 .

TAW10_1 Figure 246: Calling a Transaction Unit 13 Lesson 1 .

TAW10_1 Figure 247: Passing Data Using an Internal Table Unit 13 Lesson 1 .

TAW10_1 Figure 248: Data Transfer Using an Internal Table. Application Example Unit 13 Lesson 1 .

Familiarize yourself with the program and how it works. 3. Task 1 Copy program BC402_PCT_CONN_LIST and all its components to the name ZBC402_##_CONN_LIST. 1. 2. Activate and test the program. Copy the template. Business Example An existing program displays a list of data. You need to implement calls of executable programs. and pass data on to executable programs and transactions.TAW10_1 Unit 13 Exercise 31 Exercise 31: Implement Program Calls . . implement transaction calls. where ## is your group number. You want to enhance the program by enabling users to access an existing report or dialog transaction by double-clicking on a line.

How is the display of the flight connections implemented? . Analyze the source code.TAW10_1 Unit 13 Exercise 31 Exercise 31: Implement Program Calls .

TAW10_1 Unit 13 Exercise 31 Exercise 31: Implement Program Calls . 4. .

TAW10_1 Unit 13 Exercise 31 Exercise 31: Implement Program Calls . The program is already set to handle double-click events. Which processing block do you have to enhance to do so? .

1. determine the names of the input fields on the selection screen. Make sure users can return to the display of flight connections after displaying the dates. Make sure a list of flights is returned for the chosen connection if the user double-clicks in the CARRID column. Task 2 Implement the handler method that runs when a user double-clicks a flight connection. 3.TAW10_1 Unit 13 Exercise 31 Exercise 31: Implement Program Calls . use executable program BC402_INS_FLIGHT_LIST or your own program. 2. Implement the on_double_click method of the local class lcl_handler. . To do so. Use the SUBMIT statement to call the executable program. The COLUMN import parameter contains the information as to which column the user clicked. Supply the interface of the called program with the key values of the chosen flight connection. ZBC402_##_FLIGHT_LIST. To do so.

TAW10_1 Unit 13 Exercise 31 Exercise 31: Implement Program Calls . 2. To do so. and field label of the input field on the initial screen of transaction BC402MCAR. Pass the function code that is linked with the pushbutton on the initial screen on to the transaction. 4. Pass the airline ID of the chosen connection on to the transaction. call dialog transaction BC402MCAR. Make sure details for the airline are output for the chosen connection if the user doubleclicks in the CARRID column. screen number. Call the transaction to insert it synchronously. Determine the program name. Task 3 Implement the handler method that runs when a user double-clicks a flight connection. use the USING addition. use the MODE addition with a suitable value. To do so. 1. To do so. 3. . Make sure the transaction is processed without screen display.

A source code excerpt from the model solution appears as follows: REPORT bc402_pcs_conn_list MESSAGE-ID bc402. . cityto TYPE spfli-cityto.TAW10_1 Unit 13 Exercise 31 Exercise 31: Implement Program Calls . TYPES: BEGIN OF gty_s_conn. connid TYPE spfli-connid. DATA gt_conn TYPE gty_t_conn. carrid TYPE spfli-carrid. arrtime TYPE spfli-arrtime. TYPES gty_t_conn TYPE STANDARD TABLE OF gty_s_conn WITH NON-UNIQUE DEFAULT KEY. cityfrom TYPE spfli-cityfrom. period TYPE spfli-period. deptime TYPE spfli-deptime. END OF gty_s_conn.

DATA gv_msg TYPE string.TAW10_1 Unit 13 Exercise 31 Exercise 31: Implement Program Calls . cl_salv_functions_list. cl_salv_events_table. PUBLIC SECTION. *------------------------------------------------* * CLASS lcl_handler DEFINITION *------------------------------------------------* * *-----------------------------------------------* CLASS lcl_handler DEFINITION. . DATA: go_alv go_evt go_fct gx_msg TYPE TYPE TYPE TYPE REF REF REF REF TO TO TO TO cl_salv_table. cx_salv_msg.

CLASS-METHODS: on_double_click FOR EVENT double_click OF if_salv_events_actions_table IMPORTING row column. METHOD on_double_click. *----------------------------------------------------* * CLASS lcl_handler IMPLEMENTATION *---------------------------------------------------* * *---------------------------------------------------* CLASS lcl_handler IMPLEMENTATION.TAW10_1 Unit 13 Exercise 31 Exercise 31: Implement Program Calls . . "lcl_handler DEFINITION ENDCLASS. DATA: lt_bdc TYPE TABLE OF bdcdata.

CLEAR ls_bdc. CASE column. APPEND ls_bdc TO lt_bdc. ls_bdc-dynpro = '0100'. . ls_bdc-dynbegin = 'X'. ls_bdc-fval = ls_conn-carrid. DATA ls_conn LIKE LINE OF gt_conn. APPEND ls_bdc TO lt_bdc. WHEN 'CARRID'.TAW10_1 Unit 13 Exercise 31 Exercise 31: Implement Program Calls . ls_bdc-fnam = 'BC402_S_CARRIER-CARRID'. ls_bdc TYPE bdcdata. ls_bdc-program = 'SAPMBC402_IND_CARRIER'. READ TABLE gt_conn INTO ls_conn INDEX row.

.TAW10_1 Unit 13 Exercise 31 Exercise 31: Implement Program Calls . APPEND ls_bdc TO lt_bdc. SUBMIT bc402_ins_flight_list AND RETURN WITH pa_car EQ ls_conn-carrid WITH so_con EQ ls_conn-connid. WHEN OTHERS. ENDCASE. CALL TRANSACTION 'BC402MCAR' USING lt_bdc MODE 'E'. ls_bdc-fnam = 'BDC_OKCODE'. ls_bdc-fval = 'GO'. CLEAR ls_bdc.

ENDMETHOD. ENDCLASS. TRY. SELECT carrid connid cityfrom cityto deptime arrtime period FROM spfli INTO TABLE gt_conn.TAW10_1 Unit 13 Exercise 31 Exercise 31: Implement Program Calls . "on_double_click "lcl_handler IMPLEMENTATION *-------------------------------------------------* START-OF-SELECTION. CALL METHOD cl_salv_table=>factory IMPORTING r_salv_table = go_alv .

MESSAGE gv_msg TYPE 'E'. CATCH cx_salv_msg INTO gx_msg. . go_evt = go_alv->get_event( ). go_alv->display( ). SET HANDLER lcl_handler=>on_double_click FOR go_evt. CHANGING t_table = gt_conn.TAW10_1 Unit 13 Exercise 31 Exercise 31: Implement Program Calls . ENDTRY. gv_msg = gx_msg->get_text( ).

TAW10_1 Unit 13 Solution 31 Solution 31: Implement Program Calls . Business Example An existing program displays a list of data. 2. Copy the template. You want to enhance the program by enabling users to access an existing report or dialog transaction by double-clicking on a line. Familiarize yourself with the program and how it works. You need to implement calls of executable programs. where ## is your group number. Task 1 Copy program BC402_PCT_CONN_LIST and all its components to the name ZBC402_##_CONN_LIST. . implement transaction calls. a) Carry out this step in the usual manner. Activate and test the program. 1. and pass data on to executable programs and transactions. a) Carry out this step in the usual manner.

.TAW10_1 Unit 13 Solution 31 Solution 31: Implement Program Calls . 3.

The display method shows the data in an ALV grid control. .TAW10_1 Unit 13 Solution 31 Solution 31: Implement Program Calls . Analyze the source code. Class cl_salv_table is available in NetWeaver Application Server 6. The static factory method is called to generate an instance of the class and pass it to the table with  the data. The class cl_salv_table is a shared class for conventional ALV lists (flat and hierarchical) and ALV grid controls. Use an instance of class cl_salv_table. How is the display of the flight connections implemented? .40 and later.

4.TAW10_1 Unit 13 Solution 31 Solution 31: Implement Program Calls . .

Which processing block do you have to enhance to do so? . . The program is already set to handle double-click events.TAW10_1 Unit 13 Solution 31 Solution 31: Implement Program Calls . The on_double_click method of the local class lcl_handler.

Make sure users can return to the display of flight connections after displaying the dates. 2. a) AND RETURN addition. Use the SUBMIT statement to call the executable program. 1. Task 2 Implement the handler method that runs when a user double-clicks a flight connection. a) See the source code excerpt from the model solution. use executable program BC402_INS_FLIGHT_LIST or your own program.TAW10_1 Unit 13 Solution 31 Solution 31: Implement Program Calls . The COLUMN import parameter contains the information as to which column the user clicked. To do so. Implement the on_double_click method of the local class lcl_handler. Make sure a list of flights is returned for the chosen connection if the user double-clicks in the CARRID column. see source code excerpt from the model solution. ZBC402_##_FLIGHT_LIST. .

2. 1. See source code excerpt from the model solution. Pass the airline ID of the chosen connection on to the transaction. Make sure details for the airline are output for the chosen connection if the user doubleclicks in the CARRID column. Supply the interface of the called program with the key values of the chosen flight connection. . Call the transaction to insert it synchronously. 3. and field label of the input field on the initial screen of transaction BC402MCAR. To do so. Task 3 Implement the handler method that runs when a user double-clicks a flight connection.TAW10_1 Unit 13 Solution 31 Solution 31: Implement Program Calls . To do so. determine the names of the input fields on the selection screen. a) See the source code excerpt from the model solution. use the USING addition. Determine the program name. To do so. call dialog transaction BC402MCAR. screen number. a) CALL TRANSACTION.

connid TYPE spfli-connid. Make sure the transaction is processed without screen display. use the MODE addition with a suitable value. a) See the source code excerpt from the model solution. cityfrom TYPE spfli-cityfrom. .TAW10_1 Unit 13 Solution 31 Solution 31: Implement Program Calls . To do so. cityto TYPE spfli-cityto. a) See the source code excerpt from the model solution. 4. A source code excerpt from the model solution appears as follows: REPORT bc402_pcs_conn_list MESSAGE-ID bc402. Pass the function code that is linked with the pushbutton on the initial screen on to the transaction. 3. carrid TYPE spfli-carrid. TYPES: BEGIN OF gty_s_conn.

cx_salv_msg. . cl_salv_functions_list. DATA gt_conn TYPE gty_t_conn. cl_salv_events_table. DATA: go_alv go_evt go_fct gx_msg TYPE TYPE TYPE TYPE REF REF REF REF TO TO TO TO cl_salv_table. TYPES gty_t_conn TYPE STANDARD TABLE OF gty_s_conn WITH NON-UNIQUE DEFAULT KEY. arrtime TYPE spfli-arrtime. deptime TYPE spfli-deptime.TAW10_1 Unit 13 Solution 31 Solution 31: Implement Program Calls . END OF gty_s_conn. DATA gv_msg TYPE string. period TYPE spfli-period.

ENDCLASS. CLASS-METHODS: on_double_click FOR EVENT double_click OF if_salv_events_actions_table IMPORTING row column. "lcl_handler DEFINITION *----------------------------------------------------* . *------------------------------------------------* * CLASS lcl_handler DEFINITION *------------------------------------------------* * *-----------------------------------------------* CLASS lcl_handler DEFINITION. PUBLIC SECTION.TAW10_1 Unit 13 Solution 31 Solution 31: Implement Program Calls .

READ TABLE gt_conn INTO ls_conn INDEX row. * CLASS lcl_handler IMPLEMENTATION *---------------------------------------------------* * *---------------------------------------------------* CLASS lcl_handler IMPLEMENTATION. CASE column. DATA: lt_bdc TYPE TABLE OF bdcdata. ls_bdc TYPE bdcdata.TAW10_1 Unit 13 Solution 31 Solution 31: Implement Program Calls . DATA ls_conn LIKE LINE OF gt_conn. METHOD on_double_click. . WHEN 'CARRID'.

ls_bdc-fnam = 'BDC_OKCODE'. CALL TRANSACTION 'BC402MCAR' USING lt_bdc MODE 'E'. APPEND ls_bdc TO lt_bdc. . ls_bdc-fval = ls_conn-carrid. ls_bdc-dynpro = '0100'. APPEND ls_bdc TO lt_bdc. CLEAR ls_bdc. APPEND ls_bdc TO lt_bdc. CLEAR ls_bdc. ls_bdc-fval = 'GO'.TAW10_1 Unit 13 Solution 31 Solution 31: Implement Program Calls . ls_bdc-program = 'SAPMBC402_IND_CARRIER'. ls_bdc-fnam = 'BC402_S_CARRIER-CARRID'. ls_bdc-dynbegin = 'X'.

ENDMETHOD. ENDCLASS. WHEN OTHERS. . "on_double_click "lcl_handler IMPLEMENTATION *-------------------------------------------------* START-OF-SELECTION. ENDCASE.TAW10_1 Unit 13 Solution 31 Solution 31: Implement Program Calls . SUBMIT bc402_ins_flight_list AND RETURN WITH pa_car EQ ls_conn-carrid WITH so_con EQ ls_conn-connid.

ENDTRY. SELECT carrid connid cityfrom cityto deptime arrtime period FROM spfli INTO TABLE gt_conn. MESSAGE gv_msg TYPE 'E'. TRY. CATCH cx_salv_msg INTO gx_msg. . CALL METHOD cl_salv_table=>factory IMPORTING r_salv_table = go_alv CHANGING t_table = gt_conn. gv_msg = gx_msg->get_text( ). go_evt = go_alv->get_event( ).TAW10_1 Unit 13 Solution 31 Solution 31: Implement Program Calls .

TAW10_1

Unit 13 Solution 31

Solution 31: Implement Program Calls
. SET HANDLER lcl_handler=>on_double_click FOR go_evt. go_alv->display( ).

TAW10_1

Summary
You should now be able to:

● Call programs synchronously

TAW10_1

Unit 13 Lesson 2

Lesson 2: Understanding the ABAP Runtime and Memory Management Lesson Objectives
After completing this lesson, you will be able to:

● ● ● ● ●

Generate and activate programs Explain the user session memory management Transfer data between programs Explain the memory management of deep data objects Use boxed components

TAW10_1

Figure 249: Developed Version

Unit 13 Lesson 2

TAW10_1

Figure 250: Generated Version

Unit 13 Lesson 2

TAW10_1

Unit 13 Lesson 2

The system generates the LOAD automatically in the following situations:   
● When the compiler calls the first program ● When the LOAD in the database or program buffer is obsolete

TAW10_1

Figure 251: Active and Inactive Versions

Unit 13 Lesson 2

TAW10_1

Figure 252: Activating a Program

Unit 13 Lesson 2

TAW10_1

Figure 253: Loading a Runtime Object to Working Memory

Unit 13 Lesson 2

TAW10_1

Unit 13 Lesson 2

The non-modifiable parts of a program are as follows:
● Byte code for statements ● Values of constants and literals ● Program texts ● Screen definitions

TAW10_1

Figure 254: Logical Memory Model

Unit 13 Lesson 2

TAW10_1

Figure 255: Program Groups

Unit 13 Lesson 2

TAW10_1

Figure 256: Before Inserting a Program

Unit 13 Lesson 2

TAW10_1

Figure 257: The Inserted Program Runs

Unit 13 Lesson 2

TAW10_1

Figure 258: After the Inserted Program Ends

Unit 13 Lesson 2

TAW10_1

Figure 259: Before Starting a New Executable Program

Unit 13 Lesson 2

TAW10_1

Figure 260: The New Executable Program Runs

Unit 13 Lesson 2

TAW10_1

Figure 261: Before Starting a New Transaction

Unit 13 Lesson 2

TAW10_1

Figure 262: The New Transaction Runs

Unit 13 Lesson 2

TAW10_1

Figure 263: Main or Additional Program Groups

Unit 13 Lesson 2

TAW10_1

Figure 264: Same Function Group in Different Internal Sessions

Unit 13 Lesson 2

TAW10_1 Figure 265: Same Class in Different Internal Sessions Unit 13 Lesson 2 .

TAW10_1 Figure 266: Same Function Group or Class Within an Internal Session Unit 13 Lesson 2 .

TAW10_1 Figure 267: Several Programs in the Same Program Group Unit 13 Lesson 2 .

TAW10_1 Figure 268: Data Transfer Between Programs – Overview Unit 13 Lesson 2 .

TAW10_1 Figure 269: Range of ABAP Memory and SAP Memory Unit 13 Lesson 2 .

TAW10_1 Figure 270: Passing Data Using the ABAP Memory Unit 13 Lesson 2 .

TAW10_1 Figure 271: Passing Parameters Using SAP Memory Unit 13 Lesson 2 .

Template BC402_INS_FLIGHT_LIST (called program) BC402_PCS_CONN_LIST (calling program) Solution BC402_MMS_FLIGHT_LIST (called program) BC402_MMS_CONN_LIST (calling program) Use the ABAP memory to exchange data between programs and the SAP memory to preassign fields in a transaction call. Instead of displaying the data directly with the called report. you want to load the data you select into the SAP memory. Task 1 .TAW10_1 Unit 13 Exercise 32 Exercise 32: Use ABAP Memory and SAP Memory . Business Example An existing program selects data based on user entries and outputs it in a list. You also want to use parameters in the ABAP memory to pre assign fields when calling a transaction. You call this program from within another program. and process it further in the calling program.

In this case. Define an additional parameter for the selection screen (suggested name: PA_LIST). 2. for example. Check the documentation to find a suitable addition for the PARAMETERS statement that suppresses the parameter when displaying the selection screen. BC402_INS_FLIGHT_LIST (or your own program. Type the parameter with type ABAP_BOOL from the ABAP type group. Copy the called program. Copy the program and all its subcomponents. Create an invisible parameter on the selection screen that enables storage in the ABAP memory when the program is called with SUBMIT. ZBC402_##_FLIGHT_LIST).TAW10_1 Unit 13 Exercise 32 Exercise 32: Use ABAP Memory and SAP Memory . to the name ZBC402_##_FLIGHT_LIST_MEM. 3. 4. 1. Enhance the program so that it can selectively output the flights in a list or save the internal table with its data in the ABAP memory. Supplement the program so that it suppresses the list output when the parameter is not set to its default value. you want to export the read data into the .

. Supply the new parameter with a value to suppress the list display and write the data to the ABAP memory. Task 2 Copy the calling programBC402_PCS_CONN_LIST (or your own program. Call the program so that it saves the data in the ABAP memory instead of directly direct output. Copy the calling program. ABAP memory. 1. Choose a suitable ID for your data cluster (suggested name: BC402_##_FLIGHTS).TAW10_1 Unit 13 Exercise 32 Exercise 32: Use ABAP Memory and SAP Memory . 2. ZBC402_##_CONN_LIST) to the name ZBC402_##_CONN_LIST_MEM and modify the name of the called program in the SUBMIT statement. Modify the SUBMIT statement to call program ZBC402_##_FLIGHT_LIST_MEM.

2. 3. 4.TAW10_1 Unit 13 Exercise 32 Exercise 32: Use ABAP Memory and SAP Memory . Optional: Deal with the (class-based) exception of the function module. Implement a call of function module BC402_DISPLAY_TABLE. respond with error message 361 from message class BC402. import the data from the ABAP memory by creating a suitable internal table. . read the data from the ABAP memory and use function module BC402_DISPLAY_TABLE to display the data in an ALV grid. When an error occurs. Pass on the data from the ABAP memory on to this function module for display. Delete the data in the ABAP memory after it is read. After the program call. 1. Release the memory for your cluster to delete the data from the ABAP memory. Task 3 After the program call.

3. Is it possible to preassign the input field on the first screen using a parameter in the SAP memory? If so. Check whether automatic pre-assignment from the SAP memory is active for the field. 1. Use a suitable statement to set the value of the parameter to the desired value in the SAP memory before the transaction call. . use this option. If so.TAW10_1 Unit 13 Exercise 32 Exercise 32: Use ABAP Memory and SAP Memory . Remove the USING and MODE additions from the CALL TRANSACTION statement and suppress the display of the first screen. Task 4 Analyze transaction BC402MCAR. what is the parameter ID name? 2. Find out whether the input field from screen 0100 in program SAPMBC402_IND_CARRIER is linked with a parameter ID.

. use a suitable addition to suppress the first screen. SELECT-OPTIONS so_con FOR gs_flight-connid. TYPE-POOLS: abap. gs_flight TYPE sflight. DATA: gt_flight TYPE TABLE OF sflight. PARAMETERS pa_list TYPE abap_bool DEFAULT abap_true NO-DISPLAY. 4. Instead.TAW10_1 Unit 13 Exercise 32 Exercise 32: Use ABAP Memory and SAP Memory . A source code excerpt from the model solution is as follows: BC402_MMS_FLIGHT_LIST (called program) REPORT bc402_mms_flight_list MESSAGE-ID bc402. PARAMETERS pa_car TYPE sflight-carrid. Remove the USING and MODE additions from the CALL TRANSACTION statement.

TAW10_1 Unit 13 Exercise 32 Exercise 32: Use ABAP Memory and SAP Memory . SELECT * FROM sflight INTO TABLE gt_flight WHERE carrid = pa_car AND connid IN so_con. gs_flight-connid. LOOP AT gt_flight INTO gs_flight. . ENDIF. IF pa_list = abap_true. WRITE: / gs_flight-carrid. START-OF-SELECTION. MESSAGE e038. IF sy-subrc <> 0.

ENDIF. ELSE. gs_flight-price CURRENCY gs_flight-currency. . gs_flight-seatsmax. gs_flight-planetype.TAW10_1 Unit 13 Exercise 32 Exercise 32: Use ABAP Memory and SAP Memory . gs_flight-currency. ENDLOOP. EXPORT flights FROM gt_flight TO MEMORY ID 'BC402_FLIGHTS'. gs_flight-fldate. gs_flight-seatsocc.

DATA ls_conn LIKE LINE OF gt_conn. CASE column. DATA lt_sflight TYPE TABLE OF sflight. WHEN 'CARRID'. BC402_MMS_CONN_LIST (calling program). Method: on_double_click METHOD on_double_click. READ TABLE gt_conn INTO ls_conn INDEX row. SET PARAMETER ID 'CAR' FIELD ls_conn-carrid.TAW10_1 Unit 13 Exercise 32 Exercise 32: Use ABAP Memory and SAP Memory . . CALL TRANSACTION 'BC402MCAR' AND SKIP FIRST SCREEN.

MESSAGE e361. SUBMIT bc402_mms_flight_list AND RETURN WITH pa_car EQ ls_conn-carrid WITH so_con EQ ls_conn-connid WITH pa_list EQ space. CALL FUNCTION 'BC402_DISPLAY_TABLE' CHANGING . WHEN OTHERS. IF sy-subrc <> 0. IMPORT flights TO lt_sflight FROM MEMORY ID 'BC402_FLIGHTS'.TAW10_1 Unit 13 Exercise 32 Exercise 32: Use ABAP Memory and SAP Memory . ELSE.

ENDMETHOD. FREE MEMORY ID 'BC402_FLIGHTS'. ct_table = lt_sflight. "on_double_click .TAW10_1 Unit 13 Exercise 32 Exercise 32: Use ABAP Memory and SAP Memory . ENDIF. ENDCASE.

Instead of displaying the data directly with the called report. and process it further in the calling program. you want to load the data you select into the SAP memory. Business Example An existing program selects data based on user entries and outputs it in a list. You call this program from within another program. Task 1 . Template BC402_INS_FLIGHT_LIST (called program) BC402_PCS_CONN_LIST (calling program) Solution BC402_MMS_FLIGHT_LIST (called program) BC402_MMS_CONN_LIST (calling program) Use the ABAP memory to exchange data between programs and the SAP memory to preassign fields in a transaction call.TAW10_1 Unit 13 Solution 32 Solution 32: Use ABAP Memory and SAP Memory . You also want to use parameters in the ABAP memory to pre assign fields when calling a transaction.

ZBC402_##_FLIGHT_LIST). to the name ZBC402_##_FLIGHT_LIST_MEM. for example. 1. a) Carry out this step in the custom manner. 3. Type the parameter with type ABAP_BOOL from the ABAP type group. Enhance the program so that it can selectively output the flights in a list or save the internal table with its data in the ABAP memory. BC402_INS_FLIGHT_LIST (or your own program. 2. Define an additional parameter for the selection screen (suggested name: PA_LIST). Copy the called program. Copy the program and all its subcomponents.TAW10_1 Unit 13 Solution 32 Solution 32: Use ABAP Memory and SAP Memory . . Create an invisible parameter on the selection screen that enables storage in the ABAP memory when the program is called with SUBMIT. Check the documentation to find a suitable addition for the PARAMETERS statement that suppresses the parameter when displaying the selection screen. a) See the source code excerpt from the model solution.

1. you want to export the read data into the ABAP memory. See source code excerpt from the model solution. Task 2 Copy the calling programBC402_PCS_CONN_LIST (or your own program.TAW10_1 Unit 13 Solution 32 Solution 32: Use ABAP Memory and SAP Memory . In this case. Supplement the program so that it suppresses the list output when the parameter is not set to its default value. Call the program so that it saves the data in the ABAP memory instead of directly direct output. a) NO-DISPLAY addition. Copy the calling program. Choose a suitable ID for your data cluster (suggested name: BC402_##_FLIGHTS). a) See the source code excerpt from the model solution. ZBC402_##_CONN_LIST) to the name ZBC402_##_CONN_LIST_MEM and modify the name of the called program in the SUBMIT statement. . 4.

2. Supply the new parameter with a value to suppress the list display and write the data to the ABAP memory. respond with error message 361 from message class BC402. Delete the data in the ABAP memory after it is read. import the data from the ABAP memory by creating a suitable internal table.TAW10_1 Unit 13 Solution 32 Solution 32: Use ABAP Memory and SAP Memory . 1. Task 3 After the program call. After the program call. Modify the SUBMIT statement to call program ZBC402_##_FLIGHT_LIST_MEM. When an error occurs. a) See the source code excerpt from the model solution. . read the data from the ABAP memory and use function module BC402_DISPLAY_TABLE to display the data in an ALV grid. a) Carry out this step in the usual manner.

Task 4 Analyze transaction BC402MCAR. 4. . a) See the source code excerpt from the model solution. 2. Remove the USING and MODE additions from the CALL TRANSACTION statement and suppress the display of the first screen. Release the memory for your cluster to delete the data from the ABAP memory. Optional: Deal with the (class-based) exception of the function module. 3. Implement a call of function module BC402_DISPLAY_TABLE.TAW10_1 Unit 13 Solution 32 Solution 32: Use ABAP Memory and SAP Memory . use this option. Is it possible to preassign the input field on the first screen using a parameter in the SAP memory? If so. a) See the source code excerpt from the model solution. Pass on the data from the ABAP memory on to this function module for display.

1. c) The Parameter ID has the value CAR. 2.TAW10_1 Unit 13 Solution 32 Solution 32: Use ABAP Memory and SAP Memory . c) The Get Parameters checkbox is set. Check whether automatic pre-assignment from the SAP memory is active for the field. b) Analyze the attributes for the input screen (either in the list of elements or using the attributes window in the graphical layout editor). what is the parameter ID name? a) Start the transaction. If so. Find out whether the input field from screen 0100 in program SAPMBC402_IND_CARRIER is linked with a parameter ID. b) Call up the help (F1 key) for the input field and then the technical information. a) Navigate to screen 0100. .

.TAW10_1 Unit 13 Solution 32 Solution 32: Use ABAP Memory and SAP Memory . a) See the source code excerpt from the model solution. TYPE-POOLS: abap. use a suitable addition to suppress the first screen. Use a suitable statement to set the value of the parameter to the desired value in the SAP memory before the transaction call. See source code excerpt from the model solution. 3. 4. DATA: gt_flight TYPE TABLE OF sflight. a) AND SKIP FIRST SCREEN addition. A source code excerpt from the model solution is as follows: BC402_MMS_FLIGHT_LIST (called program) REPORT bc402_mms_flight_list MESSAGE-ID bc402. Instead. Remove the USING and MODE additions from the CALL TRANSACTION statement.

START-OF-SELECTION. ENDIF. IF sy-subrc <> 0. . gs_flight TYPE sflight. SELECT * FROM sflight INTO TABLE gt_flight WHERE carrid = pa_car AND connid IN so_con. PARAMETERS pa_car TYPE sflight-carrid. PARAMETERS pa_list TYPE abap_bool DEFAULT abap_true NO-DISPLAY.TAW10_1 Unit 13 Solution 32 Solution 32: Use ABAP Memory and SAP Memory . MESSAGE e038. SELECT-OPTIONS so_con FOR gs_flight-connid.

TAW10_1 Unit 13 Solution 32 Solution 32: Use ABAP Memory and SAP Memory . gs_flight-planetype. ENDLOOP. WRITE: / gs_flight-carrid. gs_flight-currency. gs_flight-fldate. gs_flight-connid. ELSE. . LOOP AT gt_flight INTO gs_flight. gs_flight-seatsocc. IF pa_list = abap_true. gs_flight-price CURRENCY gs_flight-currency. gs_flight-seatsmax.

TAW10_1 Unit 13 Solution 32 Solution 32: Use ABAP Memory and SAP Memory . READ TABLE gt_conn INTO ls_conn INDEX row. WHEN 'CARRID'. DATA ls_conn LIKE LINE OF gt_conn. . CASE column. EXPORT flights FROM gt_flight TO MEMORY ID 'BC402_FLIGHTS'. ENDIF. Method: on_double_click METHOD on_double_click. DATA lt_sflight TYPE TABLE OF sflight. BC402_MMS_CONN_LIST (calling program).

CALL TRANSACTION 'BC402MCAR' AND SKIP FIRST SCREEN. SET PARAMETER ID 'CAR' FIELD ls_conn-carrid. WHEN OTHERS.TAW10_1 Unit 13 Solution 32 Solution 32: Use ABAP Memory and SAP Memory . . SUBMIT bc402_mms_flight_list AND RETURN WITH pa_car EQ ls_conn-carrid WITH so_con EQ ls_conn-connid WITH pa_list EQ space. IMPORT flights TO lt_sflight FROM MEMORY ID 'BC402_FLIGHTS'.

CALL FUNCTION 'BC402_DISPLAY_TABLE' CHANGING ct_table = lt_sflight. IF sy-subrc <> 0. ENDCASE. ENDMETHOD.TAW10_1 Unit 13 Solution 32 Solution 32: Use ABAP Memory and SAP Memory . ENDIF. ELSE. "on_double_click . FREE MEMORY ID 'BC402_FLIGHTS'. MESSAGE e361.

TAW10_1 Figure 272: Memory Management for Flat Data Objects Unit 13 Lesson 2 .

TAW10_1 Figure 273: Memory Management for Strings Unit 13 Lesson 2 .

TAW10_1 Figure 274: Memory Management for Internal Tables Unit 13 Lesson 2 .

TAW10_1 Figure 275: Sharing Between Strings Unit 13 Lesson 2 .

TAW10_1 Figure 276: Sharing Between Internal Tables Unit 13 Lesson 2 .

TAW10_1 Figure 277: Structure with Boxed Component Unit 13 Lesson 2 .

TAW10_1 Figure 278: Instance Attribute Defined as Boxed Component Unit 13 Lesson 2 .

TAW10_1 Figure 279: Example – Internal Tables and Boxed Components Unit 13 Lesson 2 .

TAW10_1 Summary You should now be able to: ● Generate and activate programs ● Explain the user session memory management ● Transfer data between programs ● Explain the memory management of deep data objects ● Use boxed components .

AND RETURN C. LEAVE TO TRANSACTION 'T_CODE' D. the system terminates the current program and starts the transaction with transaction code T_CODE. CALL TRANSACTION 'T_CODE' . Choose the correct answer. SUBMIT B. A.TAW10_1 Unit 13 If you use the ___________________ statement.

the system terminates the current program and starts the transaction with transaction code T_CODE. C. LEAVE TO TRANSACTION 'T_CODE' .TAW10_1 Unit 13 If you use the ___________________ statement.

" . Unit 13 "A saved or buffered LOAD is considered obsolete if the developed version of the program was changed.TAW10_1 Determine whether this statement is true or false.

Unit 13 "A saved or buffered LOAD is considered obsolete if the developed version of the program was changed." True .TAW10_1 Determine whether this statement is true or false.

Values of constants and literals C. Unit 13 A. Byte code for statements B. Data objects (variables) . Program texts D. Screen definitions E.TAW10_1 What are the modifiable parts of a program? Choose the correct answer.

Data objects (variables) .TAW10_1 What are the modifiable parts of a program? Unit 13 E.

TAW10_1 Determine whether this statement is true or false. Unit 13 "For a program to run in the ABAP runtime environment. " . you first need to generate it by the ABAP Editor.

TAW10_1 Determine whether this statement is true or false. " False . Unit 13 "For a program to run in the ABAP runtime environment. you first need to generate it by the ABAP Editor.

REFRESH C. Unit 13 A. CLEAR B. FREE .TAW10_1 What statement can also delete the table header if it takes up too much memory? Choose the correct answer.

FREE .TAW10_1 What statement can also delete the table header if it takes up too much memory? Unit 13 C.

TAW10_1 Determine whether this statement is true or false. you have to use the DATA statement." . Unit 13 "To define boxed components outside of class definitions.

" False . Unit 13 "To define boxed components outside of class definitions. you have to use the DATA statement.TAW10_1 Determine whether this statement is true or false.

Unit 14: ABAP Open SQL in Detail Lesson 1: Implementing Complex WHERE Conditions and Special INTO Clauses Lesson 2: Processing and Aggregating Datasets in the Database Lesson 3: Reading from Multiple Database Tables .

TAW10_1 Unit 14 Lesson 1 Lesson 1: Implementing Complex WHERE Conditions and Special INTO Clauses Lesson Objectives After completing this lesson. you will be able to: ● ● ● Delimit datasets selected in the database using WHERE-clause Use different types of data objects as the target for SELECT statements Read large volumes of data from the database .

LE.TAW10_1 Unit 14 Lesson 1 Operator =. <> EQ. the result of size comparisons may depend on the database code page. dobj2. the result may depend on the database code page.. Comparison with character strings The _ and % placeholders let you define a comparison pattern in DOBJ. NE Meaning and Use Comparison with a single value In character-type fields. GE. <.) BETWEEN dobj1 AND dobj2 LIKE dobj IN seltab IS [NOT] NULL Evaluation of a selection table (selectoptions) Checks whether the database field has a null value . <=. Comparison with a list of single values Comparison with an interval In character-type fields. <=. IN (dobj1. . >.. GT. LT.

TAW10_1 Unit 14 Lesson 1 Operator AND. OR NOT Meaning and Use Link of logical expressions Negation of a logical expression .

TAW10_1 Figure 280: Operators in WHERE Conditions Unit 14 Lesson 1 .

TAW10_1 Figure 281: Comparing Table Fields Unit 14 Lesson 1 .

Result-Set single-line multiline multiline Target Area single-line multiline single-line .TAW10_1 Unit 14 Lesson 1 Statement SELECT SINGLE… SELECT… INTO TABLE… SELECT… ENDSELECT.

TAW10_1 Figure 282: List of Data Objects Instead of Single Structure Unit 14 Lesson 1 .

TAW10_1 Figure 283: APPENDING Instead of INTO Unit 14 Lesson 1 .

TAW10_1 Figure 284: PACKAGE SIZE Addition Unit 14 Lesson 1 .

.. FETCH ...TAW10_1 Figure 285: OPEN CURSOR . CLOSE CURSOR Unit 14 Lesson 1 .

TAW10_1 Summary You should now be able to: ● Delimit datasets selected in the database using WHERE-clause ● Use different types of data objects as the target for SELECT statements ● Read large volumes of data from the database .

TAW10_1 Unit 14 Lesson 2 Lesson 2: Processing and Aggregating Datasets in the Database Lesson Objectives After completing this lesson. you will be able to: ● ● Retain ordered or condensed datasets from the database Perform calculations on the database .

TAW10_1 Figure 286: ORDER BY Addition Variants Unit 14 Lesson 2 .

TAW10_1 Figure 287: ORDER BY Addition Unit 14 Lesson 2 .

TAW10_1 Figure 288: SELECT DISTINCT Statement Unit 14 Lesson 2 .

Copy the program and all its subcomponents. Business Example You want to enhance a program that outputs a customer’s flight bookings. Task 1 Copy the template BC402_DBT_SQL_CONDENSE to ZBC402_##_CONDENSE. Familiarize yourself with the program and how it works.TAW10_1 Unit 14 Exercise 33 Exercise 33: Retain Ordered and Condensed Datasets from the Database . Template BC402_DBT_SQL_CONDENSE Solution BC402_DBS_SQL_CONDENSE Use the DISTINCT clause for SELECT statements and request sorted data from the database. 1. where ## is your group number. .

TAW10_1 Unit 14 Exercise 33 Exercise 33: Retain Ordered and Condensed Datasets from the Database . 2. .

Which  input options are available on the selection screen? .TAW10_1 Unit 14 Exercise 33 Exercise 33: Retain Ordered and Condensed Datasets from the Database .

3.TAW10_1 Unit 14 Exercise 33 Exercise 33: Retain Ordered and Condensed Datasets from the Database . .

Which data is output in the list? Which missing data do you still need? .TAW10_1 Unit 14 Exercise 33 Exercise 33: Retain Ordered and Condensed Datasets from the Database .

Which component contains the line type of CT_TRAVELAGS? . 1. particularly the typing of the interface parameters. Implement a single database access that returns the data completely in the desired form. Make sure that each travel agency appears only once and that travel agencies are sorted alphabetically by name. Analyze the interface of the subroutine. Task 2 Implement subroutine GET_TRAVELAGS to determine the travel agencies that made the bookings. Read from database view BC402_SCUS_BOOK.TAW10_1 Unit 14 Exercise 33 Exercise 33: Retain Ordered and Condensed Datasets from the Database .

Supplement the SELECT statement with a clause that removes repeated entries from the result set. 2. 4.TAW10_1 Unit 14 Exercise 33 Exercise 33: Retain Ordered and Condensed Datasets from the Database . Access database view BC402_SCUS_BOOK and limit the access with the customer number. 3. . Implement a SELECT statement to fill CT_TRAVELAGS with the data for the travel agencies. Supplement the SELECT statement with a clause that returns the result set sorted by travel agency name.

Copy the program and all its subcomponents. . 1. Business Example You want to enhance a program that outputs a customer’s flight bookings. Task 1 Copy the template BC402_DBT_SQL_CONDENSE to ZBC402_##_CONDENSE. Familiarize yourself with the program and how it works. Template BC402_DBT_SQL_CONDENSE Solution BC402_DBS_SQL_CONDENSE Use the DISTINCT clause for SELECT statements and request sorted data from the database. where ## is your group number.TAW10_1 Unit 14 Solution 33 Solution 33: Retain Ordered and Condensed Datasets from the Database .

a) Perform this step in the standard manner. .TAW10_1 Unit 14 Solution 33 Solution 33: Retain Ordered and Condensed Datasets from the Database . 2.

Which  input options are available on the selection screen? . An airline customer number. .TAW10_1 Unit 14 Solution 33 Solution 33: Retain Ordered and Condensed Datasets from the Database .

TAW10_1 Unit 14 Solution 33 Solution 33: Retain Ordered and Condensed Datasets from the Database . 3. .

TAW10_1

Unit 14 Solution 33

Solution 33: Retain Ordered and Condensed Datasets from the Database
.
Which data is output in the list? Which missing data do you still need?

. Data output is the customer’s name, form of address, and a list of all the customer’s bookings (without cancellations). Still missing are a list of total bookings (separated by currency) and a list of travel agencies who made the bookings.

TAW10_1

Unit 14 Solution 33

Solution 33: Retain Ordered and Condensed Datasets from the Database
. Task 2 Implement subroutine GET_TRAVELAGS to determine the travel agencies that made the bookings. Make sure that each travel agency appears only once and that travel agencies are sorted alphabetically by name. Implement a single database access that returns the data completely in the desired form. Read from database view BC402_SCUS_BOOK. 1. Analyze the interface of the subroutine, particularly the typing of the interface parameters. Which component contains the line type of CT_TRAVELAGS? AGENCYNUM: Travel agency number, NAME: Travel agency name, CITY: City. 2. Implement a SELECT statement to fill CT_TRAVELAGS with the data for the travel agencies. Access database view BC402_SCUS_BOOK and limit the access with the customer number.

TAW10_1

Unit 14 Solution 33

Solution 33: Retain Ordered and Condensed Datasets from the Database
. a) See the source code excerpt from the model solution. 3. Supplement the SELECT statement with a clause that removes repeated entries from the result set. a) DISTINCT clause. See the source code excerpt from the model solution. 4. Supplement the SELECT statement with a clause that returns the result set sorted by travel agency name. a) ORDER BY clause. See the source code excerpt from the model solution. Source code excerpt from the model solution: REPORT bc402_dbs_sql_condense.

TYPES: BEGIN OF gty_s_sums,

TAW10_1

Unit 14 Solution 33

Solution 33: Retain Ordered and Condensed Datasets from the Database
. forcuram TYPE sbook-forcuram, forcurkey TYPE sbook-forcurkey, END OF gty_s_sums.

TYPES: BEGIN OF gty_s_travelags, agencynum TYPE bc402_scus_book-agencynum, name TYPE bc402_scus_book-name, city TYPE bc402_scus_book-city, END OF gty_s_travelags. TYPES: gty_t_sums gty_t_bookings

TYPE SORTED TABLE OF gty_s_sums WITH UNIQUE KEY forcurkey, TYPE STANDARD TABLE OF scus_book

TAW10_1

Unit 14 Solution 33

Solution 33: Retain Ordered and Condensed Datasets from the Database
. WITH NON-UNIQUE KEY carrid connid fldate bookid, gty_t_travelags TYPE STANDARD TABLE OF gty_s_travelags WITH NON-UNIQUE KEY agencynum. DATA: gs_customer gt_bookings gt_sums gt_travelags TYPE TYPE TYPE TYPE scustom, gty_t_bookings, gty_t_sums, gty_t_travelags.

PARAMETERS: pa_cust TYPE sbook-customid DEFAULT '00000001'.

TAW10_1

Unit 14 Solution 33

Solution 33: Retain Ordered and Condensed Datasets from the Database
. START-OF-SELECTION. SELECT SINGLE * FROM scustom INTO gs_customer WHERE id = pa_cust. SELECT * FROM scus_book INTO TABLE gt_bookings WHERE customid = pa_cust AND cancelled <> 'X'. PERFORM get_sums USING pa_cust CHANGING gt_sums. PERFORM get_travelags USING pa_cust CHANGING gt_travelags.

TAW10_1

Unit 14 Solution 33

Solution 33: Retain Ordered and Condensed Datasets from the Database
. PERFORM output_list USING gs_customer gt_bookings gt_sums gt_travelags.

*&---------------------------------------------* *& Form GET_SUMS *&---------------------------------------------* FORM get_sums USING pv_customid TYPE sbook-customid CHANGING ct_sums TYPE gty_t_sums. SELECT SUM( forcuram ) forcurkey FROM sbook INTO TABLE ct_sums WHERE customid = pv_customid GROUP BY forcurkey.

TAW10_1

Unit 14 Solution 33

Solution 33: Retain Ordered and Condensed Datasets from the Database
. ENDFORM. " GET_SUMS

*&---------------------------------------------* *& Form GET_TRAVELAGS *&---------------------------------------------* FORM get_travelags USING pv_customid TYPE sbook-customid CHANGING ct_travelags TYPE gty_t_travelags. SELECT DISTINCT agencynum name city FROM bc402_scus_book INTO TABLE ct_travelags WHERE customid = pv_customid ORDER BY name. ENDFORM. " GET_TRAVELAGS *&--------------------------------------------* *& Form OUTPUT_LIST

TAW10_1

Unit 14 Solution 33

Solution 33: Retain Ordered and Condensed Datasets from the Database
. *&--------------------------------------------* FORM output_list USING ps_customer TYPE scustom pt_bookings TYPE gty_t_bookings pt_sums TYPE gty_t_sums pt_travelags TYPE gty_t_travelags. DATA: ls_bookings LIKE LINE OF pt_bookings, ls_sums LIKE LINE OF pt_sums, ls_travelags LIKE LINE OF pt_travelags. DATA lv_text TYPE string. CONCATENATE text-wcm ps_customer-form ps_customer-name

TAW10_1

Unit 14 Solution 33

Solution 33: Retain Ordered and Condensed Datasets from the Database
. INTO lv_text SEPARATED BY space. CONDENSE lv_text. WRITE: / lv_text. SKIP. WRITE / text-lob. ULINE. SKIP. LOOP AT pt_bookings INTO ls_bookings. WRITE: / ls_bookings-bookid, ls_bookings-carrid RIGHT-JUSTIFIED, ls_bookings-connid,

TAW10_1

Unit 14 Solution 33

Solution 33: Retain Ordered and Condensed Datasets from the Database
. ls_bookings-fldate, ls_bookings-cityfrom RIGHT-JUSTIFIED, '->', ls_bookings-cityto. ENDLOOP. SKIP 2. WRITE: / text-sum. ULINE. SKIP. LOOP AT pt_sums INTO ls_sums. WRITE: / ls_sums-forcuram CURRENCY ls_sums-forcurkey, ls_sums-forcurkey. ENDLOOP.

TAW10_1

Unit 14 Solution 33

Solution 33: Retain Ordered and Condensed Datasets from the Database
. SKIP 2. WRITE / text-tag. ULINE. SKIP. LOOP AT pt_travelags INTO ls_travelags. WRITE: / ls_travelags-name, ls_travelags-city. ENDLOOP. ENDFORM. " OUTPUT_LIST

TAW10_1

Unit 14 Solution 33

Function MIN( col ) MAX( col ) SUM( col )

Meaning of Result and Conditions Minimum value in the col column within the result set Maximum value in the col column within the result set

Data Type of Result Like the col column Like the col column

Sum of the contents of the Like the col column col column in the result setcol column must be numeric Average (arithmetic mean) Float (F) value of the contents of the col column in the result setcol column must be numeric Number of lines in the result Integer (I) set

AVG( col )

COUNT( * )

TAW10_1

Figure 289: SELECT Statement with Aggregate Expressions

Unit 14 Lesson 2

TAW10_1

Figure 290: Aggregate Functions with the DISTINCT Addition

Unit 14 Lesson 2

TAW10_1

Figure 291: Special Situations

Unit 14 Lesson 2

TAW10_1

Figure 292: GROUP BY Addition

Unit 14 Lesson 2

TAW10_1

Figure 293: HAVING Addition

Unit 14 Lesson 2

TAW10_1

Unit 14 Exercise 34

Exercise 34: Perform Calculations on the Database
. Business Example You want to output the total bookings by currency and an alphabetical list of the involved travel agencies based on the list of bookings. Template BC402_DBT_SQL_CONDENSE Solution BC402_DBS_SQL_CONDENSE Use aggregate functions correctly. Implement subroutine GET_SUMS to calculate the booking totals separated by currency. Program a single database access that returns the data completely in the desired form. Read directly from database table SBOOK. 1.

TAW10_1

Unit 14 Exercise 34

Exercise 34: Perform Calculations on the Database
.
Analyze the interface of the subroutine, particularly the typing of the interface parameters. Which component does the line type of CT_SUMS contain?

TAW10_1

Unit 14 Exercise 34

Exercise 34: Perform Calculations on the Database
. 2. Implement a SELECT statement to fill CT_SUMS with the booking totals. Access database table SBOOK and limit the access with the customer number. Use aggregate functions to have the database calculate the totals. 3. Which addition do you use to calculate the totals separated by currency?

Implement subroutine GET_SUMS to calculate the booking totals separated by currency. 1. .TAW10_1 Unit 14 Solution 34 Solution 34: Perform Calculations on the Database . Template BC402_DBT_SQL_CONDENSE Solution BC402_DBS_SQL_CONDENSE Use aggregate functions correctly. Business Example You want to output the total bookings by currency and an alphabetical list of the involved travel agencies based on the list of bookings. Read directly from database table SBOOK. Program a single database access that returns the data completely in the desired form.

particularly the typing of the interface parameters.Price of booking in foreign currency (dependent on booking location).TAW10_1 Unit 14 Solution 34 Solution 34: Perform Calculations on the Database . Analyze the interface of the subroutine. FORCURAM . . Which component does the line type of CT_SUMS contain? . FORCURKEY .Payment currency.

3. Which addition do you use to calculate the totals separated by currency? a) GROUP BY forcurkey REPORT bc402_dbs_sql_condense. TYPES: BEGIN OF gty_s_sums.TAW10_1 Unit 14 Solution 34 Solution 34: Perform Calculations on the Database . TYPES: BEGIN OF gty_s_travelags. a) See the source code excerpt from the model solution. 2. . Access database table SBOOK and limit the access with the customer number. Implement a SELECT statement to fill CT_SUMS with the booking totals. END OF gty_s_sums. forcurkey TYPE sbook-forcurkey. Use aggregate functions to have the database calculate the totals. forcuram TYPE sbook-forcuram.

END OF gty_s_travelags. agencynum TYPE bc402_scus_book-agencynum. . gty_t_travelags TYPE STANDARD TABLE OF gty_s_travelags WITH NON-UNIQUE KEY agencynum. TYPE STANDARD TABLE OF scus_book WITH NON-UNIQUE KEY carrid connid fldate bookid.TAW10_1 Unit 14 Solution 34 Solution 34: Perform Calculations on the Database . name TYPE bc402_scus_book-name. city TYPE bc402_scus_book-city. TYPES: gty_t_sums gty_t_bookings TYPE SORTED TABLE OF gty_s_sums WITH UNIQUE KEY forcurkey.

DATA: gs_customer gt_bookings gt_sums gt_travelags TYPE TYPE TYPE TYPE scustom. SELECT SINGLE * FROM scustom INTO gs_customer WHERE id = pa_cust. SELECT * FROM scus_book INTO TABLE gt_bookings . gty_t_sums.TAW10_1 Unit 14 Solution 34 Solution 34: Perform Calculations on the Database . gty_t_travelags. gty_t_bookings. PARAMETERS: pa_cust TYPE sbook-customid DEFAULT '00000001'. START-OF-SELECTION.

PERFORM get_sums USING pa_cust CHANGING gt_sums. *&-----------------------------------------------* *& Form GET_SUMS . PERFORM output_list USING gs_customer gt_bookings gt_sums gt_travelags. WHERE customid = pa_cust AND cancelled <> 'X'.TAW10_1 Unit 14 Solution 34 Solution 34: Perform Calculations on the Database . PERFORM get_travelags USING pa_cust CHANGING gt_travelags.

" GET_SUMS *&-----------------------------------------------* *& Form GET_TRAVELAGS *&-----------------------------------------------* FORM get_travelags USING pv_customid TYPE sbook-customid CHANGING ct_travelags TYPE gty_t_travelags.TAW10_1 Unit 14 Solution 34 Solution 34: Perform Calculations on the Database . SELECT DISTINCT agencynum name city FROM bc402_scus_book . ENDFORM. *&-----------------------------------------------* FORM get_sums USING pv_customid TYPE sbook-customid CHANGING ct_sums TYPE gty_t_sums. SELECT SUM( forcuram ) forcurkey FROM sbook INTO TABLE ct_sums WHERE customid = pv_customid GROUP BY forcurkey.

. " GET_TRAVELAGS *&---------------------------------------------* *& Form OUTPUT_LIST *&---------------------------------------------* FORM output_list USING ps_customer TYPE scustom pt_bookings TYPE gty_t_bookings pt_sums TYPE gty_t_sums pt_travelags TYPE gty_t_travelags. ENDFORM. ls_travelags LIKE LINE OF pt_travelags. ls_sums LIKE LINE OF pt_sums. . DATA: ls_bookings LIKE LINE OF pt_bookings.TAW10_1 Unit 14 Solution 34 Solution 34: Perform Calculations on the Database INTO TABLE ct_travelags WHERE customid = pv_customid ORDER BY name.

. SKIP. DATA lv_text TYPE string. SKIP. WRITE / text-lob. ULINE. CONDENSE lv_text. WRITE: / lv_text.TAW10_1 Unit 14 Solution 34 Solution 34: Perform Calculations on the Database . CONCATENATE text-wcm ps_customer-form ps_customer-name INTO lv_text SEPARATED BY space.

ls_bookings-cityfrom RIGHT-JUSTIFIED. WRITE: / text-sum. ENDLOOP. ls_bookings-cityto. WRITE: / ls_bookings-bookid.TAW10_1 Unit 14 Solution 34 Solution 34: Perform Calculations on the Database . LOOP AT pt_bookings INTO ls_bookings. '->'. SKIP 2. ULINE. ls_bookings-carrid RIGHT-JUSTIFIED. SKIP. ls_bookings-connid . . ls_bookings-fldate. LOOP AT pt_sums INTO ls_sums.

WRITE: / ls_sums-forcuram CURRENCY ls_sums-forcurkey.TAW10_1 Unit 14 Solution 34 Solution 34: Perform Calculations on the Database . WRITE: / ls_travelags-name. ENDLOOP. ULINE. ls_travelags-city. " OUTPUT_LIST . ls_sums-forcurkey. ENDFORM. SKIP 2. ENDLOOP. LOOP AT pt_travelags INTO ls_travelags. SKIP. WRITE / text-tag.

TAW10_1 Summary You should now be able to: ● Retain ordered or condensed datasets from the database ● Perform calculations on the database .

TAW10_1 Unit 14 Lesson 3 Lesson 3: Reading from Multiple Database Tables Lesson Objectives After completing this lesson. you will be able to: ● ● ● ● Identify disadvantages of nested SELECT Use ABAP joins and database views Explain special techniques for reading from multiple database tables Use explicit buffering techniques .

TAW10_1 Figure 294: Nested SELECTs Unit 14 Lesson 3 .

TAW10_1 Figure 295: Example – Inner or Outer Join Unit 14 Lesson 3 .

TAW10_1 Figure 296: Example – ABAP Inner Join Unit 14 Lesson 3 .

Template BC402_DBT_3JOIN Solution BC402_DBS_3JOIN Formulate joins over multiple tables. Business Example Your company uses a custom program that displays a list of bookings for a selection of travel agencies. Task 1 . customers. explain the difference between inner and outer joins. and flight data.TAW10_1 Unit 14 Exercise 35 Exercise 35: Implement a Join of Three Database Tables . An analysis shows that the poor performance is due to numerous single record accesses of tables SCARR and STRAVELAG within a loop. Users frequently complain about long runtimes. and understand why using joins for buffered tables negatively impacts performance. You have been asked to redesign the program so it can read the necessary data in one consolidated database access.

1. 2. Copy template BC402_DBT_3JOIN to ZBC402_##_3JOIN. Familiarize yourself with the program and how it works.TAW10_1 Unit 14 Exercise 35 Exercise 35: Implement a Join of Three Database Tables . Copy the program and all its subcomponents. . where ## is your group number.

From which database tables does the program read the data? Which tables are read in a loop? .TAW10_1 Unit 14 Exercise 35 Exercise 35: Implement a Join of Three Database Tables .

3.TAW10_1 Unit 14 Exercise 35 Exercise 35: Implement a Join of Three Database Tables . .

Do you have an explanation for this? . but not for SCUSTOM.TAW10_1 Unit 14 Exercise 35 Exercise 35: Implement a Join of Three Database Tables . The database administrators detected the repeated single record accesses for tables SCARR and STRAVELAG.

4. .TAW10_1 Unit 14 Exercise 35 Exercise 35: Implement a Join of Three Database Tables .

TAW10_1 Unit 14 Exercise 35 Exercise 35: Implement a Join of Three Database Tables . does it make sense to combine the access to SCUSTOM with an access to the other tables in a JOIN? . In this situation.

2. See the source code excerpt from the model solution. Enhance structure type GTY_S_BOOKINGS with the appropriate components. . Note where an outer join is required to ensure the same number of bookings is read. Only read the columns that are required.TAW10_1 Unit 14 Exercise 35 Exercise 35: Implement a Join of Three Database Tables . Task 2 Implement a database access that reads from several tables together in a JOIN. SBOOK. Which changes do you have to make to the WHERE condition? The agencynum field is no longer unique. 1. Enhance the database access to table SBOOK. Note that SBOOK also contains postings that were not made by travel agencies. which means the agencynum field is INITIAL (suggesting that it is empty). you have to prefix it with the table name. Change the FROM clause to read the necessary data from tables SCARR and STRAVELAG in a triple join. or an appropriate alias. Select the three tables for which this makes sense. Therefore.

1. 2. . Which other changes in the SELECT clause do you have to make? Task 3 Remove or comment out unnecessary statements and declarations. Enhance the line type of the internal table (structure type GTY_S_BOOKINGS) with appropriately typed components.TAW10_1 Unit 14 Exercise 35 Exercise 35: Implement a Join of Three Database Tables . 3. Remove or comment out the declaration of the unnecessary data objects. 3. add the fields you want to read from database tables SCARR and STRAVELAG. Remove or comment out the SELECT statements for SCARR and STRAVELAG. Activate and test your program. In the SELECT clause. output the additional fields from internal table GT_BOOKINGS. In the WRITE statement.

. 4.TAW10_1 Unit 14 Exercise 35 Exercise 35: Implement a Join of Three Database Tables . Activate and test your program.

customers. Users frequently complain about long runtimes. An analysis shows that the poor performance is due to numerous single record accesses of tables SCARR and STRAVELAG within a loop.TAW10_1 Unit 14 Solution 35 Solution 35: Implement a Join of Three Database Tables . and flight data. and understand why using joins for buffered tables negatively impacts performance. explain the difference between inner and outer joins. Task 1 . Template BC402_DBT_3JOIN Solution BC402_DBS_3JOIN Formulate joins over multiple tables. You have been asked to redesign the program so it can read the necessary data in one consolidated database access. Business Example Your company uses a custom program that displays a list of bookings for a selection of travel agencies.

Familiarize yourself with the program and how it works. . Copy template BC402_DBT_3JOIN to ZBC402_##_3JOIN. where ## is your group number.TAW10_1 Unit 14 Solution 35 Solution 35: Implement a Join of Three Database Tables . 1. a) Perform this step in the standard manner. 2. Copy the program and all its subcomponents.

TAW10_1 Unit 14 Solution 35 Solution 35: Implement a Join of Three Database Tables . From which database tables does the program read the data? Which tables are read in a loop? .Travel agencies. and STRAVELAG Travel agencies. and STRAVELAG . SCUSTOM .Airlines. The database tables from which the program reads the data are SBOOK . SCARR .Flight bookings.Airlines. The database tables from which the program reads the data in the loop are SCUSTOM .Flight customers.Flight customers. SCARR . .

3. .TAW10_1 Unit 14 Solution 35 Solution 35: Implement a Join of Three Database Tables .

. Do you have an explanation for this? . but not for SCUSTOM.TAW10_1 Unit 14 Solution 35 Solution 35: Implement a Join of Three Database Tables . The database administrators detected the repeated single record accesses for tables SCARR and STRAVELAG. Table SCUSTOM uses single-record buffering. which means the data for a specific customer is only read from the database once on a given server.

TAW10_1 Unit 14 Solution 35 Solution 35: Implement a Join of Three Database Tables . 4. .

because the buffering of SCUSTOM is ignored in a JOIN. In this situation. does it make sense to combine the access to SCUSTOM with an access to the other tables in a JOIN? . No. .TAW10_1 Unit 14 Solution 35 Solution 35: Implement a Join of Three Database Tables .

Only read the columns that are required. a) See the source code excerpt from the model solution.TAW10_1 Unit 14 Solution 35 Solution 35: Implement a Join of Three Database Tables . 1. Enhance the database access to table SBOOK. Note where an outer join is required to ensure the same number of bookings is read. . Select the three tables for which this makes sense. Task 2 Implement a database access that reads from several tables together in a JOIN. Enhance structure type GTY_S_BOOKINGS with the appropriate components. which means the agencynum field is INITIAL (suggesting that it is empty). Change the FROM clause to read the necessary data from tables SCARR and STRAVELAG in a triple join. The triple join consists of an inner join between SBOOK and SCARR (the carrid field is filled for all bookings) and a left outer join between this result and table STRAVELAG. Note that SBOOK also contains postings that were not made by travel agencies.

2. In the SELECT clause. 3. SBOOK. Task 3 .TAW10_1 Unit 14 Solution 35 Solution 35: Implement a Join of Three Database Tables . See the source code excerpt from the model solution. SBOOK. See the source code excerpt from the model solution. add the fields you want to read from database tables SCARR and STRAVELAG. Therefore. you have to prefix it with the table name. Which changes do you have to make to the WHERE condition? The agencynum field is no longer unique. or an appropriate alias. you have to prefix them with the table name. Therefore. Enhance the line type of the internal table (structure type GTY_S_BOOKINGS) with appropriately typed components. Which other changes in the SELECT clause do you have to make? a) The carrid and agencynum fields are no longer unique. or an appropriate alias.

Remove or comment out unnecessary statements and declarations. 1. 2. In the WRITE statement. a) See the source code excerpt from the model solution. output the additional fields from internal table GT_BOOKINGS. a) See the source code excerpt from the model solution. a) Perform this step in the standard manner. Activate and test your program. . a) See the source code excerpt from the model solution. 3.TAW10_1 Unit 14 Solution 35 Solution 35: Implement a Join of Three Database Tables . Remove or comment out the declaration of the unnecessary data objects. Remove or comment out the SELECT statements for SCARR and STRAVELAG. 4. Activate and test your program.

carrname TYPE scarr-carrname. TYPES: BEGIN OF gty_s_booking. Source code excerpt from the model solution: REPORT bc402_dbs_3join. carrid TYPE sbook-carrid. TYPES: . connid TYPE sbook-connid. fldate TYPE sbook-fldate. agencycity TYPE stravelag-city. END OF gty_s_booking. bookid TYPE sbook-bookid. agencyname TYPE stravelag-name. customid TYPE sbook-customid. agencynum TYPE sbook-agencynum.TAW10_1 Unit 14 Solution 35 Solution 35: Implement a Join of Three Database Tables .

gs_booking TYPE gty_s_booking. SELECT-OPTIONS : . DATA: gt_bookings TYPE gty_t_bookings. * gv_agencycity TYPE stravelag-city.TAW10_1 Unit 14 Solution 35 Solution 35: Implement a Join of Three Database Tables . FIELD-SYMBOLS: <fs_booking> LIKE LINE OF gt_bookings. gty_t_bookings TYPE STANDARD TABLE OF gty_s_booking WITH NON-UNIQUE KEY carrid connid fldate bookid. DATA: gv_custname TYPE scustom-name. * gv_carrname TYPE scarr-carrname. * gv_agencyname TYPE stravelag-name.

TAW10_1 Unit 14 Solution 35 Solution 35: Implement a Join of Three Database Tables . SELECT b~carrid b~connid b~fldate b~bookid b~customid b~agencynum c~carrname a~name a~city FROM sbook AS b INNER JOIN scarr AS c ON b~carrid = c~carrid LEFT OUTER JOIN stravelag AS a ON b~agencynum = a~agencynum INTO TABLE gt_bookings WHERE b~agencynum IN so_agy AND b~customid IN so_cus AND b~fldate IN so_fld AND . so_cus FOR gs_booking-customid. so_fld FOR gs_booking-fldate. so_agy FOR gs_booking-agencynum DEFAULT '100'. START-OF-SELECTION.

gv_agencycity) * WHERE agencynum = <fs_booking> -agencynum. LOOP AT gt_bookings ASSIGNING <fs_booking>. * scustom is buffered . WRITE: / <fs_booking>-carrid. * SELECT SINGLE carrname FROM scarr * INTO gv_carrname * WHERE carrid = <fs_booking> -carrid. <fs_booking>-carrname. . cancelled <> 'X'. * gv_carrname.no need for optimizations SELECT SINGLE name FROM scustom INTO gv_custname WHERE id = <fs_booking>-customid.TAW10_1 Unit 14 Solution 35 Solution 35: Implement a Join of Three Database Tables . * * SELECT SINGLE name city FROM stravelag * INTO (gv_agencyname.

gv_custname. * * . <fs_booking>-fldate. <fs_booking>-agencycity. <fs_booking>-bookid. gv_agencycity. <fs_booking>-agencyname.TAW10_1 Unit 14 Solution 35 Solution 35: Implement a Join of Three Database Tables . gv_agencyname. ENDLOOP. <fs_booking>-connid.

TAW10_1 Figure 297: Subselects and Subqueries Unit 14 Lesson 3 .

TAW10_1 Figure 298: Initial Situation – Nested SELECTs Unit 14 Lesson 3 .

TAW10_1 Figure 299: Parallel Cursors Instead of Nested SELECTs Unit 14 Lesson 3 .

TAW10_1 Figure 300: Read on Demand and Buffering Unit 14 Lesson 3 .

After a release upgrade. Business Example Your company uses a standard SAP program that creates a list of bookings for a customer. 2. An append was used to add several fields to structure type BC402_S_BOOKING. You realize that you can improve your enhancement by moving the filling of the buffer (instance attributes) to an implementation of this new method. . you discover that SAP has enhanced the BAdI with a method that is called before the loop over the bookings. This program has been enhanced as follows to meet your company’s needs: 1.TAW10_1 Unit 14 Exercise 36 Exercise 36: Implement Full Buffering and Buffering on Demand . A BAdI implementation was created to fill the additional fields.

Consider that the source code outside of this class represents the SAP program and is unchangeable. Template BC402_DBT_BUFFER Solution BC402_DBS_BUFFER To buffer data completely when it is used in a loop and read data in a loop on demand and then buffer it. perform the following tasks: Task 1 . you do not use an actual BAdI.TAW10_1 Unit 14 Exercise 36 Exercise 36: Implement Full Buffering and Buffering on Demand . Hint: To avoid making this exercise unnecessarily complicated. simulate the BAdI implementation using a local class. Instead. Only change the definition and implementation of this local class during the exercise.

Copy the program and all its subcomponents. where ## is your group number. Copy template BC402_DBT_BUFFER to ZBC402_##_BUFFER. 1. . 2. Familiarize yourself with the program and how it works.TAW10_1 Unit 14 Exercise 36 Exercise 36: Implement Full Buffering and Buffering on Demand .

Which methods does class LCL_IM_BADI have? Which parameters exist in these methods? How are they typed? .TAW10_1 Unit 14 Exercise 36 Exercise 36: Implement Full Buffering and Buffering on Demand .

TAW10_1 Unit 14 Exercise 36 Exercise 36: Implement Full Buffering and Buffering on Demand . 3. .

Which fields were added in an append? .TAW10_1 Unit 14 Exercise 36 Exercise 36: Implement Full Buffering and Buffering on Demand . Display dictionary structure type BC402_S_BOOKING.

TAW10_1 Unit 14 Exercise 36 Exercise 36: Implement Full Buffering and Buffering on Demand . . 4.

TAW10_1 Unit 14 Exercise 36 Exercise 36: Implement Full Buffering and Buffering on Demand . Where is method ADD_DATA of class LCL_IM_BADI called? .

.TAW10_1 Unit 14 Exercise 36 Exercise 36: Implement Full Buffering and Buffering on Demand . 5.

Which database tables are accessed within the local class LCL_IM_BADI? .TAW10_1 Unit 14 Exercise 36 Exercise 36: Implement Full Buffering and Buffering on Demand .

TAW10_1 Unit 14 Exercise 36 Exercise 36: Implement Full Buffering and Buffering on Demand . Create a table type in the private section of the class definition that has the structure type as line type (suggested name: TY_T_SCARR). Create a structure type in the private section of the class definition whose components include the key and required fields from table (suggested name: TY_S_SCARR). 1. Create private structure types and table types for this. . 2. Task 2 Edit the definition of class LCL_IM_BADI. Create two table-type private instance attributes to buffer the data that is read from the database in method ADD_DATA. also in the class definition.

mt_travelags). table type. Which table type is particularly suited to this type of buffering? 4. Task 3 Edit the implementation of method ADD_DATA. 3.TAW10_1 Unit 14 Exercise 36 Exercise 36: Implement Full Buffering and Buffering on Demand . and instance attribute to buffer the data from database table STRAVELAG (suggested names: ty_s_stravelag. Create an appropriate structure type. Create an instance attribute in the private section of the class definition (suggested name: mt_carriers) and type it with this table type. ty_t_stravelag. . 5.

Which database table is a candidate for full buffering? Why? 2. Which one? Make sure that all entries in this database table are read and buffered the first time the method is called. Full buffering is possible for one of the tables. Ensure that the access is only made during the first call of the ADD_DATA method. Program a database access in which the database table that you want to buffer is loaded completely into the corresponding attribute. Make sure the data is buffered in the instance attributes of the class after it is read from the database. 1. .TAW10_1 Unit 14 Exercise 36 Exercise 36: Implement Full Buffering and Buffering on Demand . Full buffering does not make sense for the other database table. Why not? Make sure the data from this table is read and buffered individually on demand.

the individual data is buffered in the Instance attribute. Implement an access to the internal table (the Instance attribute) before the database access. 3. Make sure the database access is skipped if the corresponding record is already found in the internal table. Replace the single record access to the database table with an access to the internal table (the Instance attribute). 4. 6. . Activate and test your program. Make sure that each time the database table that you do not want to buffer is accessed (on a single record basis).TAW10_1 Unit 14 Exercise 36 Exercise 36: Implement Full Buffering and Buffering on Demand . 5.

An append was used to add several fields to structure type BC402_S_BOOKING. Business Example Your company uses a standard SAP program that creates a list of bookings for a customer. . A BAdI implementation was created to fill the additional fields. This program has been enhanced as follows to meet your company’s needs: 1.TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand . You realize that you can improve your enhancement by moving the filling of the buffer (instance attributes) to an implementation of this new method. After a release upgrade. 2. you discover that SAP has enhanced the BAdI with a method that is called before the loop over the bookings.

Instead. Consider that the source code outside of this class represents the SAP program and is unchangeable.TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand . you do not use an actual BAdI. Hint: To avoid making this exercise unnecessarily complicated. Only change the definition and implementation of this local class during the exercise. perform the following tasks: Task 1 . Template BC402_DBT_BUFFER Solution BC402_DBS_BUFFER To buffer data completely when it is used in a loop and read data in a loop on demand and then buffer it. simulate the BAdI implementation using a local class.

1. Copy the program and all its subcomponents. where ## is your group number. . Copy template BC402_DBT_BUFFER to ZBC402_##_BUFFER. Familiarize yourself with the program and how it works. 2.TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand . a) Perform this step in the usual manner.

The only parameter is changing parameter CS_BOOKING. which is typed with dictionary structure type BC402_S_BOOKING. Which methods does class LCL_IM_BADI have? Which parameters exist in these methods? How are they typed? . ADD_DATA. . The class only has one method.TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand .

TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand . . 3.

Which fields were added in an append? . AGENCYNAME.TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand . . and AGENCYCITY. CARRNAME. Display dictionary structure type BC402_S_BOOKING.

. 4.TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand .

Within a loop of internal table GT_BOOKINGS.TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand . . Where is method ADD_DATA of class LCL_IM_BADI called? .

5. .TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand .

TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand .Travel agencies are accessed within the local class LCL_IM_BADI. . The database tables SCARR . Which database tables are accessed within the local class LCL_IM_BADI? .Airlines and STRAVELAG .

Create two table-type private instance attributes to buffer the data that is read from the database in method ADD_DATA. . 2. Create a structure type in the private section of the class definition whose components include the key and required fields from table (suggested name: TY_S_SCARR). 1. a) See the source code excerpt from the model solution. Create a table type in the private section of the class definition that has the structure type as line type (suggested name: TY_T_SCARR).TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand . also in the class definition. Create private structure types and table types for this. Task 2 Edit the definition of class LCL_IM_BADI. a) See the source code excerpt from the model solution.

Create an appropriate structure type.TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand . Create an instance attribute in the private section of the class definition (suggested name: mt_carriers) and type it with this table type. 4. ty_t_stravelag. and instance attribute to buffer the data from database table STRAVELAG (suggested names: ty_s_stravelag. a) See the source code excerpt from the model solution. because the same unique key is always used to access the content later in single record access. 5. Which table type is particularly suited to this type of buffering? A hashed table. mt_travelags). 3. a) See the source code excerpt from the model solution. . table type.

Full buffering does not make sense for the other database table. Full buffering is possible for one of the tables. .TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand . Why not? Make sure the data from this table is read and buffered individually on demand. Task 3 Edit the implementation of method ADD_DATA. Which one? Make sure that all entries in this database table are read and buffered the first time the method is called. Make sure the data is buffered in the instance attributes of the class after it is read from the database.

It only has a few entries. and you can assume that a given flight customer has only booked flights at a few travel agencies.TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand . database table STRAVELAG is fairly large. . Which database table is a candidate for full buffering? Why? Database table SCARR. 2. Ensure that the access is only made during the first call of the ADD_DATA method. 1. 3. In contrast. a) See the source code excerpt from the model solution. Replace the single record access to the database table with an access to the internal table (the Instance attribute). so the probability that many of these entries will actually be needed is high. Program a database access in which the database table that you want to buffer is loaded completely into the corresponding attribute. a) See the source code excerpt from the model solution.

5. the individual data is buffered in the Instance attribute. Make sure the database access is skipped if the corresponding record is already found in the internal table. a) Perform this step in the standard manner. 4. 6. a) See the source code excerpt from the model solution. Make sure that each time the database table that you do not want to buffer is accessed (on a single record basis). .TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand . Implement an access to the internal table (the Instance attribute) before the database access. Activate and test your program. a) See the source code excerpt from the model solution.

TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand . PRIVATE SECTION. INTERFACES lif_badi. ENDINTERFACE. METHODS: add_data CHANGING cs_booking TYPE bc402_s_booking. Interface lif_badi INTERFACE lif_badi. . "lif_badi Class lcl_im_badi (Definition) CLASS lcl_im_badi DEFINITION. PUBLIC SECTION.

carrid TYPE scarr-carrid. END OF ty_s_scarr. TYPES: BEGIN OF ty_s_scarr. name TYPE stravelag-name. END OF ty_s_stravelag. agencynum TYPE stravelag-agencynum. carrname TYPE scarr-carrname. TYPES: ty_t_stravelag TYPE HASHED TABLE OF ty_s_stravelag . city TYPE stravelag-city. TYPES: ty_t_scarr TYPE HASHED TABLE OF ty_s_scarr WITH UNIQUE KEY carrid.TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand . TYPES: BEGIN OF ty_s_stravelag.

Buffer full . DATA: mt_carriers TYPE ty_t_scarr. ls_travelag LIKE LINE OF mt_travelags. * carrname .TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand . "lcl_im_badi DEFINITION Class lcl_im_badi (Implementation) *CLASS lcl_im_badi IMPLEMENTATION. DATA: ls_carrier LIKE LINE OF mt_carriers. mt_travelags TYPE ty_t_stravelag. WITH UNIQUE KEY agencynum. METHOD lif_badi~add_data. ENDCLASS.

SELECT carrid carrname FROM scarr INTO TABLE mt_carriers. READ TABLE mt_carriers INTO ls_carrier WITH TABLE KEY carrid = cs_booking-carrid. ENDIF. cs_booking-carrname = ls_carrier-carrname. * * * SELECT SINGLE carrname FROM scarr INTO cs_booking-carrname WHERE carrid = cs_booking-carrid.buffer on demand . IF mt_carriers IS INITIAL. * agencyname and agencycity .TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand .

. SELECT SINGLE agencynum name city FROM stravelag INTO ls_travelag WHERE agencynum = cs_booking-agencynum. IF sy-subrc <> 0. IF cs_booking-agencynum IS NOT INITIAL. cs_booking-agencycity) WHERE agencynum = cs_booking-agencynum.TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand . INSERT ls_travelag INTO TABLE mt_travelags. * * * * SELECT SINGLE name city FROM stravelag INTO (cs_booking-agencyname. READ TABLE mt_travelags INTO ls_travelag WITH TABLE KEY agencynum = cs_booking-agencynum.

ENDMETHOD. cs_booking-agencycity = ls_travelag-city. "lif_badi~add_data "lcl_im_badi IMPLEMENTATION .TAW10_1 Unit 14 Solution 36 Solution 36: Implement Full Buffering and Buffering on Demand . ENDIF. ENDIF. ENDCLASS. cs_booking-agencyname = ls_travelag-name.

TAW10_1 Figure 301: SELECT with FOR ALL ENTRIES Addition Unit 14 Lesson 3 .

After a release upgrade. This program has been enhanced as follows to meet your company’s needs: 1. You realize that you can improve your enhancement by moving the filling of the buffer (instance attributes) to an implementation of this new method. 2. A BAdI implementation was created to fill the additional fields. you discover that SAP has enhanced the BAdI with a method that is called before the loop over the bookings. An append was used to add several fields to structure type BC402_S_BOOKING. Business Example Your company uses a standard SAP program that creates a list of bookings for a customer. .TAW10_1 Unit 14 Exercise 37 Exercise 37: Read Additional Data with the FOR ALL ENTRIES addition .

to be unchangeable. Template BC402_DBT_FOR_ALL_ENTRIES Solution BC402_DBS_FOR_ALL_ENTRIES To use the FOR ALL ENTRIES addition correctly in the WHERE condition of a SELECT statement. Only change the definition and implementation of this local class during the exercise. Hint: To avoid making this exercise unnecessarily complicated. simulate the BAdI implementation using a local class. you do not use an actual BAdI.TAW10_1 Unit 14 Exercise 37 Exercise 37: Read Additional Data with the FOR ALL ENTRIES addition . which represents the SAP program. You should consider the source code outside of this class. Instead. perform the following tasks: Task 1 .

Copy the program and all its subcomponents. . 2. Copy template BC402_DBT_FOR_ALL_ENTRIES to ZBC402_##_FOR_ALL_ENTRIES. where ## is your group number.TAW10_1 Unit 14 Exercise 37 Exercise 37: Read Additional Data with the FOR ALL ENTRIES addition . Familiarize yourself with the program and how it works. 1. Perform this step in the standard manner.

TAW10_1 Unit 14 Exercise 37 Exercise 37: Read Additional Data with the FOR ALL ENTRIES addition . Which methods does class LCL_IM_BADI have? Which parameters exist in these methods? How are they typed? .

3.TAW10_1 Unit 14 Exercise 37 Exercise 37: Read Additional Data with the FOR ALL ENTRIES addition . .

TAW10_1 Unit 14 Exercise 37 Exercise 37: Read Additional Data with the FOR ALL ENTRIES addition . Where is the prepare method of class LCL_IM_BADI called? .

Do you still need the query that determines whether this call is the first call? . but instead only for those you require during the loop pass. Program a database access to the database tables SCARR and STRAVELAG. Copy the filling of MT_CARRIERS from method ADD_DATA to method PREPARE. Make sure you do not buffer the data for all the travel agencies. Fill instance attribute MT_CARRIERS with the data for all airlines and fill instance attribute MT_TRAVELAGS with the data for the travel agencies. 2. 1.TAW10_1 Unit 14 Exercise 37 Exercise 37: Read Additional Data with the FOR ALL ENTRIES addition . Task 2 Edit the implementation of method PREPARE.

TAW10_1 Unit 14 Exercise 37 Exercise 37: Read Additional Data with the FOR ALL ENTRIES addition . 4. Use the contents of the IT_BOOKINGS import parameter to ensure that only the travel agencies that appear in the bookings in IT_BOOKINGS are read. Program a SELECT statement (array fetch) in which you fill instance attribute MT_TRAVELAGS. . 3. Why is it essential to check whether IT_BOOKINGS is filled? What would happen if IT_BOOKINGS were blank? Task 3 Edit the implementation of method ADD_DATA.

TAW10_1 Unit 14 Exercise 37 Exercise 37: Read Additional Data with the FOR ALL ENTRIES addition . . Remove all the database accesses and replace them with accesses to the instance attributes with the buffered data. Remove the SELECT statement for database buffer STRAVELAG as well as the filling of the buffer. Remove the SELECT statement for database table SCARR. 2. 3. 1. Activate and test your program.

This program has been enhanced as follows to meet your company’s needs: 1. After a release upgrade. A BAdI implementation was created to fill the additional fields. Business Example Your company uses a standard SAP program that creates a list of bookings for a customer. . An append was used to add several fields to structure type BC402_S_BOOKING. 2. You realize that you can improve your enhancement by moving the filling of the buffer (instance attributes) to an implementation of this new method.TAW10_1 Unit 14 Solution 37 Solution 37: Read Additional Data with the FOR ALL ENTRIES addition . you discover that SAP has enhanced the BAdI with a method that is called before the loop over the bookings.

TAW10_1 Unit 14 Solution 37 Solution 37: Read Additional Data with the FOR ALL ENTRIES addition . to be unchangeable. You should consider the source code outside of this class. Instead. you do not use an actual BAdI. Only change the definition and implementation of this local class during the exercise. simulate the BAdI implementation using a local class. which represents the SAP program. Hint: To avoid making this exercise unnecessarily complicated. perform the following tasks: Task 1 . Template BC402_DBT_FOR_ALL_ENTRIES Solution BC402_DBS_FOR_ALL_ENTRIES To use the FOR ALL ENTRIES addition correctly in the WHERE condition of a SELECT statement.

1. Familiarize yourself with the program and how it works. where ## is your group number. 2. Copy the program and all its subcomponents. Perform this step in the standard manner. .TAW10_1 Unit 14 Solution 37 Solution 37: Read Additional Data with the FOR ALL ENTRIES addition . Copy template BC402_DBT_FOR_ALL_ENTRIES to ZBC402_##_FOR_ALL_ENTRIES.

. CS_BOOKING.TAW10_1 Unit 14 Solution 37 Solution 37: Read Additional Data with the FOR ALL ENTRIES addition . The only parameter in the ADD_DATA method is the changing parameter. which is typed with dictionary table type BC402_T_BOOKINGS. Class LCL_IM_BADI has a method called ADD_DATA and another one called PREPARE. IT_BOOKINGS. The only parameter in the prepare method is the import parameter. which is typed with dictionary structure type BC402_S_BOOKING. Which methods does class LCL_IM_BADI have? Which parameters exist in these methods? How are they typed? .

3.TAW10_1 Unit 14 Solution 37 Solution 37: Read Additional Data with the FOR ALL ENTRIES addition . .

.TAW10_1 Unit 14 Solution 37 Solution 37: Read Additional Data with the FOR ALL ENTRIES addition . Where is the prepare method of class LCL_IM_BADI called? . The prepare method of class LCL_IM_BADI is called directly before the loop over internal table GT_BOOKINGS.

Task 2 Edit the implementation of method PREPARE. a) See the source code excerpt from the model solution. .TAW10_1 Unit 14 Solution 37 Solution 37: Read Additional Data with the FOR ALL ENTRIES addition . 2. Program a database access to the database tables SCARR and STRAVELAG. but instead only for those you require during the loop pass. Make sure you do not buffer the data for all the travel agencies. 1. Do you still need the query that determines whether this call is the first call? No. Copy the filling of MT_CARRIERS from method ADD_DATA to method PREPARE. Fill instance attribute MT_CARRIERS with the data for all airlines and fill instance attribute MT_TRAVELAGS with the data for the travel agencies. because the PREPARE method is only called before the loop over the bookings.

3. if IT_BOOKINGS is blank. a) See the source code excerpt from the model solution. Program a SELECT statement (array fetch) in which you fill instance attribute MT_TRAVELAGS. . because ADD_DATA is not executed. Why is it essential to check whether IT_BOOKINGS is filled? What would happen if IT_BOOKINGS were blank? The FOR ALL ENTRIES addition is only a restriction if the specified internal table is filled.TAW10_1 Unit 14 Solution 37 Solution 37: Read Additional Data with the FOR ALL ENTRIES addition . Use the contents of the IT_BOOKINGS import parameter to ensure that only the travel agencies that appear in the bookings in IT_BOOKINGS are read. 4. even though no data is required later. Therefore. all records from STRAVELAG are buffered.

a) See the source code excerpt from the model solution. a) See the source code excerpt from the model solution. Remove the SELECT statement for database buffer STRAVELAG as well as the filling of the buffer. Activate and test your program. Task 3 Edit the implementation of method ADD_DATA. 1.TAW10_1 Unit 14 Solution 37 Solution 37: Read Additional Data with the FOR ALL ENTRIES addition . 2. Remove the SELECT statement for database table SCARR. 3. . Remove all the database accesses and replace them with accesses to the instance attributes with the buffered data.

METHODS: prepare IMPORTING it_bookings TYPE bc402_t_bookings. add_data CHANGING cs_booking TYPE bc402_s_booking.TAW10_1 Unit 14 Solution 37 Solution 37: Read Additional Data with the FOR ALL ENTRIES addition . a) Perform this step in the standard manner. "lif_badi . ENDINTERFACE. Interface lif_badi INTERFACE lif_badi.

carrname TYPE scarr-carrname. Class lcl_im_badi (Definition) CLASS lcl_im_badi DEFINITION.TAW10_1 Unit 14 Solution 37 Solution 37: Read Additional Data with the FOR ALL ENTRIES addition . TYPES: ty_t_scarr TYPE HASHED TABLE OF ty_s_scarr WITH UNIQUE KEY carrid. PUBLIC SECTION. END OF ty_s_scarr. TYPES: BEGIN OF ty_s_stravelag. INTERFACES lif_badi. . carrid TYPE scarr-carrid. TYPES: BEGIN OF ty_s_scarr. PRIVATE SECTION.

TAW10_1 Unit 14 Solution 37 Solution 37: Read Additional Data with the FOR ALL ENTRIES addition . "lcl_im_badi DEFINITION . agencynum TYPE stravelag-agencynum. mt_travelags TYPE ty_t_stravelag. name TYPE stravelag-name. TYPES ty_t_stravelag TYPE HASHED TABLE OF ty_s_stravelag WITH UNIQUE KEY agencynum. DATA: mt_carriers TYPE ty_t_scarr. END OF ty_s_stravelag. ENDCLASS. city TYPE stravelag-city.

* carrname . METHOD lif_badi~prepare. Class lcl_im_badi (Implementation) CLASS lcl_im_badi IMPLEMENTATION.TAW10_1 Unit 14 Solution 37 Solution 37: Read Additional Data with the FOR ALL ENTRIES addition . SELECT agencynum name city FROM stravelag INTO TABLE mt_travelags FOR ALL ENTRIES IN it_bookings .buffer for all entries IF it_bookings IS NOT INITIAL.buffer full SELECT carrid carrname FROM scarr INTO TABLE mt_carriers. * agencyname agencycity .

ENDMETHOD. ENDIF. * carrname . * SELECT carrid carrname FROM scarr * INTO TABLE mt_carriers. .TAW10_1 Unit 14 Solution 37 Solution 37: Read Additional Data with the FOR ALL ENTRIES addition . WHERE agencynum = it_bookings-agencynum. * ENDIF. ls_travelag LIKE LINE OF mt_travelags. "lif_badi~prepare METHOD lif_badi~add_data.read from buffer * IF mt_carriers IS INITIAL. DATA: ls_carrier LIKE LINE OF mt_carriers.

* agencyname and agencycity . cs_booking-carrname = ls_carrier-carrname.TAW10_1 Unit 14 Solution 37 Solution 37: Read Additional Data with the FOR ALL ENTRIES addition . SELECT SINGLE agencynum name city FROM stravelag INTO ls_travelag WHERE agencynum = cs_booking-agencynum. READ TABLE mt_travelags INTO ls_travelag WITH TABLE KEY agencynum = cs_booking-agencynum.read from buffer IF cs_booking-agencynum IS NOT INITIAL. READ TABLE mt_carriers INTO ls_carrier WITH TABLE KEY carrid = cs_booking-carrid. * * * * * * . IF sy-subrc <> 0.

cs_booking-agencyname = ls_travelag-name. ENDIF. "lif_badi~add_data "lcl_im_badi IMPLEMENTATION . * * INSERT ls_travelag INTO TABLE mt_travelags. ENDIF. ENDMETHOD. ENDCLASS.TAW10_1 Unit 14 Solution 37 Solution 37: Read Additional Data with the FOR ALL ENTRIES addition . cs_booking-agencycity = ls_travelag-city.

TAW10_1 Summary You should now be able to: ● Identify disadvantages of nested SELECT ● Use ABAP joins and database views ● Explain special techniques for reading from multiple database tables ● Use explicit buffering techniques .

TAW10_1 Unit 14 The ______________ statement defines and executes the access. FETCH NEXT CURSOR D. A. CLOSE CURSOR . but does not pass any data on to the application program. Choose the correct answer. OPEN CURSOR C. FETCH B.

OPEN CURSOR . B. but does not pass any data on to the application program.TAW10_1 Unit 14 The ______________ statement defines and executes the access.

BETWEEN D. IS . Choose the correct answer. LIKE B. Unit 14 A. IN C.TAW10_1 The __________ operator is used for comparison with a single list of values.

Unit 14 B.TAW10_1 The __________ operator is used for comparison with a single list of values. IN .

Unit 14 "When you process multiline result sets. you should read them into an internal table (array fetch)." .TAW10_1 Determine whether this statement is true or false.

TAW10_1 Determine whether this statement is true or false. you should read them into an internal table (array fetch)." True . Unit 14 "When you process multiline result sets.

TAW10_1 Determine whether this statement is true or false." . Unit 14 "An aggregate expression uses an aggregate function to specify a column in the SELECT DISTINCT statement.

Unit 14 "An aggregate expression uses an aggregate function to specify a column in the SELECT DISTINCT statement.TAW10_1 Determine whether this statement is true or false." False .

TAW10_1 Determine whether this statement is true or false." . Unit 14 "Two prerequisites of using the ORDER BY PRIMARY KEY addition to a select statement are that the FROM clause must contain a single database table (no views or joins) and that the field list after SELECT must contain all key fields of the table.

" True .TAW10_1 Determine whether this statement is true or false. Unit 14 "Two prerequisites of using the ORDER BY PRIMARY KEY addition to a select statement are that the FROM clause must contain a single database table (no views or joins) and that the field list after SELECT must contain all key fields of the table.

Choose the correct answer. LEFT OUTER JOIN B. A. INNER JOIN C. OUTER JOIN .TAW10_1 Unit 14 _____________ corresponds  to the result set that only considers the records from the outer table for which suitable data records exist in the inner table.

TAW10_1 Unit 14 _____________ corresponds  to the result set that only considers the records from the outer table for which suitable data records exist in the inner table. B. INNER JOIN .

Unit 14 "A SELECT statement with a subquery has a more restricted syntax than a SELECT statement without a subquery.TAW10_1 Determine whether this statement is true or false." .

TAW10_1 Determine whether this statement is true or false. Unit 14 "A SELECT statement with a subquery has a more restricted syntax than a SELECT statement without a subquery." True .

" .TAW10_1 Determine whether this statement is true or false. Unit 14 "The connection between the inner and outer database tables is created in LOOP.

TAW10_1 Determine whether this statement is true or false." False . Unit 14 "The connection between the inner and outer database tables is created in LOOP.

SELECT B.TAW10_1 To read large data volumes. you should use _______________ only in exceptional cases. Unit 14 A. FOR ALL ENTRIES . Choose the correct answer. SELECT SINGLE C.

FOR ALL ENTRIES . you should use _______________ only in exceptional cases. Unit 14 C.TAW10_1 To read large data volumes.