ABAP OO Flashcards
With the following class definition, what is the correct syntax for calling method b?
(Note: lo_a is a reference variable for class ZCL_A.)
CLASS zcl_a DEFINITION PUBLIC.
PUBLIC SECTION.
CLASS-METHODS b.
ENDCLASS.
zcl=>b.
In a test method you call method cl_abap_unit_assert=>assert_equals( ..) in the following way:
CLASS ltcl1 DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
PRIVATE SECTION.
METHODS m1 FOR TESTING.
ENDCLASS.
CLASS ltcl1 IMPLEMENTATION.
METHOD m1.
DATA: go_test_object TYPE REF TO zcl_to_be_tested.
CONSTANTS: lco_exp TYPE string VALUE ‘test2’.
CREATE OBJECT go_test_object.
cl_abap_unit_assert=>assert_equals(
EXPORTING
act = go_class->mv_attribute
exp = lco_exp
msg = assert equals failed
&& go_test_object->mv_attribute && ` ` && lco_exp
).
ENDMETHOD.
ENDCLASS.
What will happen if method parameters act and exp are not equal?
There will be a message in the test log.
What do you have to consider when working with interfaces?
- Static methods, instance methods, static events, and instance events are possible interface components.
- Instance methods are not implemented in an interface.
- Implementing classes must declare the interface in their public section.
Which statement reads a single row from a database table?
SELECT SINGLE <tablename> ...</tablename>
Which function call returns 0?
find_any_not_of( val ‘ABAP ABAP abap’ sub = ‘AB’).
What is the significance of ‘ALV IDA’ (ALV with Integrated Data Access) in ABAP for SAP HANA?
It enables efficient data display by leveraging the power of the HANA database.
In ABAP Object-Oriented programming, what is a Class?
A template for creating objects.
How does the ‘Composite’ design pattern apply in ABAP OO?
It allows the creation of complex objects by combining simpler ones.
How does the ‘Observer’ pattern function in ABAP OO?
By allowing objects to publish changes to their state to interested subscribers.
Which of the following are essential principles of ABAP programming?
- Modularization
- Layered architecture
- Code pushdown
In ABAP SQL, which of the following can be assigned an alias?
- field (from field list)
- database table
How does the ‘ABAP Test Cockpit’ (ATC) enhance code quality in ABAP development?
By performing static code checks and analysis.
Scenario: A developer is optimizing an ABAP program for SAP HANA. The program contains several nested loops for data processing. What strategy should be used to optimize this program?
Convert nested loops into single SQL statements using New ABAP SQL.
Which of the following are incomplete ABAP types?
- P
- C
In class ZCL_CLASS_A, you use the statement DATA var TYPE ** What may stand in place of **?
- The name of a domain from the ABAP Dictionary
- The name of a data element from the ABAP Dictionary
What are valid statements?
- go_if 1 may call method ml with go_ift->ml().
- go_ifl may call method m2 with go if->m2(…).
- Instead of go ell = NEW #(…) you could use go ifl = NEW cll(. … ).
In the context of SAP S/4HANA Cloud, what is a Side-by-Side Extension?
An extension built on a separate platform, like SAP BTP.
What is the purpose of the ABAP Test Cockpit (ATC)?
To perform static code checks and unit tests.
What is the role of the Enhancement Framework in ABAP?
To enable the modification of standard SAP code
Class super has subclass sub. Which rules are valid for the sub constructor?
- The method signature can be changed.
- The constructor of super must be called before using any components of your own instance.
Scenario: In a vehicle management system, there is a need to define a method ‘displayDetails’ differently for each type of vehicle (Car, Truck, Motorcycle).
Which Object-Oriented concept should be used to achieve this?
Polymorphism.
In ABAP OO, what is the significance of the ‘Friend’ relationship between classes?
It enables classes to access each other’s private components.
Which ABAP SQL clause allows the use of inline declarations?
Into.
Which of the following is a characteristic of ABAP Managed Database Procedures (AMDP)?
They are stored in the SAP HANA database.
How do ‘Expression-Based Indexes’ enhance performance in ABAP for SAP HANA?
By creating indexes based on calculated expressions.
AUTHORITY-CHECK OBJECT ‘/DWO/TRVL ( ID ‘CNTRY’ FIELD ‘DE* ID ACTVT FIELD ‘03”.
Which of the following apply?
- If the user is authorized for ‘CNTRY = ‘DE’ AND for ‘ACTVT = ‘03 then the return code is 0.
- AUTHORITY CHECK verifies whether a user is authorized for/DMO/TRVL” with the listed field values.
What are valid statements?
- The pragma is not checked by the syntax checker.
- ## NEEDED is checked by the syntax checker.
Which internal table type allows unique and non-unique keys?
Standard
In ABAP OO, which keyword is used to define a method that can be overridden in a subclass?
REDEFINITION
In the ABAP RAP, what is the purpose of the Business Object Processing Framework (BOPF)?
To manage the lifecycle of business objects
In ABAP for SAP HANA, how does ‘Parallel Processing’ improve application performance?
By dividing tasks into smaller sub-tasks that are executed simultaneously.
Scenario: A developer is designing a system for managing vehicles. They have classes for different types of vehicles like ‘Car’, ‘Truck’, and ‘Motorcycle’.
Which Object-Oriented concept is best to create a common structure for these classes?
Inheritance
What would be the correct expression to change a given string value ‘mr joe doe’ into ‘JOE’ in an ABAP SQL field list?
SELECT FROM TABLE dbtabl FIELDS Of1, substring(upper(‘mr joe doe’), 4, 3) AS f2_sub_up, f3,…
In ABAP, what is a “Transport Request”?
A package for transporting changes across systems