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
In what order are objects created to generate a RESTful Application Programming application?
Database table 1
Service binding Projection view 4
Service definition 3
Data model view 2
D A B C
B D C A
A D C B
The order in which objects are created to generate a RESTful Application Programming application is A, D, C, B. This means that the following steps are followed:
First, a database table is created to store the data for the application. A database table is a CDS DDIC-based view that defines a join or union of database tables. A database table has an SQL view attached and can be accessed by Open SQL or native SQL.
Second, a data model view is created to define a data model based on the database table or other CDS view entities. A data model view is a CDS view entity that can have associations, aggregations, filters, parameters, and annotations. A data model view can also define the behavior definition and implementation for the business object.
Third, a service definition is created to define the service interface for the application. A service definition is a CDS view entity that defines a projection on a data model view or another service definition. A service definition can also define service metadata, such as service name, version, description, and annotations.
Fourth, a service binding is created to define the service binding for the application. A service binding is a CDS view entity that defines a projection on a service definition. A service binding can also define the service protocol, such as OData V2, OData V4, or REST, and the service URL.
References: CDS Data Model Views - ABAP Keyword Documentation, CDS Service Definitions - ABAP Keyword Documentation, CDS Service Bindings - ABAP Keyword Documentation, CDS Projection Views - ABAP Keyword Documentation
Class super has subclass sub. Which rules are valid for the sub constructor? Note: There are 2 correct answers to this question.
The method signature can be changed.
Import parameters can only be evaluated after calling the constructor of super.
The constructor of super must be called before using any components of your own instance.
Events of your own instance cannot be raised before the registration of a handler in super.
The sub constructor is the instance constructor of the subclass sub that inherits from the superclass super. The sub constructor has some rules that it must follow when it is defined and implemented12. Some of the valid rules are:
The method signature can be changed: This is true. The sub constructor can have a different method signature than the super constructor, which means that it can have different input parameters, output parameters, or exceptions. However, the sub constructor must still call the super constructor with appropriate actual parameters that match its interface12.
The constructor of super must be called before using any components of your own instance: This is true. The sub constructor must ensure that the super constructor is called explicitly using super->constructor before accessing any instance components of its own class, such as attributes or methods. This is because the super constructor initializes the inherited components of the subclass and sets the self-reference me-> to the current instance12.
You cannot do any of the following:
Import parameters can only be evaluated after calling the constructor of super: This is false. The sub constructor can evaluate its own import parameters before calling the constructor of super, as long as it does not access any instance components of its own class. For example, the sub constructor can use its import parameters to calculate some values or check some conditions that are needed for calling the super constructor12.
Events of your own instance cannot be raised before the registration of a handler in super: This is false. The sub constructor can raise events of its own instance before calling the constructor of super, as long as it does not access any instance components of its own class. For example, the sub constructor can raise an event to notify the consumers of the subclass about some status or error that occurred during the initialization of the subclass12.
References: 1: Inheritance and Constructors - ABAP Keyword Documentation - SAP Online Help 2: Using Static and Instance constructor methods | SAP Blogs
Which of the following ABAP SQL statements are valid? Note: There are 2 correct answers to this question.
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)
SELECT FROM /dmo/connection FIELDS \/ O carrid, airpfrom,
MAX( distance) AS dist_max, MIN(distance) AS dist_min INTO TABLE @DATA(It_hits)
SELECT FROM /dmo/connection FIELDS V D MAX(distance) AS dist_max
MIN(distance) AS dist_min INTO TABLE @DATA(It_hits).
SELECT FROM /dmo/connection FIELDS r—i carrid, airpfrom u GROUP BY carrid, connid
INTO TABLE @DATA(It_hits).
The following are the explanations for each ABAP SQL statement:
A: This statement is valid. It selects the fields carrid, airpfrom, and the aggregate functions MAX(distance) and MIN(distance) from the table /dmo/connection, and groups the results by carrid and airpfrom. The aggregate functions are aliased as dist_max and dist_min. The results are stored in an internal table named It_hits, which is created using the inline declaration operator @DATA.
B: This statement is valid. It is similar to statement A, except that it does not specify the GROUP BY clause. This means that the aggregate functions are applied to the entire table, and the results are stored in an internal table named It_hits, which is created using the inline declaration operator @DATA.
C: This statement is invalid. It selects the aggregate functions MAX(distance) and MIN(distance) from the table /dmo/connection, but it does not specify any grouping or non-aggregate fields. This is not allowed in ABAP SQL, as the SELECT list must contain at least one non-aggregate field or a GROUP BY clause. The statement will cause a syntax error.
D: This statement is invalid. It selects the fields carrid and airpfrom from the table /dmo/connection, and groups the results by carrid and connid. However, the field connid is not included in the SELECT list, which is not allowed in ABAP SQL, as the GROUP BY clause must contain only fields that are also in the SELECT list. The statement will cause a syntax error.
References: SELECT - ABAP Keyword Documentation, GROUP BY - ABAP Keyword Documentation
What are valid statements? Note: There are 3 correct answers to this question
In class CL1, the interface method is named if-ml.
Class CL2 uses the interface.
Class CL1 uses the interface.
In class CL2, the interface method is named ifl-ml.
Class CL1 implements the interface.
The following are the explanations for each statement:
C: This statement is valid. Class CL1 uses the interface. This is because class CL1 implements the interface ifl using the INTERFACES statement in the public section of the class definition. The INTERFACES statement makes the class compatible with the interface and inherits all the components of the interface. The class can then use the interface components, such as the method ml, by using the interface component selector ~, such as ifl~ml12
E: This statement is valid. Class CL1 implements the interface. This is because class CL1 implements the interface ifl using the INTERFACES statement in the public section of the class definition. The INTERFACES statement makes the class compatible with the interface and inherits all the components of the interface. The class must then provide an implementation for the interface method ml in the implementation part of the class, unless the method is declared as optional or abstract12
D: This statement is valid. In class CL2, the interface method is named ifl~ml. This is because class CL2 has a data member named m0_ifl of type REF TO ifl, which is a reference to the interface ifl. The interface ifl defines a method ml, which can be called using the reference variable m0_ifl. The interface method ml has the name ifl~ml in the class, where ifl is the name of the interface and the character ~ is the interface component selector12
The other statements are not valid, as they have syntax errors or logical errors. These statements are:
A: This statement is not valid. In class CL1, the interface method is named ifl~ml, not if-ml. This is because class CL1 implements the interface ifl using the INTERFACES statement in the public section of the class definition. The interface ifl defines a method ml, which can be called using the class name or a reference to the class. The interface method ml has the name ifl~ml in the class, where ifl is the name of the interface and the character ~ is the interface component selector. Using the character - instead of the character ~ will cause a syntax error12
B: This statement is not valid. Class CL2 does not use the interface, but only has a reference to the interface. This is because class CL2 has a data member named m0_ifl of type REF TO ifl, which is a reference to the interface ifl. The interface ifl defines a method ml, which can be called using the reference variable m0_ifl. However, class CL2 does not implement the interface ifl, nor does it inherit the interface components. Therefore, class CL2 does not use the interface, but only references the interface12
References: INTERFACES - ABAP Keyword Documentation, CLASS - ABAP Keyword Documentation
You are given the following information:
1.
The data source "spfli" on line #2 is an SAP HANA
database table
2.
"spfli" will be a large table with over one million rows.
3.
This program is the only one in the system that accesses
the table.
4.
This program will run rarely.
Based on this information, which of the following general
settings should you set for the spfli database table? Note:
There are 2 correct answers to this question.
"Storage Type" to "Column Store"
"Load Unit to "Column Loadable"
"Storage Type" to "Row Store"
"Load Unit' to 'Page Loadable"
Based on the given information, the spfli database table should have the following general settings:
“Storage Type” to “Row Store”: This setting determines how the data is stored in the SAP HANA database. Row store is suitable for tables that are accessed by primary key or by a small number of columns. Column store is suitable for tables that are accessed by a large number of columns or by complex analytical queries. Since the spfli table is a large table with over one million rows, and this program is the only one in the system that accesses the table, it is likely that the program will use primary key access or simple queries to access the table. Therefore, row store is a better choice than column store for this table12.
“Load Unit” to “Page Loadable”: This setting determines how the data is loaded into the memory when the table is accessed. Page loadable means that the data is loaded in pages of 16 KB each, and only the pages that are needed are loaded. Column loadable means that the data is loaded in columns, and only the columns that are needed are loaded. Since the spfli table is a row store table, and this program will run rarely, it is more efficient to use page loadable than column loadable for this table. Page loadable will reduce the memory consumption and the loading time of the table13.
References: 1: Table Types in SAP HANA | SAP Help Portal 2: [Row Store vs Column Store in SAP HANA | SAP Blogs] 3: [Load Unit | SAP Help Portal]
Which of the following integration frameworks have been released for ABAP cloud development? Note: There are 3 correct answers to this question.
SOAP consumption
CDS Views
Business Add-ins (BAdls)
Business Events
OData services
The following are the integration frameworks that have been released for ABAP cloud development:
SOAP consumption: This framework allows you to consume SOAP web services from ABAP cloud applications. You can use the ABAP Development Tools in Eclipse to create a service consumption model based on a WSDL file or URL. The service consumption model generates the required ABAP artifacts, such as proxy classes, data types, and constants, to access the web service. You can then use the proxy classes to call the web service operations from your ABAP code1
Business Events: This framework allows you to publish and subscribe to business events from ABAP cloud applications. Business events are messages that represent a change in the state of a business object or process. You can use the ABAP Development Tools in Eclipse to create a business event definition based on a CDS view entity or a projection view. The business event definition specifies the event key, the event payload, and the event metadata. You can then use the ABAP Messaging Channel (AMC) framework to publish and subscribe to business events using the AMC API2
OData services: This framework allows you to expose and consume OData services from ABAP cloud applications. OData is a standardized protocol for creating and consuming RESTful APIs. You can use the ABAP RESTful Application Programming Model (RAP) to create OData services based on CDS view entities or projection views. The RAP framework generates the required OData metadata and runtime artifacts, such as service definitions, service bindings, and service implementations. You can then use the SAP Gateway framework to register and activate your OData services. You can also use the ABAP Development Tools in Eclipse to consume OData services from other sources using the service consumption model3
The other integration frameworks are not released for ABAP cloud development, as they are either not supported or not recommended for cloud scenarios. These frameworks are:
CDS Views: CDS views are not an integration framework, but a data modeling framework. CDS views are used to define data models based on database tables or other CDS view entities. CDS views can have associations, aggregations, filters, parameters, and annotations. CDS views can also be used as the basis for other integration frameworks, such as OData services or business events4
Business Add-ins (BAdls): BAdls are not supported for ABAP cloud development, as they are part of the classic ABAP enhancement framework. BAdls are used to implement custom logic in predefined enhancement spots in the standard SAP code. BAdls are not compatible with the cloud strategy and the clean core paradigm, as they modify the SAP code and can cause upgrade and maintenance issues. For ABAP cloud development, SAP recommends using the key user extensibility tools or the side-by-side extensibility approach instead of BAdls.
References: Consuming SOAP Services - ABAP Keyword Documentation, Business Events - ABAP Keyword Documentation, OData Services - ABAP Keyword Documentation, CDS Data Model Views - ABAP Keyword Documentation, [Business Add-Ins (BAdIs) - ABAP Keyword Documentation]
For what kind of applications would you consider using on-stack developer extensions? Note: There are 2 correct answers to this question.
Applications that provide APIs for side by side SAP BTP apps
Applications that access SAP S/4HANA data using complex SQL
Applications that integrate data from several different systems
Applications that run separate from SAP S/4HANA
On-stack developer extensibility is a type of extensibility that allows you to create development projects directly on the SAP S/4HANA Cloud technology stack. It gives you the opportunity to develop cloud-ready and upgrade-stable custom ABAP applications and services inside the SAP S/4HANA Cloud, public edition system. You can use the ABAP Development Tools in Eclipse to create and deploy your on-stack extensions. On-stack developer extensibility is suitable for the following kinds of applications:
Applications that provide APIs for side by side SAP BTP apps. On-stack developer extensibility allows you to create OData services or RESTful APIs based on CDS view entities or projection views. These services or APIs can expose SAP S/4HANA data and logic to other applications that run on the SAP Business Technology Platform (SAP BTP) or other platforms. This way, you can create a loosely coupled integration between your SAP S/4HANA system and your side by side SAP BTP apps.
Applications that access SAP S/4HANA data using complex SQL. On-stack developer extensibility allows you to use ABAP SQL to access SAP S/4HANA data using complex queries, such as joins, aggregations, filters, parameters, and code pushdown techniques. You can also use ABAP SQL to perform data manipulation operations, such as insert, update, delete, and upsert. This way, you can create applications that require advanced data processing and analysis on SAP S/4HANA data.
The other kinds of applications are not suitable for on-stack developer extensibility, as they have different requirements and challenges. These kinds of applications are:
Applications that integrate data from several different systems. On-stack developer extensibility is not meant for creating applications that integrate data from multiple sources, such as other SAP systems, third-party systems, or cloud services. This is because on-stack developer extensibility does not support remote access or data replication, and it may cause performance or security issues. For this kind of applications, you should use side by side extensibility, which allows you to create applications that run on the SAP BTP and communicate with the SAP S/4HANA system via public APIs or events.
Applications that run separate from SAP S/4HANA. On-stack developer extensibility is not meant for creating applications that run independently from the SAP S/4HANA system, such as standalone apps, microservices, or web apps. This is because on-stack developer extensibility requires a tight coupling with the SAP S/4HANA system, and it may limit the scalability, flexibility, and portability of the applications. For this kind of applications, you should use side by side extensibility, which allows you to create applications that run on the SAP BTP and leverage the cloud-native features and services of the platform.
References: Developer Extensibility in SAP S/4HANA Cloud ABAP Environment, SAP S/4HANA Extensibility – Simplified Guide for Beginners
Which of the following are features of Core Data Services? Note: There are 3 correct answers to this question.
Inheritance
Associations
Annotations
Delegation
Structured Query Language (SQL)
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.
References: 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]
In ABAP SQL, which of the following can be assigned an alias? Note: There are 2 correct answers to this question.
order criterion (from order by clause)
field (from field list)
database table
group criterion (from group by clause)
In ABAP SQL, an alias is a temporary name that can be assigned to a field or a database table in a query. An alias can be used to make the query more readable, to avoid name conflicts, or to access fields or tables with long names. An alias is created with the AS keyword and is only valid for the duration of the query1.
The following are examples of how to assign an alias to a field or a database table in ABAP SQL:
B. field (from field list): A field is a column of a table or a view that contains data of a certain type. A field can be assigned an alias in the field list of a SELECT statement, which specifies the fields that are selected from the data source. For example, the following query assigns the alias name to the field carrname of the table scarr:
SELECT carrid, carrname AS name FROM scarr.
The alias name can be used instead of carrname in other clauses of the query, such as WHERE, GROUP BY, ORDER BY, and so on2.
C. database table: A database table is a collection of data that is organized in rows and columns. A database table can be assigned an alias in the FROM clause of a SELECT statement, which specifies the data source that is selected from. For example, the following query assigns the alias c to the table scarr:
SELECT c.carrid, c.carrname FROM scarr AS c.
The alias c can be used instead of scarr in other clauses of the query, such as WHERE, JOIN, GROUP BY, ORDER BY, and so on3.
The following are not valid for assigning an alias in ABAP SQL:
A. order criterion (from order by clause): An order criterion is a field or an expression that is used to sort the result set of a query in ascending or descending order. An order criterion cannot be assigned an alias in the ORDER BY clause of a SELECT statement, because the alias is not visible in this clause. The alias can only be used in the clauses that follow the clause where it is defined1.
D. group criterion (from group by clause): A group criterion is a field or an expression that is used to group the result set of a query into subsets that share the same values. A group criterion cannot be assigned an alias in the GROUP BY clause of a SELECT statement, because the alias is not visible in this clause. The alias can only be used in the clauses that follow the clause where it is defined1.
References: 1: ALIASES - ABAP Keyword Documentation 2: SELECT List - ABAP Keyword Documentation 3: FROM Clause - ABAP Keyword Documentation
For the assignment, gv_target = gv_source.
which of the following data declarations will always work without truncation or rounding? Note: There
are 2 correct answers to this question.
DATA gv_source TYPE string, to DATA gv_target TYPE c.
DATA gv_source TYPE c. to DATA gv_target TYPE string.
DATA gv_source TYPE d. to DATA gv_target TYPE string.
DATA gv_source TYPE p LENGTH 8 DECIMALS 3. to DATA gv_target TYPE p LENGTH 16 DECIMALS 2.
The data declarations that will always work without truncation or rounding for the assignment gv_target = gv_source are B and C. This is because the target data type string is a variable-length character type that can hold any character string, including those of data types c (fixed-length character) and d (date). The assignment of a character or date value to a string variable will not cause any loss of information or precision, as the string variable will adjust its length to match the source value12.
You cannot do any of the following:
A. DATA gv_source TYPE string, to DATA gv_target TYPE c.: This data declaration may cause truncation for the assignment gv_target = gv_source. This is because the target data type c is a fixed-length character type that has a predefined length. If the source value of type string is longer than the target length of type c, the source value will be truncated on the right to fit the target length12.
D. DATA gv_source TYPE p LENGTH 8 DECIMALS 3. to DATA gv_target TYPE p LENGTH 16 DECIMALS 2.: This data declaration may cause rounding for the assignment gv_target = gv_source. This is because the target data type p is a packed decimal type that has a predefined length and number of decimal places. If the source value of type p has more decimal places than the target type p, the source value will be rounded to the target number of decimal places12.
References: 1: ABAP Data Types - ABAP Keyword Documentation - SAP Online Help 2: ABAP Assignment Rules - ABAP Keyword Documentation - SAP Online Help
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
Which of the following are incomplete ABAP types? Note: There are 2 correct answers to this question.
String
T
C
P
Incomplete ABAP types are types that do not specify all the attributes of a data type, such as the length, the number of decimal places, or the value range. Incomplete types can only be used for the typing of field symbols and formal parameters, not for the definition of data objects or constants. Incomplete types can be either predefined or user-defined1.
The following are incomplete ABAP types:
C. C is a type for character strings with a generic length. The length of the character string has to be specified when a data object or a constant is defined with this type. For example, DATA text TYPE c LENGTH 10 defines a data object named text with a type c and a length of 10 characters2.
D. P is a type for packed numbers with a generic length and a generic number of decimal places. The length and the number of decimal places of the packed number have to be specified when a data object or a constant is defined with this type. For example, DATA amount TYPE p LENGTH 8 DECIMALS 2 defines a data object named amount with a type p, a length of 8 bytes, and 2 decimal places3.
The following are not incomplete ABAP types, because they specify all the attributes of a data type:
A. String is a type for variable-length character strings. The length of the character string is determined at runtime and can vary from 0 to 2,147,483,647 characters. The length does not have to be specified when a data object or a constant is defined with this type. For example, DATA text TYPE string defines a data object named text with a type string and a variable length4.
B. T is a type for time values in the format HHMMSS. The length of the time value is fixed at 6 characters and does not have to be specified when a data object or a constant is defined with this type. For example, DATA time TYPE t defines a data object named time with a type t and a length of 6 characters.
References: 1: Generic ABAP Types - ABAP Keyword Documentation 2: C - ABAP Keyword Documentation 3: P - ABAP Keyword Documentation 4: String - ABAP Keyword Documentation : T - ABAP Keyword Documentation
What are the effects of this annotation? Note: There are 2 correct answers to this question.
The value of sy-langu will be passed to the CDS view automatically both when you use the -1 CDS view in ABAP and in another CDS view entity (view on view).
You can still override the default value with a value of your own.
The value of sy-langu will be passed to the CDS view automatically when you use the CDS view in ABAP but not when you use it in another view entity
It is no longer possible to pass your own value to the parameter.
The annotation @Environment.systemField: #LANGUAGE is used to assign the ABAP system field sy-langu to an input parameter of a CDS view or a CDS table function. This enables the implicit parameter passing in Open SQL, which means that the value of sy-langu will be automatically passed to the CDS view without explicitly specifying it in the WHERE clause. This also applies to the CDS views that use the annotated CDS view as a data source, which means that the value of sy-langu will be propagated to the nested CDS views (view on view)12. For example:
The following code snippet defines a CDS view ZI_FLIGHT_TEXTS with an input parameter p_langu that is annotated with @Environment.systemField: #LANGUAGE:
define view ZI_FLIGHT_TEXTS with parameters p_langu : syst_langu @ The following code snippet shows how to use the CDS view ZI_FLIGHT_TEXTS in ABAP without specifying the value of p_langu in the WHERE clause. The value of sy-langu will be automatically passed to the CDS view: SELECT carrid, connid, fldate, carrname, carrtext FROM zi_flight_texts INTO TABLE @DATA(lt_flights). The following code snippet shows how to use the CDS view ZI_FLIGHT_TEXTS in another CDS view ZI_FLIGHT_REPORT. The value of sy-langu will be automatically passed to the nested CDS view ZI_FLIGHT_TEXTS: define view ZI_FLIGHT_REPORT with parameters p_langu : syst_langu @ The annotation @Environment.systemField: #LANGUAGE does not prevent the possibility of overriding the default value with a value of your own. You can still specify a different value for the input parameter p_langu in the WHERE clause, either in ABAP or in another CDS view. This will override the value of sy-langu and pass the specified value to the CDS view12. For example: The following code snippet shows how to use the CDS view ZI_FLIGHT_TEXTS in ABAP with a specified value of p_langu in the WHERE clause. The value ‘E’ will be passed to the CDS view instead of the value of sy-langu: SELECT carrid, connid, fldate, carrname, carrtext FROM zi_flight_texts WHERE p_langu = ‘E’ INTO TABLE @DATA(lt_flights). The following code snippet shows how to use the CDS view ZI_FLIGHT_TEXTS in another CDS view ZI_FLIGHT_REPORT with a specified value of p_langu in the WHERE clause. The value ‘E’ will be passed to the nested CDS view ZI_FLIGHT_TEXTS instead of the value of sy-langu: define view ZI_FLIGHT_REPORT with parameters p_langu : syst_langu @ References: 1: ABAP CDS - parameter_annot - ABAP Keyword Documentation - SAP Online Help 2: ABAP CDS - session_variable - ABAP Keyword Documentation - SAP Online Help
In a program you find this source code
AUTHORITY-CHECK OBJECT '/DWO/TRVL ( ID 'CNTRY' FIELD 'DE*
ID ACTVT FIELD '03".
Which of the following apply? Note: There are 2 correct answers to this question.
If the user is authorized for 'CNTRY = 'DE' then the return code is always 0.
If the user is NOT authorized for 'CNTRY' = 'DE' OR for 'ACTVT' = '03 then the program will terminate.
If the user is authorized for 'CNTRY = 'DE' AND for 'ACTVT = '03 then the return code is 0.
AUTHORITY CHECK verifies whether a user is authorized for/DMO/TRVL" with the listed field values.
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
In a test method you call method cl_abap_unit_assert=>assert_equals( .. ) in the following way:
CLASS Itcl1 DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
PRIVATE SECTION.
METHODS m1 FOR TESTING.
ENDCLASS.
CLASS Itcl1 IMPLEMENTATION.
METHOD m1.
DATA: go_test_object TYPE REF TO zcl_to_be_tested.
CONSTANTS: Ico_exp TYPE string VALUE 'test2'.
CREATE OBJECT go_test_object.
cl_abap_unit_assert=>assert_equals(
EXPORTING
act = go_class->mv_attribute
exp = lco_exp
msg = 'assert equals failed ' && go_test_object->mv_attribute && ' ' && lco_exp
ENDMETHOD.
ENDCLASS.
What will happen if method parameters act and exp are not equal?
The tested unit will automatically be appended to a default ABAP Test Cockpit Variant.
The tested unit cannot be transported.
The test will be aborted.
There will be a message in the test log.
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
In ABAP SQL, which of the following retneves the association field _Airline-Name of a CDS view?
\ Airnline-Name
@_Airline-Name
/_Anine-Name
*_Airline-Name
What are advantages of using a field symbol for internal table row access? Note: There are answers to this question.
The field symbol can be reused for other programs.
A MODIFY statement to write changed contents back to the table is not required.
The row content is copied to the field symbol instead to a work area
Using a field symbol is faster than using a work area.
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 25–40% 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.
References: 1: Using Field Symbols to Process Internal Tables - SAP Learning 2: Access to Internal Tables - ABAP Keyword Documentation - SAP Online Help
/DMO/I_Connection is a CDS view.
What variable type is connection full based on the following code? DATA connection full TYPE
/DMD/I_Connection.
Simple variable
Structure
Internal Table
Based on the following code, the variable type of connection_full is a structure. A structure is a complex data type that consists of a group of related data objects, called components, that have their own data types and names. A structure can be defined using the TYPES statement or based on an existing structure type, such as a CDS view entity or a CDS DDIC-based view. In this case, the variable connection_full is declared using the TYPE addition, which means that it has the same structure type as the CDS view entity /DMO/I_Connection. The CDS view entity /DMO/I_Connection is a data model view that defines a data model based on the database table /DMO/Connection. The CDS view entity /DMO/I_Connection has the following components: carrid, connid, airpfrom, airpto, distance, and fltime. Therefore, the variable connection_full has the same components as the CDS view entity /DMO/I_Connection, and each component has the same data type and length as the corresponding field in the database table /DMO/Connection.
References: CDS Data Model Views - ABAP Keyword Documentation, DATA - ABAP Keyword Documentation, Structure Types - ABAP Keyword Documentation
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.carridAS carrier_id,
11 p.idAS airport_id,
12 c.countnumAS counter_number
13 }
In what order will the join statements be executed?
scarr will be joined with scounter first and the result will be joined with sairport.
sairport will be joined to scounter first and the result will be joined with scarr.
scarr will be joined with sairport first and the result will be joined with scounter.
scounter will be joined to sairport first and the result will be joined with scarr.
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.
References: 1: Join - ABAP Keyword Documentation
Exhibit:
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
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
@UI headerinto description label
@UI.badge.title.label
@EndUserText.quickInfo
@EndUserText label
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.
References: 1: ABAP CDS - SAP Annotations - ABAP Keyword Documentation - SAP Online Help 2: ABAP CDS - Data Definitions - ABAP Keyword Documentation - SAP Online Help