ABAP CDS Views and Internal Tables

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

Which statement is used to change the contents of a row of data in an internal table?

  • Modify table (correct)
  • Insert table
  • Append table
  • Update table

What happens when you use the 'Modify' statement on a standard table in ABAP?

  • It changes the contents of the specified row. (correct)
  • It duplicates the existing row.
  • It removes the specified row.
  • It always appends a new row.

Which of the following operations will result in an error when applied to an internal table?

  • Modify a specific row using a field value.
  • Use 'Modify' with multiple fields.
  • Use 'Modify' on a sorted table.
  • Modify a row that does not exist. (correct)

In what scenario would you NOT use the 'Modify' statement on an internal table?

<p>When you want to append a new row. (A)</p> Signup and view all the answers

Which clause must be included to ensure the 'Modify' statement works correctly for a standard internal table?

<p>WHERE to specify which rows to modify. (A)</p> Signup and view all the answers

What is a consequence of using the 'Modify' statement without the 'WHERE' clause?

<p>All rows in the internal table will be updated. (D)</p> Signup and view all the answers

When using 'Modify' to update a row in an internal table, which of the following must be guaranteed?

<p>The row exists in the table. (A)</p> Signup and view all the answers

What is a typical use case for the 'Modify' statement in ABAP?

<p>To change an existing entry based on user input. (D)</p> Signup and view all the answers

Which of the following statements is true when using the expression itab1 = corresponding #( itab2 )?

<p>Fields with the same name and the same type will be copied from itab2 to itab1. (A)</p> Signup and view all the answers

What is a requirement for the expression itab1 = corresponding #( itab2 ) to work correctly?

<p>itab1 and itab2 must have at least one field name in common. (A)</p> Signup and view all the answers

Which data declarations will allow for the assignment between gv_source and gv_target without truncation or rounding? (Select all that apply)

<p>DATA gv_source TYPE p LENGTH 8 DECIMALS 3 to DATA gv_target TYPE p LENGTH 16 DECIMALS 2. (A), DATA gv_source TYPE c to DATA gv_target TYPE string. (C)</p> Signup and view all the answers

What can happen if fields with the same name but different types are present in itab2 when using itab1 = corresponding #( itab2 )?

<p>They will cause a runtime error. (C)</p> Signup and view all the answers

Which of the following must you consider regarding types when using internal tables?

<p>itab1 and itab2 can have different types as long as names match. (A)</p> Signup and view all the answers

What will be the response when activating a Core Data Service View Entity Data Definition if the field types of the union do not match?

<p>Activation error because the field types of the union do not match. (C)</p> Signup and view all the answers

In which scenarios will the expression itab1 = corresponding #( itab2 ) lead to errors?

<p>When itab1 and itab2 have mismatched types for fields with the same name. (C)</p> Signup and view all the answers

Which select statement would correctly extract the mat field from demo_sales_cds_material_view?

<p>SELECT mat FROM demo_sales_cds_material_view... (B)</p> Signup and view all the answers

Which of the following is classified as a generic internal table type?

<p>STANDARD TABLE (D)</p> Signup and view all the answers

How does the SQL command 'itab1 = corresponding #( itab2 )' determine which fields to copy?

<p>By looking for matching field names and types. (D)</p> Signup and view all the answers

What is one of the outcomes when executing 'itab1 = corresponding #( itab2 )'?

<p>Only fields with similar names and types will be populated in itab1. (B)</p> Signup and view all the answers

What is the variable type of connection_full when defined as DATA connection_full TYPE /DMD/I_Connection?

<p>Structure (A)</p> Signup and view all the answers

What should be the types of itab1 and itab2 when using the expression itab1 = corresponding #( itab2 )?

<p>They have to share at least one common field name. (B)</p> Signup and view all the answers

In the context of ABAP SQL code, which syntax correctly specifies case distinctions?

<p>Using CASE WHEN statements. (A)</p> Signup and view all the answers

What is the primary reason for an activation error in a Core Data Service View?

<p>Field names in the union do not match. (B)</p> Signup and view all the answers

Which of the following describes the use of an internal table type effectively?

<p>An INDEX TABLE can be used for quick access to individual rows. (C)</p> Signup and view all the answers

Flashcards are hidden until you start studying

Study Notes

