Exam4Training

SAP C_ABAPD_2309 SAP Certified Associate – Back-End Developer – ABAP Cloud Online Training

Question #1

Which function call returns 0?

  • A . Count_any_of ( val – ‘ABAP ABAP abap’ sub "AB" )
  • B . Count (val – ‘ABAP ABAP abap’ sub – ‘AB’ )
  • C . find_any_of (val = "ABAP ABAP abap’ sub = "AB")
  • D . find_any_not_of( val ‘ABAP ABAP abap’ sub = ‘AB’)

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

The function find_any_not_of returns the position of the first character in the string val that is not contained in the string sub. If no such character is found, the function returns 0. In this case, the string val contains only the characters A, B, and a, which are all contained in the string sub, so the function returns 0. The other functions return positive values, as follows:

Count_any_of returns the number of occurrences of any character in the string sub within the string val. In this case, it returns 8, since there are 8 A’s and B’s in val.

Count returns the number of occurrences of the string sub within the string val. In this case, it returns 2, since there are 2 AB’s in val.

find_any_of returns the position of the first character in the string val that is contained in the string sub. In this case, it returns 1, since the first character A is in sub.

Reference: String Functions – ABAP Keyword Documentation, Examples of String Functions – ABAP Keyword Documentation

Question #2

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

Reveal Solution Hide Solution

Correct Answer: BD
BD

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.

Question #3

Which RESTful Application Programming object can be used to organize the display of fields in an app?

  • A . Data model view
  • B . Metadata extension
  • C . Service definition
  • D . Projection view

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

A metadata extension is a RESTful Application Programming object that can be used to organize the display of fields in an app. A metadata extension is a CDS view that annotates another CDS view with UI annotations, such as labels, icons, or facets. These annotations define how the data should be presented in the app, such as which fields should be shown on the object page, which fields should be editable, or which fields should be used for filtering or sorting. A metadata extension can also be used to add custom actions or validations to the app12.

Reference: 1: Refine the Object Page with Annotations | SAP Tutorials 2: ABAP RAP : Enabling custom actions with a dialog for additional input fields | SAP Blogs

Question #4

Refer to Exhibit.

When accessing the subclass instance through go_super, what can you do? Note: There are 2 correct answers to this question.

  • A . Access the inherited private components.
  • B . Access the inherited public components.
  • C . Call a subclass specific public method
  • D . Call inherited public redefined methods.

Reveal Solution Hide Solution

Correct Answer: BD
BD

Explanation:

In object-oriented programming (OOP), particularly in ABAP OOP, when you have a reference to a superclass and you’re working with an instance of a subclass, here’s what you can do:

Access the inherited public components – This is correct. You can always access public components of the superclass through a reference to the superclass, even if the actual object is an instance of a subclass.

Call inherited public redefined methods – This is also correct. If the subclass has redefined a method that was public in the superclass, and you call this method through a reference of the superclass type, the redefined version in the subclass will be executed. This is known as polymorphism.

Question #5

Given the following code in an SAP S/4HANA Cloud private edition tenant:

The class zcl_demo_class is in a software component with the language version set to "ABAP Cloud". The function module ZF1′ is in a different software component with the language version set to "Standard ABAP". Both the class and function module are customer created.

Regarding line #6, which of the following are valid statements? Note: There are 2 correct answers to this question.

  • A . ZF1′ can be called only if it is released for cloud development.
  • B . ‘ZF1’ can be called if a wrapper is created for it and the wrapper itself is released for cloud development.
  • C . "ZF1" can be called whether it is released or not for cloud development
  • D . ZF1" can be called if a wrapper is created for it but the wrapper itself is not released for cloud development.

Reveal Solution Hide Solution

Correct Answer: AB
AB

Explanation:

The ABAP Cloud Development Model requires that only public SAP APIs and extension points are used 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 an ABAP Cloud class is not allowed and will result in a syntax error. However, there are two possible ways to call a function module indirectly from an ABAP Cloud class:

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 “Standard ABAP” and must be marked as released for cloud development using the annotation @EndUserText.label. The wrapper can then be called from an ABAP Cloud class using the public methods or attributes2.

Use the ABAP Cloud Connector to call the function module as a remote function call (RFC) from an

ABAP Cloud class. The ABAP Cloud Connector is a service that enables the secure and reliable

communication between SAP BTP, ABAP environment and on-premise systems. The function module

must be exposed as an RFC-enabled function module in the on-premise system and must be

registered in the ABAP Cloud Connector. The ABAP Cloud class can then use the class

cl_rfc_destination_service to get the destination name and the class cl_abap_system to create a

proxy object for the function module. The proxy object can then be used to call the function

module3.

Reference: 1: SAP API Business Hub 2: Creating an ABAP Cloud Project | SAP Help Portal 3: Calling Remote Function Modules | SAP Help Portal

Question #6

Which restrictions exist for ABAP SQL arithmetic expressions? Note: There are 2 correct answers to this question.

  • A . Floating point types and integer types can NOT be used in the same expression.
  • B . The operator/is allowed only in floating point expressions.
  • C . Decimal types and integer types can NOT be used in the same expression.
  • D . The operator is allowed only in floating point expressions.

Reveal Solution Hide Solution

Correct Answer: BD
BD

Explanation:

ABAP SQL arithmetic expressions have different restrictions depending on the data type of the operands. The following are some of the restrictions:

Floating point types and integer types can be used in the same expression, as long as the integer types are cast to floating point types using the cast function. For example, CAST ( num1 AS FLTP ) / CAST ( num2 AS FLTP ) is a valid expression, where num1 and num2 are integer types.

The operator / is allowed only in floating point expressions, where both operands have the type FLTP or f. For example, num1 / num2 is a valid expression, where num1 and num2 are floating point types. If the operator / is used in an integer expression or a decimal expression, a syntax error occurs.

Decimal types and integer types can be used in the same expression, as long as the expression is a decimal expression. A decimal expression has at least one operand with the type DEC, CURR, or QUAN or p with decimal places. For example, num1 + num2 is a valid expression, where num1 is a decimal type and num2 is an integer type.

The operator ** is allowed only in floating point expressions, where both operands have the type FLTP or f. For example, num1 ** num2 is a valid expression, where num1 and num2 are floating point types. If the operator ** is used in an integer expression or a decimal expression, a syntax error occurs.

Reference: sql_exp – sql_arith – ABAP Keyword Documentation, SQL Expressions, Arithmetic Calculations – ABAP Keyword Documentation

Question #7

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

  • A . ##NEEDED is checked by the syntax checker.
  • B . The pragma is not checked by the syntax checker.
  • C . #EC_NEEDED is not checked by the syntax checker.
  • D . The pseudo-comment is checked by the syntax checker

Reveal Solution Hide Solution

Correct Answer: AB
AB

Explanation:

Both statements are valid in ABAP, but they have different effects on the program.

##NEEDED is a pragma that can be used to hide warnings from the ABAP compiler syntax check. It tells the check tools that a variable or a parameter is needed for further processing, even if it is not used in the current statement. For example, if you declare a variable without assigning any value to it, you can use ##NEEDED to suppress the warning about unused variables12.

The pragma is not checked by the syntax checker means that you can use any pragma to hide any warning from the ABAP compiler syntax check, regardless of its effect on the program logic or performance. For example, if you use ##SHADOW to hide a warning about an obscured function, you can also use it to hide a warning about an invalid character in a string12. You cannot do any of the following:

#EC_NEEDED is not checked by the syntax checker: This is not a valid statement in ABAP. There is no pseudo-comment with #EC_NEEDED in ABAP3.

The pseudo-comment is checked by the syntax checker: This is false. Pseudo-comments are obsolete and should no longer be used in ABAP. They were replaced by pragmas since SAP NW 7.0 EhP2 (Enhancement Package)4.

Reference: 1: Pragmas – ABAP Keyword Documentation – SAP Online Help 2: [What are pragmas and

pseudo comments in ABAP? | SAP Blogs – SAP Community] 3: ABAP Keyword Documentation – SAP

Online Help 4: What are PRAGMAS and Pseudo comments in SAP ABAP

Question #8

Which internal table type allows unique and non-unique keys?

  • A . Sorted
  • B . Hashed
  • C . Standard

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

Sorted – Sorted internal tables in ABAP allow for both unique and non-unique keys. When defining a sorted table, you can specify whether the key should be unique or non-unique.

Hashed – Hashed internal tables only allow for unique keys. Each entry in a hashed table must be unique with respect to the hash key used.

Standard – Standard tables allow for non-unique keys and do not have any inherent sorting order. You can have multiple entries with the same key values.

Question #8

Which internal table type allows unique and non-unique keys?

  • A . Sorted
  • B . Hashed
  • C . Standard

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

Sorted – Sorted internal tables in ABAP allow for both unique and non-unique keys. When defining a sorted table, you can specify whether the key should be unique or non-unique.

Hashed – Hashed internal tables only allow for unique keys. Each entry in a hashed table must be unique with respect to the hash key used.

Standard – Standard tables allow for non-unique keys and do not have any inherent sorting order. You can have multiple entries with the same key values.

Question #8

Which internal table type allows unique and non-unique keys?

  • A . Sorted
  • B . Hashed
  • C . Standard

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

Sorted – Sorted internal tables in ABAP allow for both unique and non-unique keys. When defining a sorted table, you can specify whether the key should be unique or non-unique.

Hashed – Hashed internal tables only allow for unique keys. Each entry in a hashed table must be unique with respect to the hash key used.

Standard – Standard tables allow for non-unique keys and do not have any inherent sorting order. You can have multiple entries with the same key values.

Question #8

Which internal table type allows unique and non-unique keys?

  • A . Sorted
  • B . Hashed
  • C . Standard

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

Sorted – Sorted internal tables in ABAP allow for both unique and non-unique keys. When defining a sorted table, you can specify whether the key should be unique or non-unique.

Hashed – Hashed internal tables only allow for unique keys. Each entry in a hashed table must be unique with respect to the hash key used.

Standard – Standard tables allow for non-unique keys and do not have any inherent sorting order. You can have multiple entries with the same key values.

Question #8

Which internal table type allows unique and non-unique keys?

  • A . Sorted
  • B . Hashed
  • C . Standard

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

Sorted – Sorted internal tables in ABAP allow for both unique and non-unique keys. When defining a sorted table, you can specify whether the key should be unique or non-unique.

Hashed – Hashed internal tables only allow for unique keys. Each entry in a hashed table must be unique with respect to the hash key used.

Standard – Standard tables allow for non-unique keys and do not have any inherent sorting order. You can have multiple entries with the same key values.

Question #8

Which internal table type allows unique and non-unique keys?

  • A . Sorted
  • B . Hashed
  • C . Standard

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

Sorted – Sorted internal tables in ABAP allow for both unique and non-unique keys. When defining a sorted table, you can specify whether the key should be unique or non-unique.

Hashed – Hashed internal tables only allow for unique keys. Each entry in a hashed table must be unique with respect to the hash key used.

Standard – Standard tables allow for non-unique keys and do not have any inherent sorting order. You can have multiple entries with the same key values.

Question #8

Which internal table type allows unique and non-unique keys?

  • A . Sorted
  • B . Hashed
  • C . Standard

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

Sorted – Sorted internal tables in ABAP allow for both unique and non-unique keys. When defining a sorted table, you can specify whether the key should be unique or non-unique.

Hashed – Hashed internal tables only allow for unique keys. Each entry in a hashed table must be unique with respect to the hash key used.

Standard – Standard tables allow for non-unique keys and do not have any inherent sorting order. You can have multiple entries with the same key values.

Question #8

Which internal table type allows unique and non-unique keys?

  • A . Sorted
  • B . Hashed
  • C . Standard

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

Sorted – Sorted internal tables in ABAP allow for both unique and non-unique keys. When defining a sorted table, you can specify whether the key should be unique or non-unique.

Hashed – Hashed internal tables only allow for unique keys. Each entry in a hashed table must be unique with respect to the hash key used.

Standard – Standard tables allow for non-unique keys and do not have any inherent sorting order. You can have multiple entries with the same key values.

Question #8

Which internal table type allows unique and non-unique keys?

  • A . Sorted
  • B . Hashed
  • C . Standard

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

Sorted – Sorted internal tables in ABAP allow for both unique and non-unique keys. When defining a sorted table, you can specify whether the key should be unique or non-unique.

Hashed – Hashed internal tables only allow for unique keys. Each entry in a hashed table must be unique with respect to the hash key used.

Standard – Standard tables allow for non-unique keys and do not have any inherent sorting order. You can have multiple entries with the same key values.

Question #17

b is joined with c

Reveal Solution Hide Solution

Correct Answer: A

Explanation:

SQL JOIN operations are typically evaluated based on the sequence they are written in the query, from top to bottom. Given the structure of the SQL statement in the exhibit and standard SQL evaluation rules, here is the logical evaluation of the joins:

From the left to the right in the order of the tables:

a is joined with b

The result of a JOIN b is then joined with c

This is the correct sequence because the ON clauses define how the joins should be processed. The first ON clause associates table c with b, and the second ON clause associates table b with a. The LEFT OUTER JOIN operation indicates that all records from the left table (a, and then b in the first join) are returned, along with the matched records from the right table (b, and then c in the second join). If there is no match, the result is NULL on the side of the table where there is no match.

Question #18

Which extensibility type does SAP recommend you use to enhance the existing UI for an SAP Fiori app?

  • A . Key user
  • B . Classic
  • C . Side-by-side
  • D . Developer

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

SAP recommends different extensibility types for enhancing the UI of an SAP Fiori app based on the specific needs and the environment in which the app is running. Among the provided options:

Key user – This type of extensibility is typically recommended for business users or key users who need to make layout changes or adaptations without writing code. It uses in-app extensibility tools.

Classic – This term is not commonly used in the context of SAP Fiori extensibility. It may refer to more traditional methods of customization within the SAP GUI environment, not Fiori.

Side-by-side – This is recommended when you want to extend the functionality of an SAP Fiori app without modifying the backend SAP S/4HANA system. Extensions are built on SAP BTP (Business Technology Platform) and integrate with the existing app.

Developer – This extensibility is for developers who need to create more complex enhancements that require coding. It might involve both backend and frontend development and is often done in the development system with a subsequent transport to the production system.

Question #19

Image:

In the following ABAP SQL code, what are valid case distinctions? Note: There are 2 correct answers

to this question.

A)

