SAP C_ABAPD_2309 SAP Certified Associate - Back-End Developer - ABAP Cloud Exam Practice Test

Page: 1 / 14
Total 81 questions
Question 1

Given the following Core Data Service View Entity Data Definition:

1 @AccessControl.authorizationCheck: #NOT_REQUIRED

2 DEFINE VIEW ENTITY demo_flight_info_join

3 AS SELECT

4 FROM scarr AS a

5 LEFT OUTER JOIN scounter AS c

6 LEFT OUTER JOIN sairport AS p

7 ON p.id = c.airport

8 ON a.carrid = c.carrid

9 {

10 a.carrid AS carrier_id,

11 p.id AS airport_id,

12 c.countnum AS counter_number

13 }

In what order will the join statements be executed?



Answer : A

The order in which the join statements will be executed is:

scarr will be joined with scounter first and the result will be joined with sairport.

This is because the join statements are nested from left to right, meaning that the leftmost data source is joined with the next data source, and the result is joined with the next data source, and so on. The join condition for each pair of data sources is specified by the ON clause that follows the data source name. The join type for each pair of data sources is specified by the join operator that precedes the data source name. In this case, the join operator is LEFT OUTER JOIN, which means that all the rows from the left data source are included in the result, and only the matching rows from the right data source are included. If there is no matching row from the right data source, the corresponding fields are filled with initial values1.

Therefore, the join statements will be executed as follows:

First, scarr AS a will be joined with scounter AS c using the join condition a.carrid = c.carrid. This means that all the rows from scarr will be included in the result, and only the rows from scounter that have the same value for the carrid field will be included. If there is no matching row from scounter, the countnum field will be filled with an initial value.

Second, the result of the first join will be joined with sairport AS p using the join condition p.id = c.airport. This means that all the rows from the first join will be included in the result, and only the rows from sairport that have the same value for the id field as the airport field from the first join will be included. If there is no matching row from sairport, the id field will be filled with an initial value.


Question 2

In RESTful Application Programming, a business object contains which parts? Note: There are 2 correct answers to this question.



Answer : A, B

In RESTful Application Programming, a business object contains two main parts: a CDS view and a behavior definition1.

A . CDS view: A CDS view is a data definition that defines the structure and the data source of a business object. A CDS view can consist of one or more entities that are linked by associations or compositions. An entity is a CDS view element that represents a node or a projection of a business object.An entity can have various annotations that define the metadata and the semantics of the business object2.

B . Behavior definition: A behavior definition is a source code artifact that defines the behavior and the validation rules of a business object. A behavior definition can specify the standard CRUD (create, read, update, delete) operations, the draft handling, the authorization checks, and the side effects for a business object.A behavior definition can also define custom actions, validations, and determinations that implement the business logic of a business object3.

The following are not parts of a business object in RESTful Application Programming, because:

C . Authentication rules: Authentication rules are not part of a business object, but part of a service binding. A service binding is a configuration artifact that defines how a business object is exposed as an OData service.A service binding can specify the authentication method, the authorization scope, the protocol version, and the service options for the OData service4.

D . Process definition: Process definition is not part of a business object, but part of a workflow. A workflow is a business process that orchestrates the tasks and the events of a business object. A workflow can be defined using the Workflow Editor in the SAP Business Application Studio or the SAP Web IDE.A workflow can use the business object's APIs to trigger or consume events, execute actions, or read or update data5.


Question 3

What are the effects of this annotation? Note: There are 2 correct answers to this question.



Answer : A, B

The annotation @Environment.systemField: #LANGUAGE is used to assign the ABAP system field sy-langu to an input parameter of a CDS view or a CDS table function. This enables the implicit parameter passing in Open SQL, which means that the value of sy-langu will be automatically passed to the CDS view without explicitly specifying it in the WHERE clause.This also applies to the CDS views that use the annotated CDS view as a data source, which means that the value of sy-langu will be propagated to the nested CDS views (view on view)12. For example:

The following code snippet defines a CDS view ZI_FLIGHT_TEXTS with an input parameter p_langu that is annotated with @Environment.systemField: #LANGUAGE:

define view ZI_FLIGHT_TEXTS with parameters p_langu : syst_langu @<Environment.systemField: #LANGUAGE as select from sflight left outer join scarr on sflight.carrid = scarr.carrid left outer join stext on scarr.carrid = stext.carrid { sflight.carrid, sflight.connid, sflight.fldate, scarr.carrname, stext.text as carrtext } where stext.langu = :p_langu

The following code snippet shows how to use the CDS view ZI_FLIGHT_TEXTS in ABAP without specifying the value of p_langu in the WHERE clause. The value of sy-langu will be automatically passed to the CDS view:

SELECT carrid, connid, fldate, carrname, carrtext FROM zi_flight_texts INTO TABLE @DATA(lt_flights).

The following code snippet shows how to use the CDS view ZI_FLIGHT_TEXTS in another CDS view ZI_FLIGHT_REPORT. The value of sy-langu will be automatically passed to the nested CDS view ZI_FLIGHT_TEXTS:

