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