Practice Free C_ABAPD_2309 Exam Online Questions
Refer to the exhibit.
The class zcl_demo_class is in a software component with the language version set to "Standard ABAP". The function module "ZF11 is in a software component with the language version set to "ABAP Cloud". Both the class and function module are customer created. Regarding line #6, which of
the following is a valid statement?
- A . ‘ZF1’ can be called whether it has been released or not for cloud development.
- B . ‘ZF1’ can be called via a wrapper that itself has been released for cloud development.
- C . ‘ZF1’ can be called via a wrapper that itself has not been released for cloud development.
- D . ‘ZF1’ must be released for cloud development to be called.
B
Explanation:
The function module ZF1 is in a software component with the language version set to “ABAP Cloud”. This means that it follows the ABAP Cloud Development Model, which requires the usage of public SAP APIs and extension points to access SAP functionality and data. These APIs and extension points are released by SAP and documented in the SAP API Business Hub1. Customer-created function modules are not part of the public SAP APIs and are not released for cloud development. Therefore, calling a function module directly from a class with the language version set to “Standard ABAP” is not allowed and will result in a syntax error. However, there is a possible way to call a function module indirectly from a class with the language version set to “Standard ABAP”:
Create a wrapper class or interface for the function module and release it for cloud development. A wrapper is a class or interface that encapsulates the function module and exposes its functionality through public methods or attributes. The wrapper must be created in a software component with the language version set to “ABAP Cloud” and must be marked as released for cloud development using the annotation @EndUserText.label. The wrapper can then be called from a class with the language version set to “Standard ABAP” using the public methods or attributes2.
For example, the following code snippet shows how to create a wrapper class for the function module ZF1 and call it from the class zcl_demo_class:
@EndUserText.label: ‘Wrapper for ZF1’ CLASS zcl_wrapper_zf1 DEFINITION PUBLIC FINAL CREATE PUBLIC. PUBLIC SECTION. CLASS-METHODS: call_zf1 IMPORTING iv_a TYPE i iv_b TYPE i EXPORTING ev_result TYPE i. ENDCLASS.
CLASS zcl_wrapper_zf1 IMPLEMENTATION. METHOD call_zf1. CALL FUNCTION ‘ZF1’ EXPORTING a = iv_a b = iv_b IMPORTING result = ev_result. ENDMETHOD. ENDCLASS. CLASS zcl_demo_class DEFINITION. METHODS: m1. ENDCLASS.
CLASS zcl_demo_class IMPLEMENTATION. METHOD m1. DATA(lv_result) =
zcl_wrapper_zf1=>call_zf1( iv_a = 2 iv_b = 3 ). WRITE: / lv_result. ENDMETHOD. ENDCLASS.
The output of this code is: 5
Reference: 1: SAP API Business Hub 2: Creating an ABAP Cloud Project | SAP Help Portal
Refer to the exhibit.
The class zcl_demo_class is in a software component with the language version set to "Standard ABAP". The function module "ZF11 is in a software component with the language version set to "ABAP Cloud". Both the class and function module are customer created. Regarding line #6, which of
the following is a valid statement?
- A . ‘ZF1’ can be called whether it has been released or not for cloud development.
- B . ‘ZF1’ can be called via a wrapper that itself has been released for cloud development.
- C . ‘ZF1’ can be called via a wrapper that itself has not been released for cloud development.
- D . ‘ZF1’ must be released for cloud development to be called.
B
Explanation:
The function module ZF1 is in a software component with the language version set to “ABAP Cloud”. This means that it follows the ABAP Cloud Development Model, which requires the usage of public SAP APIs and extension points to access SAP functionality and data. These APIs and extension points are released by SAP and documented in the SAP API Business Hub1. Customer-created function modules are not part of the public SAP APIs and are not released for cloud development. Therefore, calling a function module directly from a class with the language version set to “Standard ABAP” is not allowed and will result in a syntax error. However, there is a possible way to call a function module indirectly from a class with the language version set to “Standard ABAP”:
Create a wrapper class or interface for the function module and release it for cloud development. A wrapper is a class or interface that encapsulates the function module and exposes its functionality through public methods or attributes. The wrapper must be created in a software component with the language version set to “ABAP Cloud” and must be marked as released for cloud development using the annotation @EndUserText.label. The wrapper can then be called from a class with the language version set to “Standard ABAP” using the public methods or attributes2.
For example, the following code snippet shows how to create a wrapper class for the function module ZF1 and call it from the class zcl_demo_class:
@EndUserText.label: ‘Wrapper for ZF1’ CLASS zcl_wrapper_zf1 DEFINITION PUBLIC FINAL CREATE PUBLIC. PUBLIC SECTION. CLASS-METHODS: call_zf1 IMPORTING iv_a TYPE i iv_b TYPE i EXPORTING ev_result TYPE i. ENDCLASS.
CLASS zcl_wrapper_zf1 IMPLEMENTATION. METHOD call_zf1. CALL FUNCTION ‘ZF1’ EXPORTING a = iv_a b = iv_b IMPORTING result = ev_result. ENDMETHOD. ENDCLASS. CLASS zcl_demo_class DEFINITION. METHODS: m1. ENDCLASS.
CLASS zcl_demo_class IMPLEMENTATION. METHOD m1. DATA(lv_result) =
zcl_wrapper_zf1=>call_zf1( iv_a = 2 iv_b = 3 ). WRITE: / lv_result. ENDMETHOD. ENDCLASS.
The output of this code is: 5
Reference: 1: SAP API Business Hub 2: Creating an ABAP Cloud Project | SAP Help Portal
In a test method you call method cl_abap_unit_assert=>assert_equals( .. ) in the following way:
CLASS Itcl1 DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
PRIVATE SECTION.
METHODS m1 FOR TESTING.
ENDCLASS.
CLASS Itcl1 IMPLEMENTATION.
METHOD m1.
DATA: go_test_object TYPE REF TO zcl_to_be_tested.
CONSTANTS: Ico_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?
- A . The tested unit will automatically be appended to a default ABAP Test Cockpit Variant.
- B . The tested unit cannot be transported.
- C . The test will be aborted.
- D . There will be a message in the test log.
In which products must you use the ABAP Cloud Development Model? Note: There are 2 correct answers to this question.
- A . SAP S/4HANA Cloud, private edition
- B . SAP BTP, ABAP environment
- C . SAP S/4HANA on premise
- D . SAP S/4HANA Cloud, public edition
BA
Explanation:
The ABAP Cloud Development Model is designed for environments that are managed and updated by SAP, which typically means cloud environments. The correct answers where this development model must be used are:
SAP BTP, ABAP environment – SAP Business Technology Platform (BTP), ABAP environment (also known as Steampunk), which is SAP’s PaaS (Platform as a Service) offering, requires the use of the ABAP Cloud Development Model.
SAP S/4HANA Cloud, public edition – The public edition of SAP S/4HANA Cloud is a SaaS (Software as a Service) offering that is fully managed by SAP, and it requires the use of the ABAP Cloud Development Model.
In which products must you use the ABAP Cloud Development Model? Note: There are 2 correct answers to this question.
- A . SAP S/4HANA Cloud, private edition
- B . SAP BTP, ABAP environment
- C . SAP S/4HANA on premise
- D . SAP S/4HANA Cloud, public edition
BA
Explanation:
The ABAP Cloud Development Model is designed for environments that are managed and updated by SAP, which typically means cloud environments. The correct answers where this development model must be used are:
SAP BTP, ABAP environment – SAP Business Technology Platform (BTP), ABAP environment (also known as Steampunk), which is SAP’s PaaS (Platform as a Service) offering, requires the use of the ABAP Cloud Development Model.
SAP S/4HANA Cloud, public edition – The public edition of SAP S/4HANA Cloud is a SaaS (Software as a Service) offering that is fully managed by SAP, and it requires the use of the ABAP Cloud Development Model.
Refer to exhibit.
When you attempt to activate the definition, what will be the response?
- A . Activation error because the field names of the union do not match
- B . Activation error because the field types of the union do not match
- C . Activation error because the key fields of the union do not match
- D . Activation successful
A
Explanation:
When using the UNION clause in SQL or in Core Data Services (CDS) views, the requirement is that the number and types of the columns that are being unioned match in both SELECT statements. The column names themselves do not need to match, but the positions and data types do.
From the exhibit, we can see that both parts of the union have fields that are seemingly aliased correctly to ensure that the resulting unioned dataset has a consistent structure. The fields id, name, city, and country are present in both SELECT statements and have been given the same aliases, and there is a consistent partner alias that corresponds to Customer in the first SELECT and Agency in the second SELECT.
However, without knowing the exact data types of each field, we cannot definitively say whether there will be an activation error due to a mismatch in field types (option B). Assuming that the data types do match and that the key fields being referred to by the alias id are compatible for the purpose of the union, the response would likely be:
D. Activation successful
This assumes that the exhibit shows correct aliasing and compatible data types for the UNION operation. If the data types for the corresponding columns do not match, then there would be an activation error as per option B. But since the exhibit does not provide data type information, we have to base our answer on the typical requirements for a UNION to be successful.
Refer to exhibit.
When you attempt to activate the definition, what will be the response?
- A . Activation error because the field names of the union do not match
- B . Activation error because the field types of the union do not match
- C . Activation error because the key fields of the union do not match
- D . Activation successful
A
Explanation:
When using the UNION clause in SQL or in Core Data Services (CDS) views, the requirement is that the number and types of the columns that are being unioned match in both SELECT statements. The column names themselves do not need to match, but the positions and data types do.
From the exhibit, we can see that both parts of the union have fields that are seemingly aliased correctly to ensure that the resulting unioned dataset has a consistent structure. The fields id, name, city, and country are present in both SELECT statements and have been given the same aliases, and there is a consistent partner alias that corresponds to Customer in the first SELECT and Agency in the second SELECT.
However, without knowing the exact data types of each field, we cannot definitively say whether there will be an activation error due to a mismatch in field types (option B). Assuming that the data types do match and that the key fields being referred to by the alias id are compatible for the purpose of the union, the response would likely be:
D. Activation successful
This assumes that the exhibit shows correct aliasing and compatible data types for the UNION operation. If the data types for the corresponding columns do not match, then there would be an activation error as per option B. But since the exhibit does not provide data type information, we have to base our answer on the typical requirements for a UNION to be successful.
Which of the following results in faster access to internal tables? Note: There are 3 correct answers to this question.
- A . In a sorted internal table, specifying the primary key partially from the left without gaps.
- B . In a sorted internal table, specifying the primary key completely.
- C . In a standard internal table, specifying the primary key partially from the left without gaps.
- D . In a hashed internal table, specifying the primary key partially from the left without gaps.
- E . In a hashed internal table, specifying the primary key completely.
DBE
Explanation:
When accessing internal tables in ABAP, certain types of tables and methods of specifying keys can lead to faster data retrieval:
In a sorted internal table, specifying the primary key partially from the left without gaps – This is correct. Sorted tables are organized according to the key, and partial key access from the left without gaps allows for efficient binary searches.
In a sorted internal table, specifying the primary key completely – This is also correct. When the entire key is specified for a sorted table, the system can quickly locate the record using a binary search.
In a hashed internal table, specifying the primary key completely – This is correct. Hashed tables provide the fastest access when the entire primary key is specified, as the hash algorithm used will directly access the storage location of the record.
In ABAP SQL, which of the following can be assigned an alias? Note: There are 2 correct answers to this question.
- A . order criterion (from order by clause)
- B . field (from field list)
- C . database table
- D . group criterion (from group by clause)
BC
Explanation:
In ABAP SQL, an alias is a temporary name that can be assigned to a field or a database table in a query. An alias can be used to make the query more readable, to avoid name conflicts, or to access fields or tables with long names. An alias is created with the AS keyword and is only valid for the duration of the query1.
The following are examples of how to assign an alias to a field or a database table in ABAP SQL:
B) field (from field list): A field is a column of a table or a view that contains data of a certain type. A field can be assigned an alias in the field list of a SELECT statement, which specifies the fields that are selected from the data source. For example, the following query assigns the alias name to the field carrname of the table scarr:
SELECT carrid, carrname AS name FROM scarr.
The alias name can be used instead of carrname in other clauses of the query, such as WHERE, GROUP BY, ORDER BY, and so on2.
C) database table: A database table is a collection of data that is organized in rows and columns. A database table can be assigned an alias in the FROM clause of a SELECT statement, which specifies the data source that is selected from. For example, the following query assigns the alias c to the table
scarr:
SELECT c.carrid, c.carrname FROM scarr AS c.
The alias c can be used instead of scarr in other clauses of the query, such as WHERE, JOIN, GROUP BY, ORDER BY, and so on3.
The following are not valid for assigning an alias in ABAP SQL:
A) order criterion (from order by clause): An order criterion is a field or an expression that is used to sort the result set of a query in ascending or descending order. An order criterion cannot be assigned an alias in the ORDER BY clause of a SELECT statement, because the alias is not visible in this clause. The alias can only be used in the clauses that follow the clause where it is defined1.
D) group criterion (from group by clause): A group criterion is a field or an expression that is used to group the result set of a query into subsets that share the same values. A group criterion cannot be assigned an alias in the GROUP BY clause of a SELECT statement, because the alias is not visible in this clause. The alias can only be used in the clauses that follow the clause where it is defined1.
Reference: 1: ALIASES – ABAP Keyword Documentation 2: SELECT List – ABAP Keyword Documentation 3: FROM Clause – ABAP Keyword Documentation
Which field is defined incorrectly?
- A . field1
- B . field3
- C . field4
- D . field2
C
Explanation:
The field4 is defined incorrectly in the ABAP code snippet. The reason is that the data type c (character) cannot have a decimal places specification. The decimal places specification is only valid for the data types p (packed number) and f (floating point number)1. Therefore, the field4 definition should either omit the decimal places specification or change the data type to p or f.
Explanation:
Reference: 1: Data Types and Data Objects – ABAP Keyword Documentation – SAP Online Help