Video Lesson 5.3: ABAP Internal Tables And Work Areas

Learn ABAP

Video Lesson 5.3: ABAP Internal Tables And Work Areas

This lesson will teach you about ABAP internal tables and work areas. Internal tables can be represented as arrays of information with a determined structure.

  • Internal table is a temporary two dimensional memory structure similar to database table.
  • The data is stored line by line in memory, and each line has the same structure.
  • In ABAP, internal tables fulfill the function of arrays.
  • Since they are dynamic data objects, they save the programmer the task of dynamic memory management in his or her programs.
  • A particularly important use for internal tables is for storing and formatting data from a database table within a program.
  • Internal tables are dynamic variable  data objects.
  • Like all other data objects, you can declare internal tables using the LIKE or TYPE addition of the DATA statement.
  • DATA itab TYPE TABLE OF type|LIKE TABLE OF obj
  • Here, the LIKE addition refers to an existing table object in the same program.


Video Lesson 5.2: SAP Data Retrieval Using A Select Loop

Learn ABAP

Video Lesson 5.2: SAP Data Retrieval Using A Select Loop

This lesson shows how to use the ABAP statement SELECT-ENDSELECT to create a loop and retrieve multiple entries from a transparent table.

  • You can use the SELECT loop to read several rows of a database table into the program in succession.
  • The database delivers the data to the database interface of the application server in packages.
  • The specified processing block then copies the records to the target area row-by-row for processing.
  • The return value should be queried after the SELECT loop (that is, after the ENDSELECT statement).
  • You can use the INTO TABLE addition to copy the selected part of the database into an internal table directly instead of doing so row-by-row.
  • This technique is called an array fetch.
  • Since an Array Fetch is not a type of loop processing, no ENDSELECT statement is required or allowed.
  • The Array Fetch must be structured left-justified just like the field list.
  • If an internal table does not meet this prerequisite, you have to use the INTO CORRESPONDING FIELDS OF TABLE addition instead of INTO TABLE.
  • With the array fetch, the content that might be in the internal table is overwritten.
  • If you want to append rows instead, you can use the APPENDING TABLE addition.




Video Lesson 5.1: Read SAP Database Tables

Learn ABAP

Video Lesson 5.1: Read SAP Database Tables

In this lesson you will learn how to retrieve information on database tables and how to read data from them. An overview of techniques that allow you to access multiple database tables will also be covered.

  • SQL is the abbreviation of Structured Query Language, a language that enables define, change, and read access to database tables.
  • Every relational database system has a native SQL, which is unfortunately database-specific.
  • In contrast Open SQL is an SAP-defined, database-independent SQL standard for the ABAP language.

You use the Open SQL statement SELECT to program database read access.

The SELECT statement contains a series of clauses, each of which has a different task:

  • Amongst other things, the SELECT clause describes which fields of the table are to be read.
  • The FROM clause names the source (database table or view) from which the data is to be selected.
  • The INTO clause determines the target variable into which the selected data is to be placed.
  • The WHERE clause specifies the columns of the table that are to be selected.

For information about other clauses, refer to the keyword documentation for the SELECT statement.


Video Lesson 4.13: ABAP Exercise: Flight Information Report Summary

Learn ABAP

Video Lesson 4.13: ABAP Exercise: Flight Information Report Summary

You will be creating a Flight Information report summary using everything you learned in this lesson.

Your assignment is to:

  • Modify the “Flight Report” created earlier so that it shows the Airline Code, No. Flight, Flight Date, Total amount of bookings, Total occupied seats, and Total free seats.
  • Create a structure for the report fields.
  • Make it possible to filter by Airline Code and Flight No.
  • Attach a search help to the input fields filters.




Video Lesson 4.12: ABAP Elementary Search Help

Learn ABAP

Video Lesson 4.12: ABAP Elementary Search Help

This lesson shows how to create an elementary search help as an object in the ABAP dictionary.

