Practice Free C_ABAPD_2309 Exam Online Questions
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.
B, 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.
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’)
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
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
AC
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
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
AC
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
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?
- A . scarr will be joined with scounter first and the result will be joined with sairport.
- B . sairport will be joined to scounter first and the result will be joined with scarr.
- C . scarr will be joined with sairport first and the result will be joined with scounter.
- D . scounter will be joined to sairport first and the result will be joined with scarr.
A
Explanation:
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.
Reference: 1: Join – ABAP Keyword Documentation
Which type of legacy code does SAP recommend you eliminate when you review modifications as part of an SAP S/4HANA system conversion? Note: There are 2 correct answers to this question.
- A . Code that supports a critical business process
- B . Code that now is identical to a standard SAP object
- C . Code that has less than 10% usage according to usage statistics
- D . Code that can be redesigned as a key user extension
B, D
Explanation:
SAP recommends that you eliminate the following types of legacy code when you review modifications as part of an SAP S/4HANA system conversion:
Code that now is identical to a standard SAP object. This type of code is redundant and unnecessary, as it does not provide any additional functionality or customization. It can also cause conflicts or errors during the system conversion, as the standard SAP object may have changed or been replaced in SAP S/4HANA. Therefore, you should delete this type of code and use the standard SAP object instead.
Code that can be redesigned as a key user extension. This type of code is usually related to UI or business logic adaptations that can be achieved using the in-app tools provided by SAP S/4HANA. By redesigning this type of code as a key user extension, you can simplify and standardize your code base, reduce maintenance efforts, and avoid compatibility issues during the system conversion. Therefore, you should migrate this type of code to the key user extensibility framework and delete the original code.
The other types of legacy code are not recommended to be eliminated, as they may still be relevant or necessary for your business processes. However, you should still review and adjust them according to the SAP S/4HANA simplification items and best practices. These types of code are:
Code that supports a critical business process. This type of code is essential for your business operations and cannot be easily replaced or removed. However, you should check if this type of code
is compatible with SAP S/4HANA, and if not, you should adapt it accordingly. You should also consider if this type of code can be optimized or enhanced using the new features and capabilities of SAP S/4HANA.
Code that has less than 10% usage according to usage statistics. This type of code is rarely used and may not be worth maintaining or converting. However, you should not delete this type of code without verifying its relevance and impact on your business processes. You should also consider if this type of code can be replaced or consolidated with other code that has higher usage or better performance.
Reference: Custom Code Management (CCM) During an SAP S/4HANA Conversion, Custom Code Migration Guide for SAP S/4HANA 2020
You want to provide a short description of the data definition for developers that will be attached to the database view
Which of the following annotations would do this if you inserted it on line #27
- A . @UI headerinto description label
- B . @UI.badge.title.label
- C . @EndUserText.quickInfo
- D . @EndUserText label
D
Explanation:
The annotation that can be used to provide a short description of the data definition for developers that will be attached to the database view is the @EndUserText.label annotation. This annotation is used to specify a text label for the data definition that can be displayed in the development tools or in the documentation. The annotation can be inserted on line #27 in the code snippet provided in the question12. For example:
The following code snippet uses the @EndUserText.label annotation to provide a short description of the data definition for the CDS view ZCDS_VIEW:
@AbapCatalog.sqlViewName: ‘ZCDS_VIEW’ @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: ‘CDS view for flight data’ "short description for developers define view ZCDS_VIEW as select from sflight { key carrid, key connid, key fldate, seatsmax, seatsocc } You cannot do any of the following:
@UI.headerInfo.description.label: This annotation is used to specify a text label for the description field of the header information of a UI element. This annotation is not relevant for the data definition of a database view12.
@UI.badge.title.label: This annotation is used to specify a text label for the title field of a badge UI element. This annotation is not relevant for the data definition of a database view12. @EndUserText.quickInfo: This annotation is used to specify a quick information text for the data definition that can be displayed as a tooltip in the development tools or in the documentation. This annotation is not the same as a short description or a label for the data definition12.
Reference: 1: ABAP CDS – SAP Annotations – ABAP Keyword Documentation – SAP Online
Help 2: ABAP CDS – Data Definitions – ABAP Keyword Documentation – SAP Online Help
Which ABAP SQL clause allows the use of inline declarations?
- A . FROM
- B . INTO CORRESPONDING FIELDS OF
- C . INTO
- D . FIELDS
C
Explanation:
The ABAP SQL clause that allows the use of inline declarations is the INTO clause. The INTO clause is used to specify the target variable or field symbol where the result of the SQL query is stored. The INTO clause can use inline declarations to declare the target variable or field symbol at the same position where it is used, without using a separate DATA or FIELD-SYMBOLS statement. The inline declaration is performed using the DATA or @DATA operators in the declaration expression12.
For example:
The following code snippet uses the INTO clause with an inline declaration to declare a local variable itab and store the result of the SELECT query into it: SELECT * FROM scarr INTO TABLE @DATA (itab).
The following code snippet uses the INTO clause with an inline declaration to declare a field symbol <fs> and store the result of the SELECT query into it: SELECT SINGLE * FROM scarr INTO @<fs>.
You cannot do any of the following:
FROM: The FROM clause is used to specify the data source of the SQL query, such as a table, a view, or a join expression. The FROM clause does not allow the use of inline declarations12.
INTO CORRESPONDING FIELDS OF: The INTO CORRESPONDING FIELDS OF clause is used to specify the target structure or table where the result of the SQL query is stored. The INTO CORRESPONDING FIELDS OF clause does not allow the use of inline declarations. The target structure or table must be declared beforehand using a DATA or FIELD-SYMBOLS statement12.
FIELDS: The FIELDS clause is used to specify the columns or expressions that are selected from the data source of the SQL query. The FIELDS clause does not allow the use of inline declarations. The FIELDS clause must be followed by an INTO clause that specifies the target variable or field symbol where the result is stored12.
Reference: 1: SELECT – ABAP Keyword Documentation – SAP Online Help 2: Inline Declarations – ABAP Keyword Documentation – SAP Online Help
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.
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
Which of the following string functions are predicate functions? Note: There are 2 correct answers to this question.
- A . find_any_not_of()
- B . contains_any_of()
- C . count_any_of()
- D . matchesQ
B, D
Explanation:
String functions are expressions that can be used to manipulate character-like data in ABAP. String functions can be either predicate functions or non-predicate functions. Predicate functions are string functions that return a truth value (true or false) for a condition of the argument text. Non-predicate functions are string functions that return a character-like result for an operation on the argument text1.
The following string functions are predicate functions:
B) contains_any_of(): This function returns true if the argument text contains at least one of the characters specified in the character set. For example, the following expression returns true, because the text ‘ABAP’ contains at least one of the characters ‘A’, ‘B’, or ‘C’:
contains_any_of( val = ‘ABAP’ set = ‘ABC’ ).
D) matches(): This function returns true if the argument text matches the pattern specified in the regular expression. For example, the following expression returns true, because the text ‘ABAP’ matches the pattern that consists of four uppercase letters:
matches( val = ‘ABAP’ regex = ‘[A-Z]{4}’ ).
The following string functions are not predicate functions, because they return a character-like result, not a truth value:
A) find_any_not_of(): This function returns the position of the first character in the argument text that is not contained in the character set. If no such character is found, the function returns 0. For example, the following expression returns 3, because the third character of the text ‘ABAP’ is not contained in the character set ‘ABC’:
find_any_not_of( val = ‘ABAP’ set = ‘ABC’ ).
C) count_any_of(): This function returns the number of characters in the argument text that are contained in the character set. For example, the following expression returns 2, because there are two characters in the text ‘ABAP’ that are contained in the character set ‘ABC’: count_any_of( val = ‘ABAP’ set = ‘ABC’ ).
Reference: 1: String Functions – ABAP Keyword Documentation