In the assignment, data (gv_result) = 1/8. what will be the data type of gv_result?
OTYPE I
TYPE DEFLOAT 16
TYPE P DECIMALS 3
TYPE P DECIMALS 2
The data type of gv_result in the assignment data (gv_result) = 1/8 will be TYPE DECFLOAT 16. This is because the assignment operator (=) in ABAP performs an implicit type conversion from the source type to the target type, according to the following rules12:
If the target type is specified explicitly, the source value is converted to the target type.
If the target type is not specified explicitly, the source type is used as the target type, unless the source type is a literal or an expression, in which case the target type is determined by the following priority order: DECFLOAT34, DECFLOAT16, P, F, I, C, N, X, STRING, XSTRING.
In this case, the target type is not specified explicitly, and the source type is an expression (1/8). Therefore, the target type is determined by the priority order, and the first matching type is DECFLOAT16, which is a decimal floating point type with 16 digits of precision12.
References: 1: ABAP Assignment Rules - ABAP Keyword Documentation - SAP Online Help 2: ABAP Data Types - ABAP Keyword Documentation - SAP Online Help
In which products must you use the ABAP Cloud Development Model? Note: There are 2 correct answers to this question.
SAP S/4HANA Cloud, private edition
SAP BTP, ABAP environment
SAP S/4HANA on premise
SAP S/4HANA Cloud, public edition
The ABAP Cloud Development Model is the ABAP development model to build cloud-ready business apps, services, and extensions. It comes with SAP BTP and SAP S/4HANA. It works with public or private cloud, and even on-premise1. However, the complete ABAP Cloud Development Model, including the cloud-optimized ABAP language and public local SAP APIs and extension points, is available only in SAP BTP ABAP Environment and in the 2208/2022 versions of the SAP S/4HANA editions1. Therefore, you must use the ABAP Cloud Development Model in SAP BTP, ABAP environment and SAP S/4HANA Cloud, private edition. You can also use it in SAP S/4HANA on premise, but it is not mandatory. You cannot use it in SAP S/4HANA Cloud, public edition, because it does not allow custom ABAP code2. References: 1: ABAP Cloud | SAP Blogs 2: SAP S/4HANA Cloud Extensibility – Overview and Comparison | SAP Blogs
target_itab = VALUE #( FOR row IN source_itab (
field1 = row-field1
field2 = row-field2
field3 = row-field3 )
).
Which of the following statements are correct? Note: There are 2 correct answers to this question.
FOR defines a loop that runs over the content of source_itab
source_itab is only visible within the loop.
row is a predefined name and cannot be chosen arbitrarily.
row is only visible within the loop.
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.
References: 1: FOR - Iteration Expressions - ABAP Keyword Documentation - SAP Online Help 2: ABAP 7.4 Syntax - FOR Loop iteration | SAP Community
Which of the following results in faster access to internal tables? Note: There are 3 correct answers to this question.
In a sorted internal table, specifying the primary key partially from the left without gaps.
In a sorted internal table, specifying the primary key completely.
In a standard internal table, specifying the primary key partially from the left without gaps.
In a hashed internal table, specifying the primary key partially from the left without gaps.
In a hashed internal table, specifying the primary key completely.
The access to internal tables can be optimized by using the appropriate table type and specifying the table key. The table key is a set of fields that uniquely identifies a row in the table and determines the sorting order of the table. The table key can be either the primary key or a secondary key. The primary key is defined by the table type and the table definition, while the secondary key is defined by the user using the KEY statement1.
The following results in faster access to internal tables:
B. In a sorted internal table, specifying the primary key completely. A sorted internal table is a table type that maintains a predefined sorting order, which is defined by the primary key in the table definition. The primary key can be either unique or non-unique. A sorted internal table can be accessed using the primary key or the table index. The access using the primary key is faster than the access using the table index, because the system can use a binary search algorithm to find the row. However, the primary key must be specified completely, meaning that all the fields of the primary key must be given in the correct order and without gaps2.
D. In a hashed internal table, specifying the primary key partially from the left without gaps. A hashed internal table is a table type that does not have a predefined sorting order, but uses a hash algorithm to store and access the rows. The primary key of a hashed internal table must be unique and cannot be changed. A hashed internal table can only be accessed using the primary key, not the table index. The access using the primary key is very fast, because the system can directly calculate the position of the row using the hash algorithm. The primary key can be specified partially from the left without gaps, meaning that some of the fields of the primary key can be omitted, as long as they are the rightmost fields and there are no gaps between the specified fields.
E. In a hashed internal table, specifying the primary key completely. A hashed internal table is a table type that does not have a predefined sorting order, but uses a hash algorithm to store and access the rows. The primary key of a hashed internal table must be unique and cannot be changed. A hashed internal table can only be accessed using the primary key, not the table index. The access using the primary key is very fast, because the system can directly calculate the position of the row using the hash algorithm. The primary key can be specified completely, meaning that all the fields of the primary key must be given in the correct order.
The following do not result in faster access to internal tables, because:
A. In a sorted internal table, specifying the primary key partially from the left without gaps. A sorted internal table is a table type that maintains a predefined sorting order, which is defined by the primary key in the table definition. The primary key can be either unique or non-unique. A sorted internal table can be accessed using the primary key or the table index. The access using the primary key is faster than the access using the table index, because the system can use a binary search algorithm to find the row. However, the primary key must be specified completely, meaning that all the fields of the primary key must be given in the correct order and without gaps. If the primary key is specified partially from the left without gaps, the system cannot use the binary search algorithm and has to perform a linear search, which is slower2.
C. In a standard internal table, specifying the primary key partially from the left without gaps. A standard internal table is a table type that does not have a predefined sorting order, but uses a sequential storage and access of the rows. The primary key of a standard internal table is the standard key, which consists of all the fields of the table row in the order in which they are defined. A standard internal table can be accessed using the primary key or the table index. The access using the primary key is slower than the access using the table index, because the system has to perform a linear search to find the row. The primary key can be specified partially from the left without gaps, but this does not improve the access speed, because the system still has to perform a linear search.
References: 1: Internal Tables - Overview - ABAP Keyword Documentation 2: Sorted Tables - ABAP Keyword Documentation : Hashed Tables - ABAP Keyword Documentation : Standard Tables - ABAP Keyword Documentation
when you attempt to activate the definition, what will be the response?
Activation error because the field names of the union do not match
Activation error because the field types of the union do not match
Activation error because the key fields of the union do not match
Activation successful
The response will be an activation error because the field names of the union do not match. This is because the field names of the union must match in order for the definition to be activated. The union operator combines the result sets of two or more queries into a single result set. The queries that are joined by the union operator must have the same number and type of fields, and the fields must have the same names1. In the given code, the field names of the union do not match, because the first query has the fields carrname, connid, cityfrom, and cityto, while the second query has the fields carrname, carrier_id, cityfrom, and cityto. The field connid in the first query does not match the field carrier_id in the second query. Therefore, the definition cannot be activated.
References: 1: UNION - ABAP Keyword Documentation
What are some properties of database tables? Note: There are 2 correct answers to this question.
They store information in two dimensions.
They may have key fields.
They can have any number of key fields.
They can have relationships to other tables.
Database tables are data structures that store information in two dimensions, using rows and columns. Each row represents a record or an entity, and each column represents an attribute or a field. Database tables may have key fields, which are columns that uniquely identify each row or a subset of rows. Key fields can be used to enforce data integrity, perform efficient searches, and establish relationships to other tables. Database tables can have relationships to other tables, which are associations or links between the key fields of two or more tables. Relationships can be used to model the logical connections between different entities, join data from multiple tables, and enforce referential integrity12.
References: 1: Table (database) - Wikipedia 2: Database design basics - Microsoft Support
You have two internal tables itab1 and itab2.What is true for using the expression itab1 = corresponding #( itab2 )? Note: There are 2 correct answers to this question.
Fields with the same name but with different types may be copied from itab2 to itab1.
itab1 and itab2 must have at least one field name in common.
Fields with the same name and the same type will be copied from itab2 to itab1.
itab1 and itab2 must have the same data type.
The expression itab1 = corresponding #( itab2 ) is a constructor expression with the component operator CORRESPONDING that assigns the contents of the internal table itab2 to the internal table itab1. The following statements are true for using this expression:
B: itab1 and itab2 must have at least one field name in common. This is because the component operator CORRESPONDING assigns the identically named columns of itab2 to the identically named columns of itab1 by default, according to the rules of MOVE-CORRESPONDING for internal tables. If itab1 and itab2 do not have any field name in common, the expression will not assign any value to itab1 and it will remain initial or unchanged1
C: Fields with the same name and the same type will be copied from itab2 to itab1. This is because the component operator CORRESPONDING assigns the identically named columns of itab2 to the identically named columns of itab1 by default, according to the rules of MOVE-CORRESPONDING for internal tables. If the columns have the same name but different types, the assignment will try to perform a conversion between the types, which may result in a loss of precision, a truncation, or a runtime error, depending on the types involved1
The following statements are false for using this expression:
A: Fields with the same name but with different types may be copied from itab2 to itab1. This is not true, as explained in statement C. The assignment will try to perform a conversion between the types, which may result in a loss of precision, a truncation, or a runtime error, depending on the types involved1
D: itab1 and itab2 must have the same data type. This is not true, as the component operator CORRESPONDING can assign the contents of an internal table of one type to another internal table of a different type, as long as they have at least one field name in common. The target type of the expression is determined by the left-hand side of the assignment, which is itab1 in this case. The expression will create an internal table of the same type as itab1 and assign it to itab11
References: CORRESPONDING - Component Operator - ABAP Keyword Documentation
What is the purpose of a foreign key relationship between two tables in the ABAP Dictionary?
To document the relationship between the two tables
To ensure the integrity of data in the corresponding database tables
To create a corresponding foreign key relationship in the database
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.
References: 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
Why would you use Access Controls with CDS Views? Note: There are 2 correct answers to this question.
Only the data corresponding to the user's authorization is transferred from the database to the application layer.
The system field sy-subrc is set, giving you the result of the authorization check
You do not have to remember to implement AUTHORITY CHECK statements.
All of the data from the data sources is loaded into your application automatically and filtered there according to the user's authorization.
You would use Access Controls with CDS Views for the following reasons:
A. Only the data corresponding to the user’s authorization is transferred from the database to the application layer. This is true because Access Controls allow you to define CDS roles that specify the authorization conditions for accessing a CDS view. The CDS roles are evaluated for every user at runtime and the system automatically adds the restrictions to the selection conditions of the CDS view. This ensures that only the data that the user is authorized to see is read from the database and transferred to the application layer. This improves the security and the performance of the data access1.
C. You do not have to remember to implement AUTHORITY CHECK statements. This is true because Access Controls provide a declarative and centralized way of defining the authorization logic for a CDS view. You do not have to write any procedural code or use the AUTHORITY CHECK statement to check the user’s authorization for each data source or field. The system handles the authorization check automatically and transparently for you2.
The following reasons are not valid for using Access Controls with CDS Views:
B. The system field sy-subrc is set, giving you the result of the authorization check. This is false because the system field sy-subrc is not used by Access Controls. The sy-subrc field is used by the AUTHORITY CHECK statement to indicate the result of the authorization check, but Access Controls do not use this statement. Instead, Access Controls use CDS roles to filter the data according to the user’s authorization2.
D. All of the data from the data sources is loaded into your application automatically and filtered there according to the user’s authorization. This is false because Access Controls do not load all the data from the data sources into the application layer. Access Controls filter the data at the database layer, where the data resides, and only transfer the data that the user is authorized to see to the application layer. This reduces the data transfer and the memory consumption of the application layer1.
References: 1: Access Controls | SAP Help Portal 2: ABAP CDS - Access Control - ABAP Keyword Documentation
Which restrictions exist for ABAP SQL arithmetic expressions? Note: There are 2 correct answers to this question.
Floating point types and integer types can NOT be used in the same expression.
The operator/is allowed only in floating point expressions.
Decimal types and integer types can NOT be used in the same expression.
The operator is allowed only in floating point expressions.
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.
References: sql_exp - sql_arith - ABAP Keyword Documentation, SQL Expressions, Arithmetic Calculations - ABAP Keyword Documentation
What are some characteristics of secondary keys for internal tables? Note: There are 3 correct answers to this question.
Secondary keys must be chosen explicitly when you actually read from an internal table.
Multiple secondary keys are allowed for any kind of internal table.
Hashed secondary keys do NOT have to be unique.
Sorted secondary keys do NOT have to be unique.
Secondary keys can only be created for standard tables.
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.
References: 1: Secondary Table Key - ABAP Keyword Documentation 2: READ TABLE - ABAP Keyword Documentation 3: Sorted Tables - ABAP Keyword Documentation : Hashed Tables - ABAP Keyword Documentation
Which of the following are parts of answers to this question.
Partitioning attributes
Extension
Field list
Semantic table attributes
A CDS view is a data definition that defines a data structure and a data selection from one or more data sources. A CDS view consists of several parts, but two of them are:
Extension: An extension is an optional clause that allows a CDS view to extend another CDS view by adding new elements, annotations, or associations. The extension clause has the syntax EXTEND VIEW view_name WITH view_name. The first view_name is the name of the CDS view that is being extended, and the second view_name is the name of the CDS view that is doing the extension1.
Field list: A field list is a mandatory clause that specifies the elements of the CDS view. The field list has the syntax SELECT FROM data_source { element_list }. The data_source is the name of the data source that the CDS view selects data from, and the element_list is a comma-separated list of elements that the CDS view exposes. The elements can be fields of the data source, expressions, associations, or annotations2.
The following example shows a CDS view that extends another CDS view and defines a field list:
@AbapCatalog.sqlViewName: ‘ZCDS_EXT’ define view Z_CDS_Extension extend view Z_CDS_Base with Z_CDS_Extension as select from ztable { // field list key ztable.id as ID, ztable.name as Name, ztable.age as Age, // extension @Semantics.currencyCode: true ztable.currency as Currency }
The other options are not parts of a CDS view, but rather related concepts:
Partitioning attributes: Partitioning attributes are attributes that are used to partition a table into smaller subsets of data. Partitioning attributes are defined in the ABAP Dictionary for transparent tables and can improve the performance and scalability of data access. Partitioning attributes are not part of the CDS view definition, but rather the underlying table definition3.
Semantic table attributes: Semantic table attributes are attributes that provide additional information about the meaning and usage of a table. Semantic table attributes are defined in the ABAP Dictionary for transparent tables and can be used to enhance the data modeling and consumption of the table. Semantic table attributes are not part of the CDS view definition, but rather the underlying table definition4.
References: 1: Extending CDS Views | SAP Help Portal 2: SELECT List - ABAP Keyword Documentation 3: Partitioning Attributes - ABAP Keyword Documentation 4: Semantic Table Attributes - ABAP Keyword Documentation
In the following ABAP SQL code, what are valid case distinctions? Note: There are 2 correct answers to this question.
A)
B)
C)
D)
Option A
Option B
Option C
Option D
The "demo_ods_assoc_spfi data source referenced in line #4 contains a field "connid" which you would like to expose in the element list.
Which of the following statements would do this if inserted on line #8?
demo_ods_assoc_spfli.connid,
demo_ods_assoc_spfli-connid/
spfli-connid,
_spfli.connid/
The statement that can be used to expose the field “connid” of the data source “demo_ods_assoc_spfli” in the element list is A. demo_ods_assoc_spfli.connid,. This statement uses the dot notation to access the field “connid” of the data source “demo_ods_assoc_spfli”, which is an association defined on line #4. The association “demo_ods_assoc_spfli” links the data source “demo_ods” with the table “spfli” using the field “carrid”. The statement also ends with a comma to separate it from the next element in the list12.
You cannot do any of the following:
B. demo_ods_assoc_spfli-connid/: This statement uses the wrong syntax to access the field “connid” of the data source “demo_ods_assoc_spfli”. The dash notation is used to access the components of a structure or a table, not the fields of a data source. The statement also ends with a slash, which is not a valid separator for the element list12.
C. spfli-connid,: This statement uses the wrong data source name to access the field “connid”. The data source name should be “demo_ods_assoc_spfli”, not “spfli”. The statement also uses the wrong syntax to access the field “connid”, as explained above12.
D. _spfli.connid/: This statement uses the wrong data source name and the wrong separator to access the field “connid”. The data source name should be “demo_ods_assoc_spfli”, not “_spfli”. The statement also ends with a slash, which is not a valid separator for the element list12.
References: 1: ABAP CDS - SELECT, select_list - ABAP Keyword Documentation - SAP Online Help 2: ABAP CDS - SELECT, from - ABAP Keyword Documentation - SAP Online Help
When processing an internal table with the statement LOOP AT itab... ENDLOOP, what system variable contains the current row number?
sy-index
sy-subrc
sy-linno
sy-tabix
When processing an internal table with the statement LOOP AT itab… ENDLOOP, the system variable that contains the current row number is sy-tabix. The sy-tabix variable is a predefined field of the system structure sy that holds the index or the row number of the current line in an internal table loop. The sy-tabix variable is initialized with the value 1 for the first loop pass and is incremented by 1 for each subsequent loop pass. The sy-tabix variable can be used to access or modify the current line of the internal table using the index access12.
References: 1: LOOP AT itab - ABAP Keyword Documentation - SAP Online Help 2: System Fields - ABAP Keyword Documentation - SAP Online Help
What RESTful Application Programming object contains only the fields required for a particular app?
Database view
Metadata extension
Projection View
Data model view
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.
References: CDS Projection Views - ABAP Keyword Documentation, CDS Projection Views in ABAP CDS: What’s Your Flavor, Business Object Projection - ABAP Keyword Documentation
In ABAP SQL, which of the following retrieves the association field_Airline-Name of a CDS view?
\_Airline-Name
/_Airline Name
@_Airline-Name
"_Airline Name
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.
References: 1: Path Expressions - ABAP Keyword Documentation
When processing a loop with the statement DO... ENDDO, what system variable contains the implicit loop counter?
sy-linno
sy-labix
sy-subrc
sy-index
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:
1 2 3 4 5 6 7 8 9 10
References: 1: DO - ABAP Keyword Documentation
Which function call returns 0?
Count_any_of ( val - ‘ABAP ABAP abap' sub "AB" )
Count (val - 'ABAP ABAP abap' sub - 'AB' )
find_any_of (val = "ABAP ABAP abap' sub = "AB")
find_any_not_of( val 'ABAP ABAP abap’ sub = 'AB')
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. References: String Functions - ABAP Keyword Documentation, Examples of String Functions - ABAP Keyword Documentation
What are some features of a unique secondary key? Note: There are 2 correct answers to this question.
It is created when a table is filled.
It is updated when the modified table is read again.
It is created with the first read access of a table.
It is updated when the table is modified.
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.
References: 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]
You want to define the following CDS view entity with an input parameter:
Define view entity Z_CONVERT With parameters currency : ???
Which of the following can you use to replace "???? Note: There are 2 correct answers to this
question.
built-in ABAP type
A built-in ABAP Dictionary type
A data element
A component of an ABAP Dictionary structure
The possible replacements for “???” in the CDS view entity definition with an input parameter are A. built-in ABAP type and C. A data element. These are the valid types that can be used to specify the data type of an input parameter in a CDS view entity. A built-in ABAP type is a predefined elementary type in the ABAP language, such as abap.char, abap.numc, abap.dec, etc. A data element is a reusable semantic element in the ABAP Dictionary that defines the technical attributes and the meaning of a field12. For example:
The following code snippet defines a CDS view entity with an input parameter currency of type abap.cuky, which is a built-in ABAP type for currency key:
Define view entity Z_CONVERT With parameters currency : abap.cuky as select from … { … }
The following code snippet defines a CDS view entity with an input parameter currency of type waers, which is a data element for currency key:
Define view entity Z_CONVERT With parameters currency : waers as select from … { … }
You cannot do any of the following:
B. A built-in ABAP Dictionary type: This is not a valid type for an input parameter in a CDS view entity. A built-in ABAP Dictionary type is a predefined elementary type in the ABAP Dictionary, such as CHAR, NUMC, DEC, etc. However, these types cannot be used directly in a CDS view entity definition. Instead, they have to be prefixed with abap. to form a built-in ABAP type, as explained above12.
D. A component of an ABAP Dictionary structure: This is not a valid type for an input parameter in a CDS view entity. A component of an ABAP Dictionary structure is a field that belongs to a structure type, which is a complex type that consists of multiple fields. However, an input parameter in a CDS view entity can only be typed with an elementary type, which is a simple type that has no internal structure12.
References: 1: ABAP CDS - SELECT, parameter_list - ABAP Keyword Documentation - SAP Online Help 2: ABAP Data Types - ABAP Keyword Documentation - SAP Online Help