In class ZCL_CLASS_A, you use the statement DATA var TYPE *** What may stand in place of ***? Note: There are 2 correct answers to this question.
Correct Answer: B,D
In class ZCL_CLASS_A, you use the statement DATA var TYPE *** to declare a data object named var with a data type specified by ***. The data type can be any of the following1: * A predefined ABAP type, such as i, f, c, string, xstring, and so on. * A data element from the ABAP Dictionary, such as matnr, carrid, bukrs, and so on. A data element defines the semantic and technical attributes of a data field, such as the domain, the length, the data type, the description, and the value range2. * A domain from the ABAP Dictionary, such as matnr_d, carrid_d, bukrs_d, and so on. A domain defines the technical attributes of a data field, such as the data type, the length, the output length, the number of decimal places, and the value range3. * A type defined globally in a class, an interface, or a type pool, such as zcl_class_b=>type_a, zif_interface_c=>type_b, ztype_pool_d=>type_c, and so on. A global type is a type that is defined in a global repository object and can be used in any program or class4. * A type defined locally in the current class, such as type_a, type_b, type_c, and so on. A local type is a type that is defined in the declaration part of a class and can only be used within the class5. Therefore, the possible values for *** are B. the name of a data element from the ABAP Dictionary and D. the name of a domain from the ABAP Dictionary. The other options are not valid because: * A. The name of a type defined privately in class ZCL_CLASS_A is a local type and cannot be used with the DATA statement. A local type can only be used with the TYPES statement5. * C. The name of a type defined privately in another class is a private type and cannot be accessed from outside the class. A private type can only be used within the class that defines it. References: 1: DATA - ABAP Keyword Documentation 2: Data Elements - ABAP Dictionary - SAP Online Help 3: Domains - ABAP Dictionary - SAP Online Help 4: Global Types - ABAP Keyword Documentation 5: Local Types - ABAP Keyword Documentation : Private Types - ABAP Keyword Documentation
Question 72
Refer to the Exhibit. What are valid statements? Note: There are 2 correct answers to this question.
Correct Answer: C,D
The code snippet in the image is an example of using the RAISE EXCEPTION statement to raise a class-based exception and create a corresponding exception object. The code snippet also uses the EXPORTING addition to pass parameters to the instance constructor of the exception class12. Some of the valid statements about the code snippet are: The code creates an exception object and raises an exception: This is true. The RAISE EXCEPTION statement raises the exception linked to the exception class zcxl and generates a corresponding exception object. The exception object contains the information about the exception, such as the message, the source position, and the previous exception12. "previous" expects the reference to a previous exception: This is true. The previous parameter is a predefined parameter of the instance constructor of the exception class cx_root, which is the root class of all class-based exceptions. The previous parameter expects the reference to a previous exception object that was caught during exception handling. The previous parameter can be used to chain multiple exceptions and preserve the original cause of the exception12. You cannot do any of the following: "zcxl" is a dictionary structure, and "paraml" and "param2" are this structure: This is false. zcxl is not a dictionary structure, but a user-defined exception class that inherits from the predefined exception class cx_static_check. param1 and param2 are not components of this structure, but input parameters of the instance constructor of the exception class zcxl. The input parameters can be used to pass additional information to the exception object, such as the values that caused the exception12. "paraml" and "param2" are predefined names: This is false. param1 and param2 are not predefined names, but user-defined names that can be chosen arbitrarily. However, they must match the names of the input parameters of the instance constructor of the exception class zcxl. The names of the input parameters can be declared in the interface of the exception class using the RAISING addition12.
Question 73
Which statement can you use to change the contents of a row of data in an internal table?
Correct Answer: B
The statement that can be used to change the contents of a row of data in an internal table is MODIFY table. The MODIFY table statement can be used to change the contents of one or more rows of an internal table, either by specifying the table index, the table key, or a condition. The MODIFY table statement can also be used to change the contents of a database table, by specifying the table name and a work area or an internal table. The MODIFY table statement can use the TRANSPORTING addition to specify which fields should be changed, and the WHERE addition to specify which rows should be changed. The other statements are not suitable for changing the contents of a row of data in an internal table, as they have different purposes and effects. These statements are: * APPEND table: This statement can be used to add a new row of data to the end of an internal table, either by specifying a work area or an inline declaration. The APPEND table statement does not change the existing rows of the internal table, but only increases the number of rows by one. * INSERT table: This statement can be used to insert a new row of data into an internal table, either by specifying the table index, the table key, or a sorted position. The INSERT table statement does not change the existing rows of the internal table, but only shifts them to make room for the new row. The INSERT table statement can also be used to insert a new row of data into a database table, by specifying the table name and a work area or an inline declaration. * UPDATE table: This statement can be used to update the contents of a database table, by specifying the table name and a work area or an internal table. The UPDATE table statement can use the SET addition to specify which fields should be updated, and the WHERE addition to specify which rows should be updated. The UPDATE table statement does not affect the internal table, but only the corresponding database table. References: MODIFY table - ABAP Keyword Documentation, APPEND table - ABAP Keyword Documentation, INSERT table - ABAP Keyword Documentation, UPDATE table - ABAP Keyword Documentation
Question 74
To adhere to the most recent ABAP SQL syntax conventions from SAP, on which line must you insert the "INTO TABLE @gt flights" clause to complete the SQL statement?
Correct Answer: B
To adhere to the most recent ABAP SQL syntax conventions from SAP, you must insert the "INTO TABLE @gt flights" clause on line #4 to complete the SQL statement. This is because the INTO or APPENDING clause should be specified immediately after the SELECT clause, according to the ABAP SQL syntax conventions1. The INTO or APPENDING clause defines the data object to which the results set of the SELECT statement is assigned. The data object can be an internal table, a work area, or an inline declaration. In this case, the data object is an internal table named gt_flights, which is created using the inline declaration operator @DATA. The inline declaration operator allows you to declare and create a data object in the same statement where it is used, without the need for a separate DATA statement2. The other lines are not suitable for inserting the "INTO TABLE @gt flights" clause, as they would violate the ABAP SQL syntax conventions or cause syntax errors. These lines are: * #6: This line is not suitable for inserting the "INTO TABLE @gt flights" clause, as it would cause a syntax error. This is because the FROM clause must be specified before the INTO or APPENDING clause, according to the ABAP SQL syntax conventions1. The FROM clause defines the data sources from which the data is read, such as database tables, CDS view entities, or CDS DDIC-based views. In this case, the data source is the database table flights. * #8: This line is not suitable for inserting the "INTO TABLE @gt flights" clause, as it would cause a syntax error. This is because the ORDER BY clause must be specified after the INTO or APPENDING clause, according to the ABAP SQL syntax conventions1. The ORDER BY clause defines the sort order of the results set of the SELECT statement. In this case, the results set is sorted by the fields carrid, connid, and fltime. * #15: This line is not suitable for inserting the "INTO TABLE @gt flights" clause, as it would violate the ABAP SQL syntax conventions. This is because the INTO or APPENDING clause should be specified as close as possible to the SELECT clause, according to the ABAP SQL syntax conventions1. The INTO or APPENDING clause should not be separated from the SELECT clause by other clauses, such as the WHERE clause, the GROUP BY clause, the HAVING clause, the UNION clause, or the ORDER BY clause. This is to improve the readability and maintainability of the ABAP SQL statement. References: SELECT - ABAP Keyword Documentation, Inline Declarations - ABAP Keyword Documentation
Question 75
Exhibit Which of the following ABAP SQL snippets are syntactically correct ways to provide a value for the parameter on line #4? Note: There are 2 correct answers to this question