B)

C)

D)

  • A . Option A
  • B . Option B
  • C . Option C
  • D . Option D

Reveal Solution Hide Solution

Correct Answer: AB
AB

Explanation:

Question #20

What are some features of a unique secondary key? Note: There are 2 correct answers to this question.

  • A . It is created when a table is filled.
  • B . It is updated when the modified table is read again.
  • C . It is created with the first read access of a table.
  • D . It is updated when the table is modified.

Reveal Solution Hide Solution

Correct Answer: CD
CD

Explanation:

A unique secondary key is a type of secondary key that ensures that the key combination of all the rows in a table is unique. A unique secondary key has two purposes: firstly, to speed up access to the table, and secondly, to enforce data integrity1.

It is created with the first read access of a table: This is true. A unique secondary key is created when an internal table is filled for the first time using the statement READ TABLE or a similar statement. The system assigns a name and an index to each row of the table based on the key fields23.

It is updated when the modified table is read again: This is false. A unique secondary key does not need to be updated when the internal table content changes, because it already ensures data uniqueness. The system uses a lazy update strategy for non-unique secondary keys, which means that it delays updating them until they are actually accessed23. You cannot do any of the following:

It is created when a table is filled: This is false. As explained above, a unique secondary key is created only with the first read access of a table23.

It is updated when the modified table is read again: This is false. As explained above, a unique secondary key does not need to be updated when the internal table content changes23.