define view ZI_FLIGHT_REPORT with parameters p_langu : syst_langu @<Environment.systemField: #LANGUAGE as select from zi_flight_texts(p_langu) { carrid, connid, fldate, carrname, carrtext, count(*) as flight_count } group by carrid, connid, fldate, carrname, carrtext

The annotation @Environment.systemField: #LANGUAGE does not prevent the possibility of overriding the default value with a value of your own. You can still specify a different value for the input parameter p_langu in the WHERE clause, either in ABAP or in another CDS view.This will override the value of sy-langu and pass the specified value to the CDS view12. For example:

The following code snippet shows how to use the CDS view ZI_FLIGHT_TEXTS in ABAP with a specified value of p_langu in the WHERE clause. The value 'E' will be passed to the CDS view instead of the value of sy-langu:

SELECT carrid, connid, fldate, carrname, carrtext FROM zi_flight_texts WHERE p_langu = 'E' INTO TABLE @DATA(lt_flights).

The following code snippet shows how to use the CDS view ZI_FLIGHT_TEXTS in another CDS view ZI_FLIGHT_REPORT with a specified value of p_langu in the WHERE clause. The value 'E' will be passed to the nested CDS view ZI_FLIGHT_TEXTS instead of the value of sy-langu:

define view ZI_FLIGHT_REPORT with parameters p_langu : syst_langu @<Environment.systemField: #LANGUAGE as select from zi_flight_texts(p_langu) { carrid, connid, fldate, carrname, carrtext, count(*) as flight_count } where p_langu = 'E' group by carrid, connid, fldate, carrname, carrtext


Question 4

What are some characteristics of secondary keys for internal tables? Note: There are 3 correct answers to this question.



Answer : A, B, D

Secondary keys are additional keys that can be defined for internal tables to optimize the access to the table using fields that are not part of the primary key. Secondary keys can be either sorted or hashed, depending on the table type and the uniqueness of the key.Secondary keys have the following characteristics1:

A . Secondary keys must be chosen explicitly when you actually read from an internal table. This means that when you use a READ TABLE or a LOOP AT statement to access an internal table, you have to specify the secondary key that you want to use with the USING KEY addition. For example, the following statement reads an internal table itab using a secondary key sec_key:

READ TABLE itab USING KEY sec_key INTO DATA(wa).

If you do not specify the secondary key, the system will use the primary key by default2.

B . Multiple secondary keys are allowed for any kind of internal table. This means that you can define more than one secondary key for an internal table, regardless of the table type. For example, the following statement defines an internal table itab with two secondary keys sec_key_1 and sec_key_2:

DATA itab TYPE SORTED TABLE OF ty_itab WITH NON-UNIQUE KEY sec_key_1 COMPONENTS field1 field2 sec_key_2 COMPONENTS field3 field4.

You can then choose which secondary key to use when you access the internal table1.

D . Sorted secondary keys do NOT have to be unique. This means that you can define a sorted secondary key for an internal table that allows duplicate values for the key fields. A sorted secondary key maintains a predefined sorting order for the internal table, which is defined by the key fields in the order in which they are specified. For example, the following statement defines a sorted secondary key sec_key for an internal table itab that sorts the table by field1 in ascending order and field2 in descending order:

DATA itab TYPE STANDARD TABLE OF ty_itab WITH NON-UNIQUE SORTED KEY sec_key COMPONENTS field1 ASCENDING field2 DESCENDING.

You can then access the internal table using the sorted secondary key with a binary search algorithm, which is faster than a linear search3.

The following are not characteristics of secondary keys for internal tables, because:

C . Hashed secondary keys do NOT have to be unique. This is false because hashed secondary keys must be unique. This means that you can only define a hashed secondary key for an internal table that does not allow duplicate values for the key fields. A hashed secondary key does not have a predefined sorting order for the internal table, but uses a hash algorithm to store and access the table rows. For example, the following statement defines a hashed secondary key sec_key for an internal table itab that hashes the table by field1 and field2:

DATA itab TYPE STANDARD TABLE OF ty_itab WITH UNIQUE HASHED KEY sec_key COMPONENTS field1 field2.

You can then access the internal table using the hashed secondary key with a direct access algorithm, which is very fast.

E . Secondary keys can only be created for standard tables. This is false because secondary keys can be created for any kind of internal table, such as standard tables, sorted tables, and hashed tables. However, the type of the secondary key depends on the type of the internal table.For example, a standard table can have sorted or hashed secondary keys, a sorted table can have sorted secondary keys, and a hashed table can have hashed secondary keys1.


Question 5

What are valid statements? Note: There are 3 correct answers to this question



Answer : B, D, E

The following are the explanations for each statement:

C: This statement is valid. Class CL1 uses the interface. This is because class CL1 implements the interface ifl using the INTERFACES statement in the public section of the class definition. The INTERFACES statement makes the class compatible with the interface and inherits all the components of the interface.The class can then use the interface components, such as the method ml, by using the interface component selector ~, such as ifl~ml12