An elementary search help defines the standard flow of an input help. You can define the following components of this flow in the search help:

  • Where does the data displayed in the hit list come from (selection method)
  • Which information must be displayed in the dialog box for value selection and in the hit list (search help parameters)
  • Which field contents can be taken into account for hit list selections and which values in the hit list can be returned to the screen fields (search help parameters)
  • Which dialog steps must be executed in the input help (dialog behavior)




Video Lesson 4.11: ABAP Search Helps F4

Learn ABAP

Video Lesson 4.11: ABAP Search Helps F4

This lesson talks about search helps in the ABAP dictionary. Search Helps are useful to display information on the screen for a user to select.

Overview of Search Helps

  • The input help (F4 help) is a standard function of the R/3 System.
  • The user can display the list of all possible input values for a screen field with the input help
  • The possible input values can be enhanced with further information.
  • This standard process can be completely defined by creating a search help in the ABAP Dictionary.
  • There are two types of search help:
  • Elementary Search Helps
  • Collective Search Helps




Video Lesson 4.10: ABAP Loops

Learn ABAP

Video Lesson 4.10: ABAP Loops

This lesson shows how to create loops in ABAP to iterate through a process.

Loops

In a loop, a statement block is executed several times in succession. There are four kinds of loops in ABAP:

  • Unconditional loops using the DO statement.
  • Conditional loops using the WHILE statement.
  • Loops through internal tables and extract data sets using the LOOP statement.
  • Loops through datasets from database tables using the SELECT statement.

Unconditional Loops

  • To process a statement block several times unconditionally, use the following control structure:
  • DO [n TIMES] ...
      [statement_block]
    ENDDO.
  • Use the TIMES addition to restrict the number of loop passes to n.
  • If you do not specify any additions, the statement block is repeated until it reaches a termination statement such as EXIT or STOP.

Video Lesson 4.9: ABAP Logical Expressions

Learn ABAP

Video Lesson 4.9: ABAP Logical Expressions

This lesson shows some of the most common used logical expressions like AND, OR and IF.

Logical Expressions

  • When writing application programs, you often need to formulate conditions.
  • These are used mostly to control the flow of the program, or to decide whether to exit a processing block.
  • You formulate a condition using logical expressions. A logical condition can be either true or false.

Combining Several Logical Expressions (AND, OR)

  • To combine several logical expressions together in one single expression which is true only if all of the component expressions are true, link the expressions with AND.
  • To combine several logical expressions together in one single expression which is true if at least one of the component expressions is true, link the expressions with OR.
  • To negate the result of a logical expression, you can precede it with the NOT operator. → SAP VIDEO



Video Lesson 4.8: ABAP IF statement and CASE

Learn ABAP

Video Lesson 4.8: ABAP IF statement and CASE

This lesson shows how to use the IF statement and the CASE statement for conditioning.

  • In ABAP you have two ways to execute different sequences of statements, depending on certain conditions:
  • In the IF construct you can define any logical expressions as check conditions.
  • You can use nested IF statements, using the ELSEIF clause.
  • You can use the CASE construct to clearly distinguish cases.
  • The content of the field specified in the CASE part is checked against the data objects listed in the WHEN branches to see whether they match.

  • In both constructs the condition or match check happens sequentially from the top down.
  • As soon as the statement block of a branch has been executed, the system immediately jumps to ENDIF or ENDCASE.



Video Lesson 4.7: Dialog Messages

Learn ABAP

Video Lesson 4.7: Dialog Messages

In this lesson you will learn about the different dialog messages that SAP present.

Dialog Messages

  • You use the MESSAGE statement to send dialog messages to the users of your Program.
  • When you do this, you must specify the three digit message number and the message class.

  • Message number and message class clearly identify the message to be displayed.
  • You use the message type to specify where the message is to be displayed.
  • You can test the display behavior for using the different message types by means of the DEMO_MESSAGES demo program that is shipped in the SAP standard.

For further information on the syntactical alternatives to the MESSAGE statement, refer to the keyword documentation.