Reference: 1: Improving Internal Table Performance Using Secondary Keys – SAP Learning 2: [Secondary Key – ABAP Keyword Documentation – SAP Online Help] 3: [Secondary Table Key – ABAP

Keyword Documentation – SAP Online Help]

Question #21

Refer to the exhibit.

Which of the following types are permitted to be used for <source> on line #4? Note: There are 2 correct answers to this question.

  • A . A database table from the ABAP Dictionary
  • B . A CDS DDIC-based view
  • C . An external view from the ABAP Dictionary
  • D . A database view from the ABAP Dictionary

Reveal Solution Hide Solution

Correct Answer: AB
AB

Explanation:

The <source> clause in the CDS View Entity Data Definition can be used to specify the data source for the view entity. The <source> clause can accept different types of data sources, depending on the type of the view entity1.

A database table from the ABAP Dictionary: This is a valid type of data source for a CDS View Entity Data Definition. A database table from the ABAP Dictionary is a table that is defined in the ABAP Dictionary using the keyword TABLE or TABLE OF. The name of the database table must be unique within its namespace and must not contain any special characters2.

A CDS DDIC-based view: This is also a valid type of data source for a CDS View Entity Data Definition.

A CDS DDIC-based view is a view that is defined in the Core Data Services using the keyword DEFINE