E: This statement is valid. Class CL1 implements the interface. This is because class CL1 implements the interface ifl using the INTERFACES statement in the public section of the class definition. The INTERFACES statement makes the class compatible with the interface and inherits all the components of the interface.The class must then provide an implementation for the interface method ml in the implementation part of the class, unless the method is declared as optional or abstract12

D: This statement is valid. In class CL2, the interface method is named ifl~ml. This is because class CL2 has a data member named m0_ifl of type REF TO ifl, which is a reference to the interface ifl. The interface ifl defines a method ml, which can be called using the reference variable m0_ifl.The interface method ml has the name ifl~ml in the class, where ifl is the name of the interface and the character ~ is the interface component selector12

The other statements are not valid, as they have syntax errors or logical errors. These statements are:

A: This statement is not valid. In class CL1, the interface method is named ifl~ml, not if-ml. This is because class CL1 implements the interface ifl using the INTERFACES statement in the public section of the class definition. The interface ifl defines a method ml, which can be called using the class name or a reference to the class. The interface method ml has the name ifl~ml in the class, where ifl is the name of the interface and the character ~ is the interface component selector.Using the character - instead of the character ~ will cause a syntax error12

B: This statement is not valid. Class CL2 does not use the interface, but only has a reference to the interface. This is because class CL2 has a data member named m0_ifl of type REF TO ifl, which is a reference to the interface ifl. The interface ifl defines a method ml, which can be called using the reference variable m0_ifl. However, class CL2 does not implement the interface ifl, nor does it inherit the interface components.Therefore, class CL2 does not use the interface, but only references the interface12


Question 6

Refer to the exhibit.

with which predicate condition can you ensure that the CAST will work?



Answer : C

The predicate condition that can be used to ensure that the CAST will work is IS INSTANCE OF. The IS INSTANCE OF predicate condition checks whether the operand is an instance of the specified class or interface. This is useful when you want to perform a downcast, which is a conversion from a more general type to a more specific type. A downcast can fail if the operand is not an instance of the target type, and this can cause a runtime error.Therefore, you can use the IS INSTANCE OF predicate condition to check whether the downcast is possible before using the CAST operator12. For example:

The following code snippet uses the IS INSTANCE OF predicate condition to check whether the variable g_super is an instance of the class lcl_super. If it is, the CAST will work and the variable g_sub1 will be assigned the value of g_super.

DATA: g_super TYPE REF TO lcl_super, g_sub1 TYPE REF TO lcl_sub1. IF g_super IS INSTANCE OF lcl_super. g_sub1 = CAST #( g_super ). g_sub1->method( ... ). ENDIF.

You cannot do any of the following:

IS SUPPLIED: The IS SUPPLIED predicate condition checks whether an optional parameter of a method or a function module has been supplied by the caller. This is useful when you want to handle different cases depending on whether the parameter has a value or not.However, this predicate condition has nothing to do with the CAST operator or the type of the operand12.

IS NOT INITIAL: The IS NOT INITIAL predicate condition checks whether the operand has a non-initial value. This is useful when you want to check whether the operand has been assigned a value or not.However, this predicate condition does not guarantee that the CAST will work, because the operand may have a value but not be an instance of the target type12.

IS BOUND: The IS BOUND predicate condition checks whether the operand is a bound reference variable. This is useful when you want to check whether the operand points to an existing object or not.However, this predicate condition does not guarantee that the CAST will work, because the operand may point to an object but not be an instance of the target type12.


Question 7

Using ABAP SQL, which select statement selects the mat field on line #17?



Answer : B

Using ABAP SQL, the select statement that selects the mat field on line #17 is:

SELECT mat FROM demo_sales_cds_so_i_ve...

This statement selects the mat field from the CDS view demo_sales_cds_so_i_ve, which is defined on line #1. The CDS view demo_sales_cds_so_i_ve is a projection view that projects the fields of the CDS view demo_sales_cds_so_i, which is defined on line #2. The CDS view demo_sales_cds_so_i is a join view that joins the fields of the database table demo_sales_so_i, which is defined on line #3, and the CDS view demo_sales_cds_material_ve, which is defined on line #4. The CDS view demo_sales_cds_material_ve is a value help view that provides value help for the material field of the database table demo_sales_so_i.The mat field is an alias for the material field of the database table demo_sales_so_i, which is defined on line #91.

The other options are not valid because:

A . SELECT mat FROM Material... is not valid because Material is not a valid data source in the given code. There is no CDS view or database table named Material.

C . SELECT mat FROM demo_sales_so_i... is not valid because demo_sales_so_i is not a valid data source in the given code. There is no CDS view named demo_sales_so_i, only a database table. To access a database table, the keyword TABLE must be used, such as SELECT mat FROM TABLE demo_sales_so_i...

D . SELECT mat FROM demo sales cds material ve... is not valid because demo sales cds material ve is not a valid data source in the given code. There is no CDS view or database table named demo sales cds material ve. The correct name of the CDS view is demo_sales_cds_material_ve, with underscores instead of spaces.


Page:    1 / 14   
Total 81 questions