Core Data Services (CDS)

  • CDS view entities support parameters.
  • Parameters are defined using the @ symbol followed by a variable or expression.
  • Some examples of valid parameters are:
    • $session.system_date (system date)
    • @ (cl_abap_context_info->get_system_date()) (system date)
    • A literal date value in the format YYYYMMDD ('20230101').

CDS Views - Joining

  • CDS views can be joined based on their fields.
  • You can use the ON clause in a JOIN statement to define the join condition.
  • The JOIN clause should reference the fields from the views you want to join.
  • You cannot use the $projection variable in the ON clause because it represents the view's projection, not individual fields.

ABAP Internal Tables

  • You can utilize the itab1 = corresponding #( itab2) statement to copy data from one internal table (itab2) to another (itab1).
  • This statement will copy fields with the same name and data type.
  • Both tables must have at least one field name in common.

ABAP String Manipulation

  • You can use ABAP SQL to manipulate strings within a SELECT statement.
  • The substring, upper, and left functions can be used to extract specific characters from a string.
    • substring(upper('mr joe doe'), 4, 3) will extract the substring "JOE" from the string.
    • upper(left( 'mr joe doe', 6)) will extract the substring "MR JOE" and convert it to uppercase.

ABAP Data Types

  • When assigning a variable to another variable, the types must be compatible to avoid truncation or rounding issues.
  • The TYPE keyword is used to declare a variable's data type.
  • Examples of data types:
    • p - Packed number, c - Character, string - Character string

CDS View Activation Error

  • A CDS view with a union must have matching field names (same names) and data types (compatible types) for successful activation.
  • If the field names in the union do not match, the activation will fail. Similarly, if the field types are incompatible, the activation will fail.

ABAP SQL - Selecting From CDS Views

  • You can select data from a CDS view using SELECT statements in ABAP SQL.
  • The FROM clause should reference the view name, for example:
    • SELECT mat FROM demo_sales_cds_material_ve (select the field named 'mat' from the view demo_sales_cds_material_ve)

ABAP Internal Table Types

  • There are different types of internal tables in ABAP:
    • Standard Table - Default internal table type, no specific ordering.
    • Sorted Table - Table with entries ordered by SORT statement.
    • Hashed Table - Table with entries accessed using a hash key for fast access.
    • Index Table - Table with entries accessed by a specific index number.

ABAP Variables

  • Variables in ABAP can be declared with different data types:
    • Simple variable - Stores a single value.
    • Internal table - Stores a collection of rows.
    • Structure- Groups data into logical units, similar to classes.

ABAP SQL - Case Distinctions

  • CASE statements in ABAP SQL allow you to evaluate different conditions and return specific values.
  • You can use CASE statements to create conditional logic within WHERE clauses and SELECT statements.
  • Valid case distinctions include WHEN clauses and ELSE clauses.

ABAP Internal Table Sorting

  • Sorting is performed using the SORT statement.
  • You can define sorting conditions based on fields and their order (ascending or descending).
  • SORT itab BY field1 field2 will sort the internal table itab ascending by field1 and then field2.

ABAP Internal Table Modifications

  • The MODIFY statement is used to modify the contents of an existing row in an internal table.

ABAP Security - Access Control Objects

  • Access Control Objects (ACOs) define access rights to database tables.
  • They use clauses like:
    • WHERE to define specific conditions for access.
    • GRANT to define access rights.
    • REVOKE to remove access rights.

ABAP SQL Syntax

  • Conventions for SELECT statements in ABAP Open SQL:
    • The INTO TABLE @gt flights clause should appear after the FIELDS clause within the SELECT statement.

ABAP Predicate Conditions

  • CAST can be used to convert data types in ABAP.
  • To ensure a valid CAST operation, the data type being converted should be a SUPPLIED type (meaning it has a value).

ABAP Logical Expression Evaluation

  • The logical operators in ABAP are evaluated in the following order:
    • NOT - highest priority
    • AND - medium priority
    • OR - lowest priority

ABAP Database Table Definitions

  • Key parts of defining a database table:
    • Field list - Defines the fields and their data types.
    • Semantic table attributes - Defines the table's characteristics.
    • Extension - Allows you to add custom fields and logic.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

WO_Answer.pdf

More Like This

Use Quizgecko on...
Browser
Browser