VIEW ENTITY. The name of the CDS DDIC-based view must be unique within its namespace and must

not contain any special characters3.

You cannot do any of the following:

An external view from the ABAP Dictionary: This is not a valid type of data source for a CDS View Entity Data Definition. An external view from the ABAP Dictionary is a view that is defined in an

external application using any language supported by SAP, such as SQL, PL/SQL, or Java. The name of the external view must be unique within its namespace and must not contain any special characters4.

A database view from the ABAP Dictionary: This is not a valid type of data source for a CDS View Entity Data Definition. A database view from the ABAP Dictionary is a view that is defined in an external application using any language supported by SAP, such as SQL, PL/SQL, or Java. The name of the database view must be unique within its namespace and must not contain any special characters4.

Reference: 1: CDS DDL – DEFINE VIEW ENTITY – ABAP Keyword Documentation – SAP Online Help 2:

ABAP Dictionary Tables – SAP Online Help 3: CDS DDL – DEFINE VIEW ENTITY – ABAP Keyword

Documentation – SAP Online Help 4: ABAP Dictionary Views – SAP Online Help

Question #22

When processing a loop with the statement DO… ENDDO, what system variable contains the implicit loop counter?

  • A . sy-linno
  • B . sy-labix
  • C . sy-subrc
  • D . sy-index

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

When processing a loop with the statement DO… ENDDO, the system variable that contains the implicit loop counter is sy-index. The loop counter is a numeric value that indicates how many times the loop has been executed. The loop counter is initialized to 1 before the first execution of the loop and is incremented by 1 after each execution. The loop counter can be used to control the number of loop iterations or to access the loop elements by index. The loop counter can also be accessed or modified within the loop body, but this is not recommended as it may cause unexpected results or errors1.

For example, the following code snippet uses the loop counter sy-index to display the numbers from 1 to 10:

DO 10 TIMES. WRITE: / sy-index. ENDDO.

The output of this code is:

12345678910

Reference: 1: DO – ABAP Keyword Documentation

Question #23

Which patterns raise an exception? Note: There are 3 correct answers to this question.

  • A . DATA: gv_target TYPE p DECIMALS 2. CONSTANTS: go intl TYPE i VALUE 3. gv_target -U EXACT (2 gcojntl).
  • B . DATA: gv_target TYPE string. □ CONSTANTS: gco_string TYPE LENGTH 16 VALUE 0123456789ABCDEF*. gv_target = EXACT # gco_string+5 (5) ).
  • C . DATA: gv_target TYPE c LENGTH 5. V □ CONSTANTS: ECO string TYPE string VALUE 0123456789ABCDEF". gv_target – EXACT (gco_string + 5 (6) ).
  • D . DATA: Ev target TYPE p DECIMALS 3. CONSTANTS: gcojntl TYPE i VALUE 2. Ev_target -U EXACT #2 / gcojntl ).
  • E . DATA: gv_target TYPE d. s/ □ CONSTANTS: gco_date TYPE d VALUE ‘20331233*. gv_target EXACT ( geo_date).

Reveal Solution Hide Solution

Correct Answer: A, C, E
A, C, E

Explanation:

The patterns that raise an exception are those that use the constructor operator EXACT to perform a lossless assignment or calculation, but the result cannot be converted to the target data type without data loss.

The following are the explanations for each pattern:

A: This pattern raises the exception CX_SY_CONVERSION_LOST because the result of the calculation 2 * 3 is 6, which cannot be assigned to a packed number with two decimal places without losing the integer part. The operator -U is used to perform a lossless calculation with the calculation type decfloat34.

B: This pattern does not raise an exception because the result of the substring expression

gco_string+5(5) is ‘6789A’, which can be assigned to a string without data loss. The operator EXACT # is used to perform a lossless assignment with the data type of the argument.

C: This pattern raises the exception CX_SY_CONVERSION_LOST because the result of the substring expression gco_string+5(6) is ‘6789AB’, which cannot be assigned to a character field with length 5 without losing the last character. The operator EXACT is used to perform a lossless assignment with the data type of the target field.

D: This pattern does not raise an exception because the result of the calculation 2 / 2 is 1, which can be assigned to a packed number with three decimal places without data loss. The operator -U is used to perform a lossless calculation with the calculation type decfloat34.

E: This pattern raises the exception CX_SY_CONVERSION_ERROR because the constant gco_date contains an invalid value ‘20331233’ for a date data type, which cannot be converted to a valid date. The operator EXACT is used to perform a lossless assignment with the data type of the target field.

Reference: EXACT – Lossless Operator – ABAP Keyword Documentation, Lossless Assignments – ABAP Keyword Documentation

Question #24

Which field is defined incorrectly?

  • A . field1
  • B . field3
  • C . field4
  • D . field2

Reveal Solution Hide Solution

Correct Answer: C
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

Question #25

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.

Reveal Solution Hide Solution

Correct Answer: B
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

Question #26

Which of the following are features of Core Data Services? Note: There are 3 correct answers to this question.

  • A . Inheritance
  • B . Associations
  • C . Annotations
  • D . Delegation
  • E . Structured Query Language (SQL)

Reveal Solution Hide Solution

Correct Answer: BCE
BCE

Explanation:

Core Data Services (CDS) is a framework for defining and consuming semantically rich data models in SAP HANA. CDS supports various features that enhance the capabilities of SQL and enable developers to create data models that are optimized for performance, readability, and extensibility12. Some of the features of CDS are:

Associations: Associations are a way of defining relationships between CDS entities, such as tables or views. Associations enable navigation and path expressions in CDS queries, which allow accessing data from related entities without explicit joins. Associations also support cardinality, referential constraints, and cascading options34.

Annotations: Annotations are a way of adding metadata to CDS entities or their elements, such as fields or parameters. Annotations provide additional information or instructions for the CDS compiler, the database, or the consumers of the CDS views. Annotations can be used for various purposes, such as defining access control, UI rendering, OData exposure, or search capabilities5 . Structured Query Language (SQL): SQL is the standard language for querying and manipulating data in relational databases. CDS is based on SQL and extends it with additional features and syntax. CDS supports SQL features such as joins, aggregations, filters, expressions, functions, and subqueries. CDS also supports SQL Script, which is a scripting language for stored procedures and functions in SAP HANA .

You cannot do any of the following:

Inheritance: Inheritance is not a feature of CDS. Inheritance is a concept in object-oriented programming that allows a class to inherit the properties and methods of another class. CDS does not support object-oriented programming or classes.

Delegation: Delegation is not a feature of CDS. Delegation is a concept in object-oriented programming that allows an object to delegate some of its responsibilities to another object. CDS does not support object-oriented programming or objects.

Reference: 1: Core Data Services (CDS) | CAPire 2: Core Data Services [CDS] in SAP S/4 HANA | SAP

Blogs 3: Associations in Core Data Services (CDS) | SAP Help Portal 4: [CDS DDL – Association – ABAP

Keyword Documentation – SAP Online Help] 5: [Annotations in Core Data Services (CDS) | SAP Help

Portal] : [CDS DDL – Annotation – ABAP Keyword Documentation – SAP Online Help] : [Structured

Query Language (SQL) | SAP Help Portal] : [CDS DDL – SQL Features – ABAP Keyword Documentation –

SAP Online Help] : [Object-Oriented Programming in ABAP | SAP Help Portal]

Question #27

What is the purpose of a foreign key relationship between two tables in the ABAP Dictionary?

  • A . To document the relationship between the two tables
  • B . To ensure the integrity of data in the corresponding database tables
  • C . To create a corresponding foreign key relationship in the database

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

The purpose of a foreign key relationship between two tables in the ABAP Dictionary is to ensure the

integrity of data in the corresponding database tables. A foreign key relationship defines a logical link between a foreign key table and a check table, where the foreign key fields of the former are assigned to the primary key fields of the latter. This means that the values entered in the foreign key fields must exist in the check table, otherwise the system will reject the entry. This way, the foreign key relationship prevents the insertion of invalid or inconsistent data in the database tables.

A foreign key relationship also serves to document the relationship between the two tables in the ABAP Dictionary, but this is not its primary purpose. A foreign key relationship does not necessarily create a corresponding foreign key relationship in the database, as this depends on the database system and the settings of the ABAP Dictionary. Some database systems do not support foreign keys at all, while others require additional steps to activate them. Therefore, the foreign key relationship in the ABAP Dictionary is mainly a logical concept that is enforced by the ABAP runtime environment.

Reference: Foreign Keys (SAP Library – ABAP Dictionary), Foreign Keys (SAP Library – BC – ABAP Dictionary)

https://help.sap.com/doc/saphelp_snc70/7.0/en-US/cf/21ea77446011d189700000e8322d00/content.htm

Question #28

When does SAP recommend to use a sorted or a hashed table respectively? Note: There are 2 correct answers to this question.

  • A . A hashed table, when you read a single record and specify the complete key.
  • B . A hashed table, when you read a subset in a loop and specify a part of the key from the left without gaps.
  • C . A sorted table, when you read a subset in a loop and specify a part of the key from the left ^ without gaps.
  • D . A sorted table, when you read a single record and specify non key fields.

Reveal Solution Hide Solution

Correct Answer: A, C
A, C

Explanation:

SAP recommends using different types of internal tables based on the operation and access pattern to optimize performance:

A hashed table, when you read a single record and specify the complete key – This is correct. Hashed tables are optimized for single-record access where the entire key is specified. They offer the fastest access time for such operations because the hash algorithm computes the storage location of the record directly from the key.

A sorted table, when you read a subset in a loop and specify a part of the key from the left without gaps – This is correct. Sorted tables are optimized for binary search when part of the key is specified, as long as it is from the leftmost part of the key and without gaps.

Question #29

Class super has subclass sub.

Which rules are valid for the sub constructor? Note: There are 2 correct answers to this question.

  • A . The method signature can be changed.
  • B . Import parameters can only be evaluated after calling the constructor of super.
  • C . The constructor of super must be called before using any components of your own instance.
  • D . Events of your own instance cannot be raised before the registration of a handler in super.

Reveal Solution Hide Solution

Correct Answer: BC
BC

Explanation:

In object-oriented programming, when dealing with constructors in a class hierarchy, there are specific rules that apply to ensure proper initialization of each object in the inheritance chain. Here are the rules that are valid for the constructor of subclass sub which inherits from super:

Import parameters can only be evaluated after calling the constructor of super – This is correct. The constructor of the superclass (super) should be called before you do anything with the parameters specific to the subclass (sub), as the superclass may perform initializations that the subclass might depend on.

The constructor of super must be called before using any components of your own instance – This is correct. In many object-oriented languages, including ABAP, the superclass constructor is implicitly or explicitly called before the subclass’s constructor logic is executed. This ensures that the superclass is properly initialized before the subclass tries to use any of its components or functionality.

Question #30

In an Access Control Object, which clauses are used? Note: There are 3 correct answers to this question.

  • A . Where (to specify the access conditions)
  • B . Crant (to identify the data source)
  • C . Return code (to assign the return code of the authority check)
  • D . Define role (to specify the role name)
  • E . Revoke (to remove access to the data source)

Reveal Solution Hide Solution

Correct Answer: A, D, E
A, D, E

Explanation:

An Access Control Object (ACO) is a CDS annotation that defines the access control rules for a CDS view entity. An ACO consists of one or more clauses that specify the role name, the data source, the access conditions, and the return code of the authority check12.

Some of the clauses that are used in an ACO are:

Where (to specify the access conditions): This clause is used to define the logical expression that

determines whether a user has access to the data source or not. The expression can use the fields of

the data source, the parameters of the CDS view entity, or the predefined variables $user and

$session. The expression can also use the functions check_authorization and check_role to perform

additional authority checks12.

Define role (to specify the role name): This clause is used to assign a name to the role that is defined by the ACO. The role name must be unique within the namespace of the CDS view entity and must not contain any special characters. The role name can be used to reference the ACO in other annotations, such as @AccessControl.authorizationCheck or @AccessControl.grant12.

Revoke (to remove access to the data source): This clause is used to explicitly deny access to the data source for a user who meets the conditions of the where clause. The revoke clause overrides any grant clause that might grant access to the same user. The revoke clause can be used to implement the principle of least privilege or to enforce data segregation12.

You cannot do any of the following:

Grant (to identify the data source): This is not a valid clause in an ACO. The grant clause is a separate annotation that is used to grant access to a CDS view entity or a data source for a user who has a specific role. The grant clause can reference an ACO by its role name to apply the access conditions defined by the ACO12.

Return code (to assign the return code of the authority check): This is not a valid clause in an ACO. The return code of the authority check is a predefined variable that is set by the system after performing the access control check. The return code can be used in the where clause of the ACO to specify different access conditions based on the outcome of the check12.

Reference: 1: Access Control Objects – ABAP Keyword Documentation – SAP Online Help 2: Access Control in Core Data Services (CDS) | SAP Help Portal

Question #31

What are some of the reasons that Core Data Services are preferable to the classical approach to data modeling? Note: There are 2 correct answers to this question.

  • A . They implement code pushdown.
  • B . They avoid data transfer completely.
  • C . They transfer computational results to the application server.
  • D . They compute results on the application server.

Reveal Solution Hide Solution

Correct Answer: A, C
A, C

Explanation:

Core Data Services (CDS) are preferable to the classical approach to data modeling for several reasons, but two of them are:

They implement code pushdown. Code pushdown is the principle of moving data-intensive logic from the application server to the database server, where the data resides. This reduces the data transfer between the application server and the database server, which improves the performance and scalability of the application. CDS enable code pushdown by allowing the definition of semantic data models and business logic in the database layer, using SQL and SQL-based expressions1.

They transfer computational results to the application server. CDS allow the application server to access the data and the logic defined in the database layer by using Open SQL statements. Open SQL is a standardized and simplified subset of SQL that can be used across different database platforms. Open SQL statements are translated into native SQL statements by the ABAP runtime environment and executed on the database server. The results of the computation are then transferred to the application server, where they can be further processed or displayed2.

Reference: 1: ABAP – Core Data Services (ABAP CDS) – ABAP Keyword Documentation 2: Open SQL – ABAP Keyword Documentation

Question #32

Exhibit:

Which of the following statements are correct? Note: There are 2 correct answers to this question.

  • A . FOR defines a loop that runs over the content of source_itab
  • B . source_itab is only visible within the loop.
  • C . row is a predefined name and cannot be chosen arbitrarily.
  • D . row is only visible within the loop.

Reveal Solution Hide Solution

Correct Answer: A, D
A, D

Explanation:

The code snippet in the image is an example of using the FOR statement to create an internal table with a constructor expression. The FOR statement introduces an iteration expression that runs over the content of source_itab and assigns each row to the variable row. The variable row is then used to populate the fields of target_itab12. Some of the correct statements about the code snippet are: FOR defines a loop that runs over the content of source_itab: This is true. The FOR statement iterates over the rows of source_itab and assigns each row to the variable row. The iteration expression can also specify a range or a condition for the loop12.

row is only visible within the loop: This is true. The variable row is a local variable that is only visible within the scope of the iteration expression. It cannot be accessed outside the loop12. You cannot do any of the following:

source_itab is only visible within the loop: This is false. The variable source_itab is not a local variable that is defined by the FOR statement. It is an existing internal table that is used as the data source for the iteration expression. It can be accessed outside the loop12.

row is a predefined name and cannot be chosen arbitrarily: This is false. The variable row is not a predefined name that is reserved by the FOR statement. It is a user-defined name that can be chosen arbitrarily. However, it must not conflict with any existing names in the program12.

Reference: 1: FOR – Iteration Expressions – ABAP Keyword Documentation – SAP Online Help 2: ABAP 7.4 Syntax – FOR Loop iteration | SAP Community

Question #33

Which of the following ABAP SQL statements are valid? Note: There are 2 correct answers to this question.

  • A . SELECT FROM /dmo/connection FIELDS carrid O airpfrom,
    MAX(distance) AS dist_max, MIN( distance) AS dist_min GROUP BY carrid, airpfrom INTO TABLE @DATA(It_hits)
  • B . SELECT FROM /dmo/connection FIELDS / O carrid, airpfrom,
    MAX( distance) AS dist_max, MIN(distance) AS dist_min INTO TABLE @DATA(It_hits)
  • C . SELECT FROM /dmo/connection FIELDS V D MAX(distance) AS dist_max
    MIN(distance) AS dist_min INTO TABLE @DATA(It_hits).
  • D . SELECT FROM /dmo/connection FIELDS r―i carrid, airpfrom u GROUP BY carrid, connid INTO TABLE @DATA(It_hits).

Reveal Solution Hide Solution

Correct Answer: AC
AC

Explanation:

In ABAP SQL, to write valid SELECT statements that aggregate data and use GROUP BY clauses, you need to follow the syntax rules for SELECT statements, including the proper use of GROUP BY and aggregate functions. Analyzing the options given:

This statement is using FIELDS followed by a group of fields and aggregate functions (MAX and MIN), and then uses GROUP BY for the non-aggregate fields. This syntax is generally correct for ABAP SQL as long as the fields listed in the GROUP BY clause match the non-aggregated fields in the SELECT list.

This statement seems to contain typos or incorrect characters ("/ O" and "/ O"), making it invalid syntax.

This statement appears to be missing a comma between the aggregate function calls for MAX and MIN. Otherwise, it might be valid if properly formatted with the right fields and a proper GROUP BY clause.

This statement has a mix of characters that do not form a valid ABAP SQL statement ("r―i" seems to be a typo or formatting error).

Based on standard ABAP SQL syntax, the valid SELECT statements from the options provided, assuming the proper correction of typos and formatting, would likely be:

SELECT FROM /dmo/connection FIELDS carrid, airpfrom, MAX(distance) AS dist_max, MIN(distance) AS dist_min GROUP BY carrid, airpfrom INTO TABLE @DATA(It_hits)

With the correct syntax and assuming no other typos or context-specific issues, option A would be a valid statement. However, because of the potential for typographical errors in the other options, it is difficult to definitively choose a second valid statement without further clarification or correction. If option C had a comma added between the aggregate functions, it could be considered a potentially valid statement:

SELECT FROM /dmo/connection FIELDS MAX(distance) AS dist_max, MIN(distance) AS dist_min INTO TABLE @DATA(It_hits).

Question #34

In ABAP SQL, which of the following retrieves the association field_Airline-Name of a CDS view?

  • A . _Airline-Name
  • B . /_Airline Name
  • C . @_Airline-Name
  • D . "_Airline Name

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

In ABAP SQL, the syntax to retrieve the association field of a CDS view is to use the @ sign followed by the association name and the field name, separated by a period sign (.). For example, to retrieve the association field _Airline-Name of a CDS view, the syntax is @_Airline.Name. This syntax allows the access to the fields of the target data source of the association without explicitly joining the data sources1. The other options are incorrect because they use the wrong symbols or formats to access the association field.

Reference: 1: Path Expressions – ABAP Keyword Documentation

Question #35

Refer to the exhibit.

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

  • A . "zcxl" is a dictionary structure, and "paraml" and "param2" are this structure.
  • B . "paraml11 and "param2" are predefined names.
  • C . The code creates an exception object and raises an exception.
  • D . "previous" expects the reference to a previous exception

Reveal Solution Hide Solution

Correct Answer: CD
CD

Explanation:

The code snippet in the image is an example of using the RAISE EXCEPTION statement to raise a class-based exception and create a corresponding exception object. The code snippet also uses the EXPORTING addition to pass parameters to the instance constructor of the exception class12. Some of the valid statements about the code snippet are:

The code creates an exception object and raises an exception: This is true. The RAISE EXCEPTION statement raises the exception linked to the exception class zcxl and generates a corresponding exception object. The exception object contains the information about the exception, such as the message, the source position, and the previous exception12.

“previous” expects the reference to a previous exception: This is true. The previous parameter is a predefined parameter of the instance constructor of the exception class cx_root, which is the root class of all class-based exceptions. The previous parameter expects the reference to a previous

exception object that was caught during exception handling. The previous parameter can be used to chain multiple exceptions and preserve the original cause of the exception12. You cannot do any of the following:

“zcxl” is a dictionary structure, and “paraml” and “param2” are this structure: This is false. zcxl is not a dictionary structure, but a user-defined exception class that inherits from the predefined exception class cx_static_check. param1 and param2 are not components of this structure, but input parameters of the instance constructor of the exception class zcxl. The input parameters can be used to pass additional information to the exception object, such as the values that caused the exception12.

“paraml” and “param2” are predefined names: This is false. param1 and param2 are not predefined names, but user-defined names that can be chosen arbitrarily. However, they must match the names of the input parameters of the instance constructor of the exception class zcxl. The names of the input parameters can be declared in the interface of the exception class using the RAISING addition12.

Explanation:

Reference: 1: RAISE EXCEPTION – ABAP Keyword Documentation – SAP Online Help 2: Class-Based Exceptions – ABAP Keyword Documentation – SAP Online Help

Question #36

What RESTful Application Programming object contains only the fields required for a particular app?

  • A . Database view
  • B . Metadata extension
  • C . Projection View
  • D . Data model view

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

A projection view is a RESTful Application Programming object that contains only the fields required for a particular app. A projection view is a CDS view entity that defines a projection on an existing CDS view entity or CDS DDIC-based view. A projection view exposes a subset of the elements of the projected entity, which are relevant for a specific business service. A projection view can also define aliases, virtual elements, and annotations for the projected elements. A projection view is the top-most layer of a CDS data model and prepares data for a particular use case. A projection view can have different provider contracts depending on the type of service it supports, such as transactional query, analytical query, or transactional interface.

A database view is a CDS DDIC-based view that defines a join or union of database tables. A database view has an SQL view attached and can be accessed by Open SQL or native SQL. A database view can be used as a projected entity for a projection view, but it does not contain only the fields required for a particular app.

A metadata extension is a RESTful Application Programming object that defines additional annotations for a CDS view entity or a projection view. A metadata extension can be used to enhance the metadata of a CDS data model without changing the original definition. A metadata extension does not contain any fields, but only annotations.

A data model view is a CDS view entity that defines a data model based on database tables or other CDS view entities. A data model view can have associations, aggregations, filters, parameters, and annotations. A data model view can be used as a projected entity for a projection view, but it does

not contain only the fields required for a particular app.

Reference: CDS Projection Views – ABAP Keyword Documentation, CDS Projection Views in ABAP

CDS: What’s Your Flavor, Business Object Projection – ABAP Keyword Documentation

Question #37

In a RESTful Application Programming application, in which objects do you bind a CDS view to create a value help? Note: There are 3 correct answers to this question.

  • A . Data model view
  • B . Behavior definition
  • C . Metadata Extension
  • D . Service Definition
  • E . Projection View

Reveal Solution Hide Solution

Correct Answer: CDE
CDE

Explanation:

In a RESTful Application Programming (RAP) application, you can bind a CDS view to create a value help in the following objects:

Data model view: A data model view is a CDS view that defines the data structure and the associations of an entity in the RAP application. You can use the annotation @Consumption.valueHelpDefinition to bind a value help provider CDS view to an element of the data model view. The value help provider CDS view must contain the key fields of the value help entity and the fields that are displayed in the value help dialog. The value help annotation specifies the entity name, the element name, and optionally the additional binding conditions for the value help provider1.

Metadata Extension: A metadata extension is a CDS view that extends the metadata of another CDS view without changing its data structure. You can use the annotation @MetadataExtension.extendView to specify the target CDS view that you want to extend. You can then use the same annotation @Consumption.valueHelpDefinition to bind a value help provider CDS view to an element of the target CDS view. The metadata extension allows you to add value help definitions to existing CDS views without modifying them2.

Projection View: A projection view is a CDS view that defines the projection of another CDS view. You can use the annotation @AbapCatalog.sqlViewType: #PROJECTION to specify that the CDS view is a projection view. You can then use the same annotation @Consumption.valueHelpDefinition to bind a value help provider CDS view to an element of the projection view. The projection view allows you to add value help definitions to projected elements of another CDS view3.

You cannot bind a value help provider CDS view to a behavior definition or a service definition, because these objects do not define the data structure or the metadata of an entity in the RAP application. A behavior definition defines the behavior and the validation rules of an entity, such as the create, read, update, and delete (CRUD) operations, the draft handling, the authorization checks, and the side effects4. A service definition defines the service exposure and the service binding of an entity, such as the protocol, the version, the namespace, and the service name5.

Reference: 1: Value Help with Additional Binding | SAP Help Portal 2: Metadata Extensions – ABAP

Keyword Documentation 3: Projection Views – ABAP Keyword Documentation 4: Behavior Definition –

ABAP Keyword Documentation 5: Service Definition – ABAP Keyword Documentation

Question #38

What are advantages of using a field symbol for internal table row access? Note: There are answers to this question.

  • A . The field symbol can be reused for other programs.
  • B . A MODIFY statement to write changed contents back to the table is not required.
  • C . The row content is copied to the field symbol instead to a work area
  • D . Using a field symbol is faster than using a work area.

Reveal Solution Hide Solution

Correct Answer: B, D
B, D

Explanation:

A field symbol is a pointer that allows direct access to a row of an internal table without copying it to a work area. Using a field symbol for internal table row access has some advantages over using a work area, such as12:

A MODIFY statement to write changed contents back to the table is not required: This is true. When you use a work area, you have to copy the row content from the internal table to the work area, modify it, and then copy it back to the internal table using the MODIFY statement. This can be costly in terms of performance and memory consumption. When you use a field symbol, you can modify the row content directly in the internal table without any copying. Therefore, you do not need the MODIFY statement12.

Using a field symbol is faster than using a work area: This is true. As explained above, using a field symbol avoids the overhead of copying data between the internal table and the work area. This can improve the performance of the loop considerably, especially for large internal tables. According to some benchmarks, using a field symbol can save 25C40% of the runtime compared to using a work area12.

You cannot do any of the following:

The field symbol can be reused for other programs: This is false. A field symbol is a local variable that is only visible within the scope of its declaration. It cannot be reused for other programs unless it is declared globally or passed as a parameter. Moreover, a field symbol must have the same type as the line type of the internal table that it accesses. Therefore, it cannot be used for any internal table with a different line type12.

The row content is copied to the field symbol instead to a work area: This is false. As explained above, using a field symbol does not copy the row content to the field symbol. Instead, the field symbol points to the memory address of the row in the internal table and allows direct access to it. Therefore, there is no copying involved when using a field symbol12.

Reference: 1: Using Field Symbols to Process Internal Tables – SAP Learning 2: Access to Internal Tables – ABAP Keyword Documentation – SAP Online Help

Exit mobile version