Top Banner
ABAP stands for Advanced Business Application Programming.It is a high-level programming languages used in the SAP software for customization and other development purposes. ABAP syntax is almost similar to COBOL language.It was the first language that includes the concept of Logical Databases.All ABAP programs stored inside the SAP databases and executed under the control of the run-time system, which is part of the SAP kernel. ABAP program will look like as following image SAP MENU PAINTER & SCREEN PAINTER Menu Painter is a ABAP workbench tool and can be accessed using the transaction SE41.This tool is for handling the texts in menus and the application toolbar. Screen Painter is a ABAP workbench tool and can be accessed using the transaction SE51.This tool is for handling Icons for text fields, output fields and pushbuttons ,scrollable fields etc.This tool also will do a consistency check, which warns if modules or fields from a screen are not defined in the respective program.
87
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1-ABAP

ABAP stands for Advanced Business Application Programming.It is a high-level programming languages used in the SAP software for customization and other development purposes. ABAP syntax is almost similar to COBOL language.It was the first language that includes the concept of Logical Databases.All ABAP programs stored inside the SAP databases and executed under the control of the run-time system, which is part of the SAP kernel.

ABAP program will look like as following image

SAP MENU PAINTER & SCREEN PAINTERMenu Painter is a ABAP workbench tool and can be accessed using the transaction SE41.This tool is for handling the texts in menus and the application toolbar. Screen Painter is a ABAP workbench tool and can be accessed using the transaction SE51.This tool is for handling Icons for text fields, output fields and pushbuttons ,scrollable fields etc.This tool also will do a consistency check, which warns if modules or fields from a screen are not defined in the respective program.

SAP DICTIONARY– ABAP DDICSAP DDIC stands for data dictionary.The ABAP dictionary contains all the metadatas

about the data in SAP system.Its related to ABAP workbench and developers used

this data for displaying and maintaining this metadata.

Page 2: 1-ABAP

Tables

Indexes

Views

Structures

Data elements

Domains

Search helps and

Lock objects

are some of the important types of dictionary objects.

INTERNAL TABLES IN ABAPSAP Internal Tables are used in ABAP programs.Its used for storing complicated

data structures in working memory.Data is stored in a line by line fashion in memory

and each line will have the same structure.Internal tables do all the operations like

arrays in other programming languages.Data in Internal table will be deleted after the

program quit.One of the main usage of Internal tables are storing the data from

database tables before doing any formatting and modifications. In this page you will

get some ABAP Internal table Tutorials and pdf study materials to download.

Internal table Declaration 

Sample Program with LOOP

Page 3: 1-ABAP

ABAP SYNTAX & KEYWORDSA                                                                                                                                                                                                       ADD for single fields

Adds two single fields.

Syntax

ADD

<n> TO <m>.

The contents of <n> are

added to the contents of <m> and the results are stored in <m>. This is

equivalent to: <m> = <m> + <n>.

ADD for field sequences

Adds sequences of fields

in storage.

Syntax

ADD

<n1> THEN <n2> UNTIL <nz> GIVING <m>.

ADD

<n1> THEN <n2> UNTIL <nz> ACCORDING TO <sel> GIVING <m>.

ADD

<n1> THEN <n2> UNTIL <nz> TO <m>.

ADD

<n1> FROM <m1> TO <mz> GIVING <m>.

If <n1>, <n2>,…, <nz>

is a sequence of fields with the same distance to one another and if they

have the same type and length, these fields are added and the result is

Page 4: 1-ABAP

stored in <m>. Different variants allow you to limit fields to a

subsequence, to include <m> in the sum, and to perform the operation on a

sequence of fields that directly follow one another.

ADD-CORRESPONDING

Adds subfields of

structures.

Syntax

ADD-CORRESPONDING <struc1> TO <struc2>.

All the subfields of the

structures <struc1> and <struc2> having the same name are added and the

results are stored in <struc2>.

ALIASES

Defines class-specific

alias names for an interface component in ABAP objects.

Syntax

ALIASES <alias> FOR <intf~comp>.

<alias> is defined

within a class or interface as synonymous with the interface component <intf~comp>.

APPEND

Appends a line or

multiple lines to the end of an index table.

Syntax

APPEND <line>|LINES OF <jtab>

TO <itab>

       [ASSIGNING <FS> | REFERENCE INTO <dref>].

A line <line> or

multiple lines of an internal table <jtab> are appended to index table <itab>.

If you use ASSIGNING or INTO REFERENCE, field symbol <FS> refers to the

appended line or the relevant data reference is stored in <dref> after the

statement.

ASSIGN

Assigns a field to a

field symbol.

Syntax

Page 5: 1-ABAP

ASSIGN <f> [INCREMENT <n>] TO <FS> 

           [CASTING [TYPE <t>|LIKE <f>] [DECIMALS <d>]] [RANGE <r>].

Data object <f> is

assigned to field symbol <FS>. <FS> now points to the data object. After the

addition INCREMENT <n>, the storage area that is offset <n> times by a

length of <f> starting with <f> is assigned to the field symbol. Pointed

brackets are part of the syntax for field symbol names. The CASTING addition

permits you to cast data objects when assigning field symbols. The RANGE

addition defines the storage area in which either offset/length accesses or

the INCREMENT addition are allowed. In Unicode programs, standard access is

only allowed within the field limits of <f>, but this can be extended with

RANGE. In non-Unicode programs, standard access is possible up to the

boundary of the data segment and can be limited with RANGE.

Syntax

ASSIGN <dref>->* TO <FS> [CASTING … ].

Dereferencing of the

data reference in <dref>. The data object to which the data reference refers

is assigned to field symbol <FS>.

AT for event blocks

Event keywords for

defining event blocks for screen events.

Syntax

AT

SELECTION-SCREEN…

AT

LINE-SELECTION.

AT

USER-COMMAND.

AT

PFn.

User actions on a

selection screen or on a list trigger certain events in the ABAP runtime

environment. The event keywords define event blocks that are called when

events occur.

AT for group change

Page 6: 1-ABAP

Change of group when

processing loops of extracts and internal tables.

Syntax

AT

NEW <f>.

AT

END OF <f>.

AT

FIRST.

AT

LAST.

AT

<fg>.

The statements are used

to process group levels within a loop using an extract dataset or an

internal table. They introduce statement blocks that must be closed with

ENDAT. The statements between AT and ENDAT are only executed if the

corresponding group change occurred.

AUTHORITY-CHECK

Checks user

authorization.

Syntax

AUTHORITY-CHECK OBJECT <object> ID <name1> FIELD <f1>

                                ID <name2> FIELD <f2>

                               …

                                ID <name10> FIELD <f10>.

There is a check if the

program user has all the authorizations defined in authorization object

<object>. <name1>,…, <name10> are the authorization fields of the

authorization object. <f1>,… <f1>, …, <f10> are data objects of the

program. The value of the data objects is checked against the authorization

fields.

B                                                                                                                                                                                                       BACK

Page 7: 1-ABAP

Relative position of the

output in a list.

Syntax

BACK.

Positions the list

output either in the first column of the first line following the page

header of the current page or in connection with RESERVE in the first column

of the first line of a line block.

BREAK-POINT

Calls the Debugger.

Syntax

BREAK-POINT.

Interrupts execution of

the program and goes to debugging mode. Is used as a test help. Normal

program processing is interrupted when this statement is reached and the

system goes to a debugger.

C                                                                                                                                                                                                       CALL CUSTOMER-FUNCTION

Calls the customer

function modules.

Syntax

CALL CUSTOMER-FUNCTION <func>…

Similar to CALL

FUNCTION. The function modules must be programmed and activated within the

customer’s modification concept.

CALL FUNCTION

Calls the function

modules.

Syntax

CALL FUNCTION <func>

[EXPORTING … fi = a i… ] 

                     [IMPORTING … fi = a i… ] 

                     [CHANGING  … fi = a i… ] 

Page 8: 1-ABAP

                     [TABLES    … fi = a i… ] 

                     [EXCEPTIONS… ei = r i… ] 

              [DESTINATION <dest>]

              [IN UPDATE TASK]

              [STARTING NEW TASK]

              [IN BACKGOUND TASK].

The program calls either

a function module in the same R/3 System, or one from an external system,

depending on the variant of the statement you use. You can call update

modules when processing transactions. You can also call functions

asynchronously. The other additions are used to specify actual parameters

for the parameter interface for the function module, <func>, and to handle

exceptions.

CALL DIALOG

Calls a dialog module.

Syntax

CALL DIALOG <dialog>

[AND SKIP FIRST SCREEN]

                     [EXPORTING… fi = a i… ]   

                     [IMPORTING… fi = a i… ] 

                     [USING itab].

Calls the dialog module

<dial>. A dialog module is an ABAP program with a sequence of screens. It

does not have to be started using a transaction code, or run in the same SAP

LUW, like the calling program. The additions are used to skip the initial

screen in the sequence and specify actual parameters for the parameter

interface of the dialog module.

CALL METHOD

Calls a method in ABAP

Objects.

Syntax

CALL METHOD <meth>

[EXPORTING … <ii> =.<f i>… ] 

                   [IMPORTING … <ei> =.<g i>… ]

                   [CHANGING  … <ci> =.<f i>… ]

                   [RECEIVING r = h ]

Page 9: 1-ABAP

                   [EXCEPTIONS… <ei> = r i…     ]

                   [PARAMETER-TABLE <ptab>]

                   [EXCEPTION-TABLE <etab>].

[CALL METHOD]<meth>( …

).

Calls a method <meth>.

The additions are used to specify actual parameters for the parameter

interface for the function module and to handle exceptions. The last two

additions pass parameters dynamically in a dynamic method call.

Alternatively, if the method is called statically, the parameters can be

specified using parenthesis notation (as you can when specifying parameters

in a CALL METHOD statement). You can also use functional methods with this

syntax in operand positions.

CALL METHOD OF

Calls a method in OLE2

Automation.

Syntax

CALL METHOD OF <obj> <m>.

Calls the method, <m>,

of the OLE2 Automation Object, <obj>.

CALL SCREEN

Calls a screen sequence.

Syntax

CALL SCREEN <scr>

            [STARTING AT <X1> <Y1>]

            [ENDING AT <X2> <Y2>].

Calls the sequence of

screens that begins with the screen <scr>. All the screens in the screen

sequence belong to the current ABAP program. The screen sequence ends when

the program reaches the screen numbered 0. The additions let you call a

single screen in a new window.

CALL SELECTION-SCREEN

Calls a selection

screen.

Syntax

Page 10: 1-ABAP

CALL SELECTION-SCREEN <scr>

                      [STARTING AT <x1> <y 1>] 

                      [ENDING AT <x2> <y 2>].

Calls a selection screen

defined in an ABAP program. The selection screen is processed in the program

in the AT SELECTION-SCREEN event. The additions let you call a selection

screen in a new window.

CALL TRANSACTION

Call a transaction.

Syntax

CALL TRANSACTION <tcod>

                 [AND SKIP FIRST SCREEN] 

                 [USING <itab>].

Calls the transaction <tcod>

after having received data from the calling program. At the end of the

transaction that has been called, the system returns to the statement

following the call in the calling report. The additions are used to skip the

initial screen in the sequence or to pass a batch input table to the

transaction.

CASE

Conditional branch.

Syntax

CASE <f>.

Opens a CASE control

structure that ends with an ENDCASE statement. The CASE control structure

allows you to control which statement blocks (introduced by WHEN) are

processed, based on the contents of a data object.

CATCH

Catches a class-based

exception.

CATCH <cx1> … <cxn> [INTO <ref>].

You can only use this

statement in a TRY-ENDTRY block, where you define a handler for one or more

Page 11: 1-ABAP

class-based exceptions. You can use INTO to place a reference to the

exception object into the reference variable <ref>.

CATCH SYSTEM-EXCEPTIONS

Catches a catchable

runtime error.

Syntax

CATCH SYSTEM-EXCEPTIONS <except1> = <rc 1>… <except

n> = <rc n>.

Introduces a CATCH area,

which ends with an ENDCATCH statement. If a catchable runtime error <excepti>,

occurs between CATCH and ENDCATCH, the current processing block is

interrupted. The system jumps to the appropriate ENDCATCH statement and

fills SY-SUBRC with <rc i>.

CHECK

Conditionally leaves a

loop or processing block.

Syntax

CHECK <logexp>.

If the logical

expression <logexp> is true, the system continues with the next statement.

If it is false, processing within the loop is interrupted at the current

loop pass, and the next loop pass is performed. Otherwise the system leaves

the current processing block. In conjunction with selection tables, and

inside GET events, you can use an extra variant of the CHECK statement.

CLASS Declaration

Declares a class in ABAP

Objects.

Syntax

CLASS <class> DEFINITION [PUBLIC]

              [INHERITING FROM <superclass>]

              [ABSTRACT]

              [FINAL]

              [CREATE PUBLIC|PROTECTED|PRIVATE]

              [FRIENDS <cif1> <cif 2> …] 

Page 12: 1-ABAP

              [DEFERRED]

              [LOAD].

Introduces the

declaration part of a class, <class>. The declaration part ends with

ENDCLASS and contains the declaration of all the components of the class.

The PUBLIC addition is generated only by the Class Builder. It defines a

global class in the Class Library. The INHERITING FROM addition lets you

derive the class, <class>, from a superclass, <superclass>. The ABSTRACT

addition defines an abstract class, which cannot be instantiated. The FINAL

addition defines a class that cannot have any subclasses. The CREATE

addition specifies who can instantiate the class. FRIENDS allows you to

specify other classes or interfaces, <cif> that can access the private

components of the class and instantiate objects of the class, independently

of the CREATE addition. The DEFERRED addition makes the class known to the

program before it is declared. The LOAD addition loads a class explicitly

from the Class Library.

CLASS � Implementation

Implements a class in

ABAP Objects.

Syntax

CLASS <class> IMPLEMENTATION.

Introduces the

implementation part of a class, <class>. The implementation part ends with

ENDCLASS and contains the implementation of all the components of the class.

CLASS-DATA

Declares static

attributes of a class or interface.

Syntax

CLASS-DATA <a>…

Like DATA. However, the

attribute <a> is declared as a static attribute. Static attributes are not

instance-specific. Their content is shared by all instances.

CLASS-METHODS

Declares static methods

of a class or interface.

Syntax

Page 13: 1-ABAP

CLASS-METHODS <meth>…

Like METHODS, except

that the method <meth> is declared as a static method. A static method can

access static attributes and can only trigger static events.

CLASS-EVENTS

Declares static events

of a class or interface.

Syntax

CLASS-EVENTS <evt>…

Like EVENTS, except that

the event <evt> is declared as a static attribute. Static events are the

only type of event that can be triggered in a static method.

CLEANUP

Tidies up after

class-based exceptions.

CLEANUP.

Can only be used within

a TRY-ENDTRY block, where it defines a control block. If a class-based

exception is not caught with a CATCH statement, the system executes the

statements between CLEANUP and ENDTRY, before passing the exception along

the call hierarchy.

CLEAR

Sets a variable to its

initial value.

Syntax

CLEAR <f>.

The variable <f>, which

can have any data type, is set to an initial value appropriate to its type.

CLOSE DATASET

Closes a file.

Syntax

CLOSE DATASET <dsn>.

Page 14: 1-ABAP

Closes a file opened

with OPEN DATASET on the application server.

CLOSE CURSOR

Closes a database

cursor.

Syntax

CLOSE CURSOR <c>.

Closes a cursor opened

with OPEN CURSOR.

COLLECT

Aggregates lines and

then adds them to an internal table.

Syntax

COLLECT <line> INTO <itab>

       [ASSIGNING <FS> | REFERENCE INTO <dref>].

The system checks

whether there is already a table entry that matches the key. If there is no

corresponding entry already in the table, the COLLECT statement has the same

effect as INSERT. If an entry with the same key already exists, the COLLECT

statement does not append a new line, but adds the contents of the numeric

fields in the work area <line> to the contents of the fields in the existing

entry. If you use ASSIGNING or INTO REFERENCE, field symbol <FS> refers to

the inserted line or the relevant data reference is stored in <dref> after

the statement.

COMMIT

Closes a SAP LUW.

Syntax

COMMIT WORK [AND WAIT]

Writes all the database

changes and releases all the database locks. Triggers updating. The AND WAIT

addition forces the program to wait until the system has finished updating

the database. Otherwise, updating is asynchronous.

COMMUNICATION

Enables two programs to

communicate with each other.

Syntax

Page 15: 1-ABAP

COMMUNICATION INIT DESTINATION <dest> ID <id> [additions].

COMMUNICATION ALLOCATE ID <id> [additions].

COMMUNICATION ACCEPT ID <id> [additions].

COMMUNICATION SEND ID <id> BUFFER <f> [additions].

COMMUNICATION RECEIVE ID <id> [additions].

COMMUNICATION DEALLOCATE ID <id> [additions].

The statement

initializes, creates, and accepts communication between two programs; lets

these two programs send and receive data; and then closes the connection.

COMPUTE

Performs numeric

operations.

Syntax

COMPUTE <n> = <expression>.

The result of the

mathematical operation specified in <expression> is assigned to the field

<n>. The keyword COMPUTE is optional.

CONCATENATE

Concatenates (chains)

several strings to a string.

Syntax

CONCATENATE <c1>… <cn> INTO <c> [ SEPARATED BY <s> ] 

                                  [IN BYTE MODE|IN CHARACTER MODE].

This statement

concatenates the strings <c1> to <cn> and assigns the result to <c>. The

addition SEPARATED BY <s> allows you to specify a character field <s> which

is placed in its defined length between the individual fields. In Unicode

programs, you must specify whether the statement is a character or byte

operation, using the IN BYTE MODE or IN CHARACTER MODE (default) additions.

CONDENSE

Page 16: 1-ABAP

Removes spaces from a

string

Syntax

CONDENSE <c> [NO-GAPS].

This statement removes

any leading blanks from the field <c> and replaces other sequences of blanks

by exactly one blank. If the addition NO-GAPS is specified, all blanks are

removed.

CONSTANTS

Declares constant data

objects.

Syntax

CONSTANTS <c>… VALUE [<val> | IS INITIAL]…

The syntax is similar to

DATA, except that the VALUE addition is required, and that internal tables

and deep structures cannot be declared as constants The start value

specified in the VALUE addition cannot be changed during the execution of

the program.

CONTINUE

Ends a loop pass.

Syntax

CONTINUE.

Only possible within

loops. This statement terminates the current loop pass and starts the next

CONTEXTS

Declares a context.

Syntax

CONTEXTS <c>.

Generates an implicit

data type CONTEXT_<c>, which you can use to create context instances

CONTROLS

Defines a control.

Syntax

CONTROLS <ctrl> TYPE <ctrl_type>.

Page 17: 1-ABAP

Defines an ABAP runtime

object <ctrl>. This displays data in a particular format on a screen,

depending on the type <ctrl_type> Currently, <ctrl_type> may be a table

control or tabstrip control

CONVERT f�r Dates

Converts a data into an

inverted date form.

Syntax

CONVERT DATE <d1> INTO INVERTED-DATE <d2>.

CONVERT INVERTED-DATE <d1> INTO DATE <d2>.

If <d1> and <d2> are

date fields in the internal form YYYYMMDD, the nines complement of <d1> is

placed in field <d2> and vice versa. In inverted date format, the most

recent date has the smaller numerical value

CONVERT for Timestamps

Converts a timestamp

into the correct date and time for the current time zone

Syntax

CONVERT TIME STAMP <tst> TIME ZONE <tz> INTO DATE <d> TIME <t>.

CONVERT DATE <d> TIME <t> INTO TIME STAMP <tst> TIME ZONE <tz>.

As long as <tst> has

type P(8) or P(11) with 7 decimal placed, and <tz> has type C(6), the time

stamp <tst> will be converted to the correct date <d> and time <t> for the

time zone <tz>.

CONVERT for Text

Converts a text into a

format that can be sorted alphabetically.

Syntax

CONVERT TEXT <text> INTO SORTABLE CODE <x>.

<text> must have type C

and <x> must have type X. The string is then converted so that the relative

order of the characters allows them to be sorted alphabetically in the

current text environment

Page 18: 1-ABAP

CREATE DATA

Creates a dynamic data

object.

Syntax

CREATE DATA <dref> TYPE

<type>|LIKE <obj>.

CREATE DATA <dref> TYPE

LINE OF <itab>|LIKE LINE OF <itab>.

CREATE DATA <dref> TYPE

REF TO DATA|<type>.

CREATE DATA <dref> TYPE

TYPE|LIKE <tabkind> OF <linetype> WITH <key>.

If <dref> is a data

reference variable, a data object of the specified type is created. The

reference in <dref> points to this object. You can omit the TYPE declaration

in fully-typed reference variables.

CREATE OBJECT in ABAP Objects

Instantiates an object

in ABAP Objects.

Syntax

CREATE OBJECT <oref> [TYPE <class>] [EXPORTING … <ii> =.<fi>… ].

<cref> must be a

reference variable, defined with reference to a class. CREATE OBJECT then

creates an object of that class, to which the reference in <cref> then

points The reference in <dref> points to this object. If <oref> is a typed

class reference variable with reference to a subclass of <class>, or if <oref>

is an interface reference variable, whose interface is implemented in the

class <class>, you can specify the class of the instantiated object

explicitly in a TYPE addition, to establish the dynamic type of the

reference variables. The EXPORTING addition specifies the non-optional

IMPORTING parameters of the instance constructor of the class of the

instantiated object.

CREATE OBJECT in OLE2 Automation

Instantiates an external

object in OLE2 Automation.

Syntax

Page 19: 1-ABAP

CREATE OBJECT <obj> <class>.

If <class> is a class

assigned to an automation server, an initial object <obj> of this class is

created

D                                                                                                                                                                                                       DATA with Reference to

Known Data Types

Declares variables with

a previously-declared data type

Syntax

DATA <f>… [TYPE

<type>|LIKE <obj>]… [VALUE <val>].

Declares a variable <f>

with the fully-defined data type <type> or the same data type as another

data object <obj>. The data type <type> can be D, F, I, T, a type defined

locally in the program using the TYPES statement, or a type from the ABAP

Dictionary. The data object <obj> is a data object or line of an internal

table that has already been defined. The VALUE addition specifies a starting

value.

DATA with Reference to

Generic Data Types

Declares variables by

completing the description of a generic type

Syntax

DATA <f>[(<length>)]

TYPE <type> [DECIMALS <d>]… [VALUE <val>].

DATA <f> TYPE <itab>.

The data type <type> can

be C, N, P, X, STRING or XSTRING. The <length> option sets the field length.

If you omit it, the field length is set to the appropriate initial value. If

<type> is P, you can specify the number of decimal places using the DECIMALS

<d> addition. If you omit this, the number of decimal places is set to 0. If

you do not use the TYPE addition, the system uses the default predefined

generic type C.

Syntax

DATA <f> TYPE <itab>.

Page 20: 1-ABAP

The data type <itab> is

a standard internal table with generic key. The default key is automatically

used in the DATA statement.

DATA, Creating an

Associated Data Type

Declares variables with

data types that only exist as an attribute of the variable.

Syntax

DATA <f> TYPE REF TO

<class>|<interface>.

The variable <f> is

defined as an object reference variable for the class <class> or interface

<interface>.

Syntax

DATA <f> TYPE REF TO

DATA|<type>.

Declares the variable

<f> as a data reference variable for a data object.

Syntax

DATA: BEGIN OF

<structure>,

       …

        <fi>…, 

       …

END OF <structure>.

Combines the variables <fi>

to form the structure <structure>. The individual variables within a

structure are addressed in the program with a hyphen between the structure

name and component name as follows: <structure>-<f i>.

Syntax

DATA <f> TYPE|LIKE <tabkind>

OF <linetype> WITH <key>.

The variable <f> is

declared as an internal table with the table kind <tabkind>, line type <linetype>,

and key <key>.

Syntax

DATA <f> TYPE|LIKE RANGE

OF <type>|<obj>.

Page 21: 1-ABAP

Declares the variable

<f> as a RANGES table. A RANGES table has the same data type as a selection

table, but is not linked to input fields on a selection screen.

DATA statement for Shared

Data Areas

Declares shared data

areas in a program.

Syntax

DATA: BEGIN OF COMMON PART <c>,

         <f 

i>. 

..

      END OF COMMON PART.

The variables <fi>

are assigned to a data area <c>, which can be defined in more than one

program. These data areas use the same memory addresses for all programs

that are loaded into the same internal session.

DEFINE

Defines a macro.

Syntax

DEFINE <macro>.

Introduces the

definition of the macro <macro>. Each macro must consist of complete ABAP

statement and be concluded with the END-OF-DEFINITION statement.

DELETE for Files

Deletes files on the

application server

Syntax

DELETE DATASET <dsn>.

Deletes the file <dsn>

from the file system of the application server.

DELETE for Database Table

Entries

Deletes entries from

database tables.

Page 22: 1-ABAP

Syntax

DELETE FROM <dbtab> WHERE <cond>.

All of the lines in the

database table that satisfy the conditions in the WHERE clause are deleted.

Syntax

DELETE <dbtab> FROM <wa>.

DELETE <dbtab> FROM

TABLE <itab>.

This deletes the line

that has the same primary key as the work area <wa>, or deletes all the

lines in the database that have the same primary key as a line in the

internal table <itab>. The work area <wa> or the lines of the internal table

<itab> must have at least the same length as the work area of the database

table.

DELETE for Cluster

Databases

Deletes data clusters

from cluster database tables.

Syntax

DELETE FROM DATABASE <dbtab>(<ar>)

ID <key>.

Deletes the entire

cluster in area <ar> with the name <key> from the cluster database table <dbtab>.

DELETE for the

Cross-Transaction Application Buffer

Deletes data clusters

from the cross-transaction application buffer.

Syntax

DELETE FROM SHARED

BUFFER <dbtab>(<ar>) ID <key>.

Deletes the data cluster

for the area <ar> with the name <key> stored in the cross-transaction

application buffer for the table <dbtab>.

DELETE for Lines from an

Internal Table

Page 23: 1-ABAP

Deletes lines from

internal tables of any type.

Syntax

DELETE TABLE <itab> FROM

<wa>.

DELETE TABLE <itab> WITH

TABLE KEY <k1> = <f 1>… <k n> = <f n>.

Deletes using the table

key. All lines with the same key are deleted. The key values are taken

either from a compatible work area <wa> or specified explicitly.

Syntax

DELETE <itab> WHERE <cond>.

Deletes using

conditions. Deletes all table entries that satisfy the logical expression <cond>.

The logical condition can consist of more than one comparison. In each

comparison, the first operand must be a component of the line structure.

Syntax

DELETE ADJACENT

DUPLICATE ENTRIES FROM <itab> [COMPARING… ].

Deletes adjacent

duplicate entries, either by comparing the key fields or the comparison

fields specified explicitly in the COMPARING addition.

DELETE for Lines from Index

Tables

Deletes entries from

index tables.

Syntax

DELETE <itab> [INDEX <idx>].

If you use the INDEX

addition, the line with index <idx> is deleted from the table <itab>.

Without the INDEX addition, you can only use the above statement within a

LOOP. In this case, you delete the current line.

Syntax

DELETE <itab> [FROM <n1>]

[TO <n 2>] [WHERE <cond>].

The system deletes all

of the lines of <itab> whose index lies between <n 

Page 24: 1-ABAP

1

> and <n 

2

> and who meet the

conditions specified in the WHERE clause. If you do not specify a FROM

addition, the system deletes lines from the first line onwards. If you do

not specify a TO addition, the system deletes lines up to the last line. The

logical condition can consist of more than one comparison. In each

comparison, the first operand must be a component of the line structure.

DEMAND

Retrieves values from a

context instance.

Syntax

DEMAND <val1>

= <f 1>… <val n> = <f n> FROM CONTEXT

<inst> 

                                        [MESSAGES INTO <itab>].

Fills the fields <fn>

with the values <val n> from the context instance <inst>. You can

handle these messages in your programs by using the MESSAGES addition.

DESCRIBE DISTANCE

Gets the distance

between two fields.

Syntax

DESCRIBE DISTANCE BETWEEN <f1> AND <f2> INTO <f3> [IN BYTE|CHARACTER MODE].

Writes the number of

bytes between data objects <f1> and <f 2> into the

variable <d>. The length of the first field in memory is always included. In

Unicode programs, you must specify either the IN BYTE MODE or IN CHARACTER

MODE addition. In non-Unicode programs, the distance is returned in bytes.

DESCRIBE FIELD

Describes the attributes

of a field.

Syntax

DESCRIBE FIELD <f>

[LENGTH <l> [IN BYTE|CHARACTER MODE]] 

                   [TYPE <t> [COMPONENTS <n>]]

Page 25: 1-ABAP

                   [OUTPUT-LENGTH <o>] [DECIMALS <d>]

                   [EDIT MASK <m>] [HELP-ID <h>].

The attributes of the

data object <f> specified by the parameters of the statement are written to

the variables following the parameters. You can use any number of the

additions in the same statement. In Unicode programs, you must specify

either the IN BYTE MODE or IN CHARACTER MODE addition for LENGTH. In

non-Unicode programs, the length is returned in bytes.

DESCRIBE LIST

Describes the attributes

of a list.

Syntax

DESCRIBE LIST NUMBER OF LINES <lin> [INDEX <idx>].

DESCRIBE LIST NUMBER OF PAGES <n> [INDEX <idx>].

DESCRIBE LIST LINE <lin> PAGE <pag> [INDEX <idx>].

DESCRIBE LIST PAGE <pag> [INDEX <idx>]…

Depending on the variant

of the statement that you use, writes the number of lines, number of pages,

a line of a list on a given page, or various attributes of a page to

variables.

DESCRIBE TABLE

Describes the attributes

of an internal table.

Syntax

DESCRIBE TABLE [LINES <l>] [OCCURS<n>] [KIND <k>].

Depending on the

additions you use, writes the number of lines occupied, the value specified

for the INITIAL SIZE of the table, or the table type into a corresponding

variable.

DIVIDE

Divides one field by

another.

Syntax

Page 26: 1-ABAP

DIVIDE <n> BY <m>.

Divides the content of

<n> by <m>, and places the result in <n>. This is equivalent to: n=n/m.

DIVIDE-CORRESPONDING

Divides matching

components of structures.

Syntax

DIVIDE-CORRESPONDING <struc1> BY <struc2>.

All the

identically-named subfields of the structures <struc1> and <struc2> are

divided and the results are stored these subfields of <struc1>.

DO

Introduces a loop.

Syntax

DO [<n> TIMES] [VARYING

<f> FROM <f1> NEXT <f2>].

Introduces a statement

block that ends with ENDDO. If you omit the TIMES addition, the statement

block is repeated until it reaches a termination statement such as EXIT or

CHECK. Use the TIMES addition to restrict the number of loop passes to <n>.

The VARYING addition allows you to process fields the same distance apart in

memory.

E                                                                                                                                                                                                       EDITOR-CALL

Loads an ABAP program or

internal table into a text editor.

Syntax

EDITOR-CALL FOR <itab>…

EDITOR-CALL FOR REPORT <prog>…

Loads the internal table

<itab> or the program <prog> into a text editor, where you can edit it using

standard editor functions.

ELSE

Page 27: 1-ABAP

Introduces a statement

block in an IF control structure.

Syntax

ELSE.

If the logical

expression in an IF statement is false, ELSE introduces the statement block

to be executed instead.

ELSEIF

Introduces a statement

block in an IF control structure.

Syntax

ELSEIF <logexp>.

If the logical

expression in an IF statement is false and <logexp> is true, ELSE introduces

the statement block to be executed instead.

END-OF-DEFINITION

Closes a macro

definition.

Syntax

END-OF-DEFINITION.

This statement concludes

a macro definition introduced with DEFINITION.

END-OF-PAGE

Event keywords for

defining event blocks for list events.

Syntax

END-OF-PAGE.

Whenever the page footer

is reached while a list is being created, the runtime environment triggers

the END-OF-PAGE event, and the corresponding event block is executed.

END-OF-SELECTION

Event keywords for

defining event blocks for reporting events.

Syntax

Page 28: 1-ABAP

END-OF-SELECTION.

Once a logical database

has read all of the required lines and passed them to the executable

program, the runtime environment triggers the END-OF-SELECTION event, and

the corresponding event block is executed.

ENDAT

Closes a statement block

in control level processing.

Syntax

ENDAT.

This statement concludes

a control level processing block introduced with AT.

ENDCASE

Closes a CASE control

structure.

Syntax

ENDCASE.

This statement concludes

a control structure introduced with CASE.

ENDCATCH

Closes a CATCH area.

Syntax

ENDCATCH.

This statement concludes

an exception handling block introduced with CATCH SYSTEM-EXCEPTIONS.

ENDCLASS

Closes a class

definition.

Syntax

ENDCLASS.

This statement concludes

a class declaration or implementation introduced with CLASS.

ENDDO

Closes a DO loop.

Syntax

Page 29: 1-ABAP

ENDDO.

This statement concludes

a loop introduced with DO.

ENDEXEC

Closes a Native SQL

statement.

Syntax

ENDEXEC.

This statement ends a

Native SQL statement introduced with EXEC SQL.

ENDFORM

Closes a subroutine.

Syntax

ENDFORM.

This statement concludes

a subroutine definition introduced with FORM.

ENDFUNCTION

Closes a function

module.

Syntax

ENDFUNCTION.

This statement concludes

a function module introduced with FUNCTION.

ENDIF

Closes an IF control

structure.

Syntax

ENDIF.

This statement concludes

a control structure introduced with IF.

ENDINTERFACE

Closes a interface

definition.

Page 30: 1-ABAP

Syntax

ENDINTERFACE.

This statement concludes

an interface definition introduced with INTERFACE.

ENDLOOP

Closes a LOOP.

Syntax

ENDLOOP.

This statement concludes

a loop introduced with LOOP.

ENDMETHOD

Closes a method.

Syntax

ENDMETHOD.

This statement concludes

a method implementation introduced with METHOD.

ENDMODULE

Closes a dialog module.

Syntax

ENDMODULE.

This statement concludes

a dialog module introduced with MODULE.

ENDON

Closes a conditional

statement block.

Syntax

ENDON.

This statement ends a

conditional statement block introduced with ON CHANGE.

ENDPROVIDE

Closes a PROVIDE loop.

Syntax

Page 31: 1-ABAP

ENDPROVIDE.

This statement concludes

a loop introduced with PROVIDE.

ENDSELECT

Closes a SELECT loop.

Syntax

ENDSELECT.

This statement concludes

a loop introduced with SELECT.

ENDTRY

Closes a TRY area.

Syntax

ENDTRY.

This statement concludes

a control structure introduced with TRY.

ENDWHILE

Closes a WHILE loop.

Syntax

ENDWHILE.

This statement concludes

a loop introduced with WHILE.

EVENTS

Defines events in

classes or interfaces.

Syntax

EVENTS <evt> EXPORTING..

VALUE(<ei>) TYPE type [OPTIONAL]…

The event <evt> can be

declared in the declaration part of a class or within an interface

definition, and may have EXPORTING parameters that are passed to the event

handler. The parameters are always passed by value.

EXEC SQL

Introduces a Native SQL

statement.

Syntax

Page 32: 1-ABAP

EXEC SQL [PERFORMING <form>].

Between EXEC SQL and the

ENDEXEC statement, you can include a database-specific Native SQL statement.

The PERFORMING addition allows you to pass a multiple-line selection line by

line to a subroutine.

EXIT

Leaves a loop or

processing block.

Syntax

EXIT.

Within a loop: The

entire loop is terminated, and processing continues with the first statement

following the loop. Outside a loop: Terminates the current processing block.

In a reporting event: Jumps directly to the output list.

EXIT FROM STEP-LOOP

Ends a step loop.

Syntax

EXIT FROM STEP-LOOP.

Terminates step loop

processing. A step loop is ais a way of displaying a table on a screen.

EXIT FROM SQL

Ends Native SQL

processing.

Syntax

EXIT FROM SQL.

This statement may occur

within a subroutine called using the PERFORMING addition in the EXEC SQL

statement. The entire subroutine is processed, but no more subsequent lines

of the selection are processed.

EXPORT

Exports data clusters.

Syntax

EXPORT… <fi>

[FROM <g i>]… | (<itab>) 

Page 33: 1-ABAP

       TO  MEMORY

         | DATABASE <dbtab>(<ar>) ID(<key>)

         | SHARED BUFFER <dbtab>(<ar>) ID(<key>).

The data objects <fi>

or <g i>, or the data objects in the internal table <itab> are

stored as a data cluster in the cross-program ABAP memory of the current

internal session, in a cluster database table <dbtab>, or in the

cross-transaction application buffer of the table <dbtab>.

EXTRACT

Creates an extract

dataset and adds lines to it.

Syntax

EXTRACT <fg>.

With the first EXTRACT

statement of a program, the system creates the extract dataset and adds the

first extract record. In each subsequent EXTRACT statement, the new extract

record is added to the dataset. Each extract record contains exactly those

fields that are contained in the field group <fg>, plus the fields of the

field group HEADER (if one exists).

F                                                                                                                                                                                                       FETCH

Uses a cursor to read

entries from a database table.

Syntax

FETCH NEXT CURSOR <c> INTO <target>.

If the cursor <c> is

linked with a selection in a database table, FETCH writes the next line of

the selection into the flat target area <target>.

FIELD-GROUPS

Declares a field group

for an extract dataset.

Syntax

FIELD-GROUPS <fg>.

Page 34: 1-ABAP

This statement defines a

field group <fg>. Field groups define the line structure of an extract

dataset. You can also define a special field group called HEADER: When

filling the extract dataset, the system automatically prefixes any other

field groups with this field group.

FIELD-SYMBOLS

Declares field symbols.

Syntax

FIELD-SYMBOLS <FS>

[<type>|STRUCTURE <s> DEFAULT <wa>].

Field symbols are

placeholders or symbolic names for other fields. Pointed brackets are part

of the syntax for field symbol names. The <type> addition allows you to

specify the type of a field symbol. The STRUCTURE addition forces a

structured view of the data objects that you assign to the field

symbol.

FIND

Searches for patterns.

Syntax

FIND <p> IN [SECTION

OFFSET <off> LENGTH <len> OF] <text>

            [IGNORING CASE|RESPECTING CASE]

            [IN BYTE MODE|IN CHARACTER MODE]

            [MATCH OFFSET <o>] [MATCH LENGTH <l>].

The system searches the

field <text> for the pattern <p>. The SECTION OFFSET <off> LENGTH <len> OF

addition tells the system to search only from the <off> position in the

length <len>. IGNORING CASE or RESPECTING CASE (default) specifies whether

the search is to be case-sensitive. In Unicode programs, you must specify

whether the statement is a character or byte operation, using the IN BYTE

MODE or IN CHARACTER MODE (default) additions. The MATCH OFFSET and MATCH

LENGTH additions set the offset of the first occurrence and length of the

search string in the fields <p> and <l>.

FORM

Defines a subroutine.

Syntax

FORM <subr> [USING   …

[VALUE(]<pi>[)] [TYPE <t>|LIKE <f>]… ] 

Page 35: 1-ABAP

                       [CHANGING… [VALUE(]<pi>[)] [TYPE

<t>|LIKE <f>]… ].

Introduces a subroutine

<form>. The USING and CHANGING additions define the subroutine�s 

parameter interface. The subroutine end with ENDFORM.

FORMAT

Sets formatting options

for list output.

Syntax

FORMAT… <optioni>

[ON|OFF]…

The formatting options

<option 

i

> (such as color) set in

the FORMAT statement, apply to all subsequent output until they are turned

off using the OFF option.

FREE

Release space in memory.

Syntax

FREE <itab>.

FREE MEMORY ID(<key>).

FREE OBJECT <obj>.

This statement deletes

an internal table, a data cluster in ABAP memory, or an external object in

OLE2 Automation, depending on the variant of the statement used.

FUNCTION

Defines a function

module.

Syntax

FUNCTION <func>.

Introduces the function

module <func>. This statement is not entered in the ABAP Editor, but is

Page 36: 1-ABAP

automatically generated by the Function Builder in the ABAP Workbench. The

function module definition ends with the ENDFUNCTION statement

FUNCTION-POOL

Introduces a function

group.

Syntax

FUNCTION-POOL.

The first statement in a

function group. This statement is not entered in the ABAP Editor, but is

automatically generated by the Function Builder in the ABAP Workbench. A

function group is an ABAP program that contains function modules.

GGET

Event keyword for

defining event blocks for reporting events.

Syntax

GET <node> [FIELDS <f1>

<f 2>…].

Only occurs in

executable programs. When the logical database has passed a line of the node

<node> to the program, the runtime environment triggers the GET event, and

the corresponding event block is executed. You can use the FIELDS option to

specify explicitly the columns of a node that the logical database should

read.

GET BIT

Reads an individual bit.

Syntax

GET

BIT <n> OF <f> INTO <g>.

Reads the bit at

position <n> of the hexadecimal field <f> into the field <b>.

GET CURSOR

Gets the cursor position

on a screen or in an interactive list event.

Syntax

Page 37: 1-ABAP

GET CURSOR FIELD <f>

[OFFSET <off>] [LINE <lin>] 

[VALUE <val>] [LENGTH <len>].

GET CURSOR LINE <lin>

[OFFSET <off>] [VALUE <val>] [LENGTH <len>].

At a user action on a

list or screen, the statement writes the position, value, and displayed

length of a field or line into the corresponding variables.

GET DATASET

Syntax

GET

DATASET <dsn> [POSITIONS <pos>]

[ATTRIBUTE <attr>].

Gets the attributes of a

file opened using OPEN DATASET. The POSITIONS additions writes the current

read/write position to the field <pos>. The ATTRIBUTE addition writes the

attributes to a structure, <attr>, of the type DSET_ATTRIBUTES.

GET LOCALE LANGUAGE

Gets the current text

environment.

Syntax

GET

LOCALE LANGUAGE <lg> COUNTY <c> MODIFIER <m>.

Returns the current

language, country ID and any modifier into the corresponding variables

GET PARAMETER

Gets an SPA/GPA

parameters

Syntax

GET

PARAMETER ID <pid> FIELD <f>.

Writes the value of the

SPA/GPA parameter <pid> from the user-specific SAP memory into the variable

<f>.

GET PF-STATUS

Gets the current GUI

status.

Page 38: 1-ABAP

Syntax

GET

PF-STATUS <f> [PROGRAM <prog>] [EXCLUDING <itab>].

Returns the name of the

current GUI status (the same as SY-PFKEY) into the variable <f>. The PROGRAM

addition writes the name of the ABAP program to which the status belongs

into the variable <prog>. The EXCLUDING addition returns a list of all

currently inactive function codes into the internal table <itab>.

GET PROPERTY

Gets a property of an

OLE2 Automation object.

Syntax

GET

PROPERTY OF <obj> <p> = <f>.

Writes the property <p>

of an external OLE2 Automation object to the variable <f>.

GET REFERENCE

Gets a data reference.

Syntax

GET REFERENCE OF <obj>

INTO <dref>.

Writes a data reference

to an existing data object <obj> to the data reference variable <dref>.

GET RUN TIME FIELD

Measures the runtime in

microseconds.

Syntax

GET

RUN TIME FIELD <f>.

The first time the

statement is executed, the variable <f> is set to zero. In each subsequent

call, the runtime since the first call is written to <f>.

GET TIME

Synchronizes the time.

Syntax

GET

TIME [FIELD <f>].

Page 39: 1-ABAP

Refreshes the system

fields SY-UZEIT, SY-DATUM, SY-TIMLO, SY-DATLO, and SY-ZONLO. The FIELD

addition fills the variable <f> with the current time.

GET TIME STAMP FIELD

Returns a time stamp.

Syntax

GET

TIME STAMP FIELD <f>.

Returns the short or

long form of the current date and time, depending on whether the variable

<f> has the type P(8) or P(11). The long form returns the time correct to

seven decimal places.

H                                                                                                                                                                                                       HIDE

Stores information about

list lines.

Syntax

HIDE <f>.

While the list is being

created, this statement stores the contents of the field <f> and the current

line number in the internal HIDE area When the cursor is positioned on a

line in an interactive list event, the stored value is returned to the field

<f>.

I                                                                                                                                                                                                       IF

Conditional branch.

Introduces a new branch.

Syntax

IF

<logexp>.

Opens an IF control

structure that ends with an ENDIF statement. The system evaluates the

logical expression <logexp>, and processes different statement blocks

depending on the result.

IMPORT

Imports data clusters.

Page 40: 1-ABAP

Syntax

IMPORT… <fi>

[TO <g i>]… | (<itab>) 

       FROM  MEMORY

           | DATABASE <dbtab>(<ar>) ID(<key>)

           | SHARED BUFFER <dbtab>(<ar>) ID(<key>).

The data objects <fi>

or <g i>, or the data objects in the internal table <itab> are

read from data clusters, either in the cross-program ABAP memory of the

current internal session; in a cluster database table <dbtab>; or in the

cross-transaction application buffer of the table <dbtab> and written to the

variables <f i> and <g i>.

IMPORT DIRECTORY

Creates the directory of

a data cluster from a cluster database.

Syntax

IMPORT DIRECTORY INTO <itab>

       FROM DATABASE <dbtab>(<ar>)

       Id <key>.

Writes a directory of

the data objects belonging to a data cluster in the cluster database <dbtab>

to the internal table <dirtab>.

In the third variant,

the table <itab> contains a directory of the objects stored using EXPORT TO

DATABASE.

INCLUDE

Inserts an include

program in another program.

Syntax

INCLUDE <incl>.

Has the same effect as

copying the source code of the include program <incl> into the program.

Include programs are not loaded at runtime, but are expanded when the

program is generated. Include programs must have the program type I.

INCLUDE TYPE|STRUCTURE

Page 41: 1-ABAP

Includes a structure

within another.

Syntax

INCLUDE TYPE <t>|STRUCTURE <s> [AS <name> [RENAMING WITH SUFFIX <suffix>]].

Within a structure

declared using TYPES|DATA BEGIN OF, copies a structured datatype <t>, or a

structure <s> already available as a data object, as part of the structure

declaration. The AS addition lets you address the individual components

using the name <name>. The RENAMING addition lets you append a suffix,

<suffix>, to <name>, so that you can copy the same structure several times.

INITIALIZATION

Event keywords for

defining event blocks for reporting events.

Syntax

INITIALIZATION.

Only occurs in

executable programs. The ABAP runtime environment triggers the

INITIALIZATION event before the selection screen is processed, at which

point the corresponding event block is processed.

INSERT for Database Tables

Inserts entries from

database tables.

Syntax

INSERT <dbtab> FROM <wa>.

INSERT <dbtab> FROM

TABLE <itab> [ACCEPTING DUPLICATE KEYS].

Inserts one line from

the work area <wa> or several lines from the internal table <itab> into the

database table <dbtab>. The ACCEPTING DUPLICATE KEYS addition prevents a

runtime error from occurring if two entries have the same primary key.

Instead, it merely discards the duplicate

INSERT for Field Groups

Defines the structure of

field groups for extract datasets.

Syntax

Page 42: 1-ABAP

INSERT <f1>…

<f n> INTO <fg>.

Includes the fields <fi>

in the field group <fg>, thus defining a line structure for an extract

dataset.

INSERT for any Internal

Table

Inserts lines from

internal tables of any type.

Syntax

INSERT <line>|LINES OF <jtab>

[FROM <n1>] [TO <n 2>] 

       INTO TABLE <itab>

       [ASSIGNING <FS> | REFERENCE INTO <dref>].

Inserts a line <line> or

a set of lines from the internal table <jtab> into the internal table <itab>.

If <jtab> is an index table, you can use the FROM and TO additions to

restrict the lines inserted. If you use ASSIGNING or INTO REFERENCE, field

symbol <FS> refers to the inserted line or the relevant data reference is

stored in <dref> after the statement.

INSERT for Index Tables

Inserts entries in index

tables.

Syntax

INSERT <line>|LINES OF <jtab>

[FROM <n1>] [TO <n 2>] 

  INTO <itab> [INDEX <idx>]

  [ASSIGNING <FS> | REFERENCE INTO <dref>].

Inserts a line <line> or

a set of lines from the internal table <jtab> into the internal table <itab>before

the line with the index <idx>. If <jtab> is an index table, you can use the

FROM and TO additions to restrict the lines inserted. If you omit the INDEX

addition, you can only use the statement within a LOOP. A new line

containing values is inserted before the current line. If you use ASSIGNING

or INTO REFERENCE, field symbol <FS> refers to the inserted line or the

relevant data reference is stored in <dref> after the statement.

INSERT for Programs

Page 43: 1-ABAP

Inserts ABAP programs

into the program library.

Syntax

INSERT REPORT <prog>

FROM <itab>.

The lines of the

internal table <itab> are added to the program library as the program <prog>.

INTERFACE

Declares a interface in

ABAP Objects.

Syntax

INTERFACE <ifac> [DEFERRED]

                 [LOAD].

Introduces an interface

<interface>. The definition ends with ENDINTERFACE and contains the

declaration of all the components of the interface. The DEFERRED addition

makes the interface known to the program before it is defined. The LOAD

addition loads an interface explicitly from the Class Library.

INTERFACES

Implementation or

nesting of an interface in ABAP Objects.

Syntax

INTERFACES <ifac> 

  [ABSTRACT|FINAL METHODS <meth1> <meth 2> | ALL

METHODS ABSTRACT|FINAL ] 

  [DATA VALUES <attr1> = <val 1> <attr 2> =

<val 2> …]

.

Used in a class

declaration: This statement adds the components of the interface to the

existing class definition. Used in an interface definition: Forms a compound

interface. Use the additions to characterize methods in interfaces as

abstract or final. Their attributes can be filled with initial values.

L                                                                                                                                                                                                      

Page 44: 1-ABAP

LEAVE for Screens

Leaves a screen.

Syntax

LEAVE SCREEN.

Stops processing the

current screen and calls the subsequent screen. The next screen can either

be defined statically in the screen attributes or set dynamically using the

SET SCREEN statement.

Syntax

LEAVE TO SCREEN <scr>.

Stops processing the

current screen and calls the dynamically-defined subsequent screen <scr>*.

LEAVE for Lists During Screen

Processing

Switches between screen

and list processing.

Syntax

LEAVE TO LIST-PROCESSING [AND RETURN TO SCREEN <scr>].

Allows you to create and

display a list while processing a series of screens. The addition allows you

to specify the next screen (to which you return after the list has been

displayed). If you do not use the addition, screen processing resumes with

the PBO of the current screen

Syntax

LEAVE LIST-PROCESSING.

Allows you to switch

back explicitly from list processing to screen processing.

LEAVE for Programs

Leaves an ABAP program.

Syntax

LEAVE [PROGRAM].

Stops processing the

current program and returns to the point from which it was called.

Page 45: 1-ABAP

Syntax

LEAVE TO TRANSACTION <tcod> [AND SKIP FIRST SCREEN].

This statement ends

processing of the current program and starts a new transaction, <tcod>. The

addition allows you to skip the initial screen of the transaction.

LOAD-OF-PROGRAM

Event keywords for

defining event blocks for a program constructor.

Syntax

LOAD-OF-PROGRAM.

When an ABAP program is

loaded in an internal session, the runtime environment triggers the

LOAD-OF-PROGRAM event, and the corresponding event block is executed.

LOCAL

Protects global data

against changes.

Syntax

LOCAL <f>.

Only occurs in

subroutines. When the subroutine starts, the value of <f> is stored

temporarily, and restored to the variable <f> at the end of the subroutine.

LOOP Through Extracts

Introduces a loop

through an extract dataset.

Syntax

LOOP.

Loops through an extract

dataset. The loop ends with an ENDLOOP statement. When the LOOP statement is

executed, the system stops creating the extract dataset of the program, and

starts a loop through the entries in the dataset. One record from the

extract dataset is read in each loop pass. The values of the extracted

fields are placed in the corresponding output fields of the field group

within the loop.

Page 46: 1-ABAP

LOOP THROUGH internal

tables

Starts a loop through an

extract dataset.

Syntax

LOOP AT <itab> INTO <wa>

WHERE <logexp>.

LOOP AT <itab> ASSIGNING

<FS> WHERE <logexp>.

LOOP AT <itab> REFERENCE

INTO <dref> WHERE <logexp>.

LOOP AT <itab>

TRANSPORTING NO FIELDS WHERE <logexp>.

Loop through any

Internal Table The loop ends with an ENDLOOP statement. If the logical

expression <logexp> is true, each loop pass either assigns the current line

content to the work area <wa>; assigns the current line to a field symbol

<FS>; creates a reference to the current line by <dref>; or does not assign

the line content at all. The first operand in each part of <logexp> must be

a component of the internal table. Pointed brackets are part of the syntax

for field symbol names.

With index tables, you

can use the additions FROM <n> and TO <n> to restrict the lines that are

read by specifying an index range.

LOOP Through Screen Fields

Starts a loop through

the table SCREEN.

Syntax

LOOP AT SCREEN…

Similar to a loop

through an internal table. The system table SCREEN contains the names and

attributes of all of the fields on the current screen.

M                                                                                                                                                                                                       MESSAGE

Displays a message.

Syntax

Page 47: 1-ABAP

MESSAGE <xnnn> [WITH <f1>… <f4>] [RAISING <except>].

MESSAGE ID <mid> TYPE <x> NUMBER <nnn>.

MESSAGE <xnnn>(<mid>).

Displays the message <nnn>

of message class <mid> as message type <x>. The message type specifies how

the message is displayed, and how the program reacts. The WITH addition

allows you to fill placeholders in the message text. The RAISING addition in

function modules and methods allows you to terminate the procedure and

trigger the exception <exception>.

MESSAGE <msg> TYPE <x>

This variant display a

string, <msg>, directly as a message of the type <x>.

METHOD

Introduces the

implementation of a method in a class.

Syntax

METHOD <meth>.

Only occurs in the

implementation part of classes. Introduces a statement block that ends with

ENDMETHOD. You do not have to specify any interface parameters, since these

are defined in the method declaration.

METHODS

Declares methods in

classes and interfaces.

Syntax

METHODS <meth> [FOR

EVENT <evt> OF <cif>]

        IMPORTING… [VALUE(]<ii>[)] TYPE <t> [OPTIONAL]… 

        EXPORTING… [VALUE(]<ei>[)] TYPE <t> [OPTIONAL]… 

CHANGING … [VALUE(]<ci>[)] TYPE <t> [OPTIONAL]… 

        RETURNING VALUE(<r>) 

        EXCEPTIONS       … <ei>… 

        [ABSTRACT]

Page 48: 1-ABAP

        [FINAL]

        [REDEFINITION].

You declare a method

<met> in the definition part of a class or in the definition of an

interface: The IMPORTING, EXPORTING, CHANGING, RETURNING, and EXCEPTIONS

additions define the parameter interface and exceptions of the method. The

ABSTRACT addition defines an abstract class, which cannot be implemented in

the same class. The function of a non-abstract method must be implemented

using METHOD. The FINAL addition prevents you from redefining the method in

subclasses. The REDEFINITION addition redefines a method of a superclass.

The FOR EVENT addition declares an event handler method for the <evt> event

of a class or interface.

MODIFY for Database Tables

Inserts or changes lines

in database tables.

Syntax

MODIFY <dbtab> FROM <wa>.

MODIFY <dbtab> FROM

TABLE <itab>.

Works like INSERT for

database tables, if there is not yet a line in the table with the same

primary key. Works like UPDATE if a line already exists with the same

primary key.

MODIFY for any Internal

Table

Changes the content of

lines in internal tables of any type.

Syntax

MODIFY TABLE <itab> FROM

<wa> [TRANSPORTING <f1> <f 2>…] 

                              [ASSIGNING <FS> | REFERENCE INTO <dref>].

Copies the work area <wa>

into the line of the internal table with the same table key as <wa>. If you

use ASSIGNING or INTO REFERENCE, field symbol <FS> refers to the modified

line or the relevant data reference is stored in <dref> after the statement.

You can use the TRANSPORTING addition to specify the exact components that

you want to change.

Page 49: 1-ABAP

MODIFY <itab> FROM <wa>

TRANSPORTING <f1> <f 2>… WHERE <logexp>.

Copies the work area <wa>

into the line of the internal table for which the logical expression is

true. In each comparison of the logical expression, the first operand must

be a component of the line structure.

MODIFY for Index Tables

Changes the content of

lines in index tables.

Syntax

MODIFY <itab> FROM <wa>

[INDEX <idx>] [TRANSPORTING <f1> <f 2>…] 

                        [ASSIGNING <FS> | REFERENCE INTO <dref>].

Copies the work area <wa>

into the line of the internal table with the index <idx>. If you omit the

INDEX addition, you can only use the statement within a LOOP. In this case,

you change the current loop line If you use ASSIGNING or INTO REFERENCE,

field symbol <FS> refers to the modified line or the relevant data reference

is stored in <dref> after the statement.

MODIFY for Lists

Changes a list line.

Syntax

MODIFY LINE <n> [INDEX <idx>]

[OF CURRENT PAGE|OF PAGE <p>]

      |CURRENT LINE

      LINE FORMAT <option1> <option2>… 

      FIELD VALUE <f1> [FROM <g1>] <f2> [FROM <g2>]… 

      FIELD FORMAT <f1> <options1> <f2> <options2>.

Changes either line <n>

on the current or specified list (or page), or the last line to be chosen.

The exact nature of the change is specified in the additions

MODIFY SCREEN

Changes the SCREEN

table.

Syntax

MODIFY SCREEN…

Page 50: 1-ABAP

Like changing an

internal table. The system table SCREEN contains the names and attributes of

all of the fields on the current screen.

MODULE

Introduces a dialog

module.

Syntax

MODULE <mod> OUTPUT |[INPUT].

Introduces the dialog

module <mod>. The OUTPUT and INPUT additions designate the module as a PBO

or PAI module respectively. Each dialog module ends with ENDMODULE.

MOVE

Assigns values.

Syntax

MOVE <f1> TO <f2>.

Assigns the contents of

the data object <f1> to the variable <f2>, with automatic type conversion if

necessary. Equivalent to <f2> = <f1>.

MOVE-CORRESPONDING

Assigns values between

identically-named components of structures.

Syntax

MOVE-CORRESPONDING <struc1> TO <struc2>.

Moves the contents of

the components of structure <struc1> to the components of <struc2> that have

identical names.

MULTIPLY

Multiplies two single

fields.

Syntax

MULTIPLY <n> BY <m>.

Multiplies the content

of <n> by <m>, and stores the result in <n>. This is equivalent to: m=m*n.

MULTIPLY-CORRESPONDING

Page 51: 1-ABAP

Multiplies components of

structures.

Syntax

MULTIPLY-CORRESPONDING <struc1> BY <struc2>.

All the

identically-named subfields of the structures <struc1> and <struc2> are

multiplied and the results are stored these subfields of <struc1>.

N                                                                                                                                                                                                       NEW-LINE

Inserts a line break in

a list.

Syntax

NEW-LINE [NO-SCROLLING|SCROLLING].

Positions the list

display after the page header. The NO-SCROLLING addition prevents the new

line from scrolling horizontally. SCROLLING resets the NO-SCROLLING

addition.

NEW-PAGE

Inserts a page break in

a list.

Syntax

NEW-PAGE [NO-TITLE|WITH-TITLE]

         [NO-HEADING|WITH-HEADING]

         [LINE-COUNT]

         [LINE-SIZE]

         [PRINT ON|OFF].

Generates a new page and

positions the list output after the page header. The additions control how

the page header is displayed, the length and width of the page, and the

print output.

NODES

Declares an interface

work area.

Syntax

Page 52: 1-ABAP

NODES <node>.

Declares a variable with

the same data type and the same name as a data type from the ABAP

Dictionary. Structures in main programs and subroutines declared using NODES

use a common data area. This statement is used in conjunction with logical

databases.

O                                                                                                                                                                                                       ON CHANGE

Introduces a new branch.

Syntax

ON

CHANGE OF <f> [OR <f1> OR <f2>…].

Opens an ON control

structure, which ends with ENDON. The statement block is executed whenever

the contents of the field <f> or one of the other fields <fi> has changed

since the statement was last executed.

OPEN CURSOR

Opens a database cursor.

Syntax

OPEN CURSOR [WITH HOLD]

<c> FOR SELECT      <result> 

                                  FROM      <source> 

                                  [WHERE    <condition>]

                                  [GROUP BY <fields>] 

                                  [HAVING   <cond>]

                                  [ORDER BY <fields>].

Opens a cursor <c> with

type CURSOR for a SELECT statement. You can use all the clauses of the

SELECT statement apart from the INTO clause. The INTO clause is set in the

FETCH statement. If you use the WITH HOLD addition, the cursor is not closed

when a database commit occurs.

OPEN DATASET

Opens a file.

Syntax

OPEN DATASET <dsn> 

Page 53: 1-ABAP

             [FOR INPUT|OUTPUT|APPENDING|UPDATE]

             [IN BINARY MODE

             |IN TEXT MODE [ENCODING (DEFAULT|UTF-8|NON-UNICODE)]

             |IN LEGACY BINARY MODE [(BIG|LITTLE) ENDIAN] [CODE PAGE <cp>]

             |IN LEGACY TEXT MODE [(BIG|LITTLE) ENDIAN] [CODE PAGE <cp>]]

             [REPLACEMENT CHARACTER <rc>]

             [IGNORING CONVERSION ERRORS]

             [AT POSITION <pos>]

             [TYPE <c>]

             [MESSAGE <mess>]

             [FILTER <filt>].

Opens a file <dsn> on

the application server. The additions after FOR specify how the file is read

or written. The MODE additions specifies how content is interpreted (as

characters or in binary form). The ENCODING addition specifies the character

representation in the file. The LEGACY MODE allows you to read files that

were written before Release 6.10. REPLACEMENT CHARACTERS and CONVERSION

ERRORS are used to handle errors during character set conversion. AT

POSITION specifies the position in the file. MESSAGE specifies where system

messages are stored. FILTER lets you specify operating system commands.

OVERLAY

Overlays one string with

another:

Syntax

OVERLAY <c1> WITH <c2> [ONLY <str>].

This statement overlays

all positions in field <c1> containing letters which occur in <str> with the

contents of <c2>. 

<c2>

remains unchanged. If you omit ONLY <str>, all positions of

<c1> containing spaces are overwritten.

P                                                                                                                                                                                                       PACK

Converts type C

variables to type P.

Page 54: 1-ABAP

Syntax

PACK <f> TO <g>.

Packs the string <f> and

places it in the field <g>. This can be reversed with the UNPACK statement.

PARAMETERS

Declares parameters for

a selection screen.

Syntax

PARAMETERS <p>[(<length>)] [TYPE <type>|LIKE <obj>] [DECIMALS <d>]

              [DEFAULT <f>]

              [MEMORY ID <pid>]

              [LOWER CASE]

              [OBLIGATORY]

              [VALUE CHECK]

              [AS CHECKBOX]

              [RADIOBUTTON GROUP <radi>]

              [NO-DISPLAY]

              [MODIF ID <key>].

Declares a variable <p>,

as in the DATA statement. For <p>, an input field appears on the

corresponding selection screen. The additions allow you to define default

values, accept lowercase input, define the field as required, check values,

define a checkbox or radio button, prevent the field from being displayed on

the selection screen, or modify the field

PERFORM

Calls a subroutine.

Syntax

PERFORM    <subr>

        |  <subr>(<prog>) [IF FOUND]

        |(<fsubr>)[IN PROGRAM (<fprog>)][IF FOUND]

        [USING  … <pi>… ] 

        [CHANGING… <pi>… ] 

        [ON COMMIT].

Calls an internal or

external subroutine <subr> or the subroutine whose name occurs in the <fsubr>

Page 55: 1-ABAP

field. The external program is <prog> or the name contained in <fprog>. The

IF FOUND addition prevents a runtime error from occurring if the subroutine

does not exist. The USING and CHANGING additions fill the subroutine�s

parameter interface. The ON COMMIT addition delays the execution of the

subroutine until the next COMMIT WORK statement.

POSITION

Absolute position of the

display in a list.

Syntax

POSITION <col>.

Positions the list

display in the column <col>.

PRINT-CONTROL for Print Format

Specifies the print

format.

Syntax

PRINT-CONTROL <formats>

[LINE <lin>] [POSITION <col>].

Sets the print format

starting either at the current list position or at line <lin> and column <col>.

PRINT-CONTROL for Index

Lines

Creates index lines in

the spool file.

Syntax

PRINT-CONTROL INDEX-LINE <f>.

Writes the contents of

field <f> into an index line after finishing the current print line. The

index line is not printed. During optical archiving, the spool system

divides the list into a data file and a description file containing the

index lines.

PRIVATE

Defines the private

section of a class.

Syntax

Page 56: 1-ABAP

PRIVATE SECTION.

Introduces the

declaration of all of the components of a class that are only visible in the

class itself.

PROGRAM

Introduces a program.

Syntax

PROGRAM <prog>…

The first statement in

some ABAP programs. Equivalent to: REPORT.

PROTECTED

Defines the protected

section of a class.

Syntax

PROTECTED SECTION.

Introduces the

declaration of all of the components of a class that are only visible in the

class and its subclasses.

PROVIDE

Loops through internal

tables at given intervals.

Syntax

PROVIDE <f1>… <fn> FROM <itab1>

        <g1>… <gm> FROM <itab2>

         …         FROM <itabn>

         … BETWEEN <f> AND <g>.

The contents of the

specified fields of the internal tables <itab1> � <itabn> are placed in

their header lines. The processing block between PROVIDE and ENDPROVIDE is

then executed for each interval.

PUBLIC

Defines the public

section of a class.

Syntax

Page 57: 1-ABAP

PUBLIC SECTION.

Introduces the

declaration of all of the components of a class that are visible in the

class, its subclasses, and all users.

PUT

Triggers a GET event.

Syntax

PUT

<node>.

Only occurs in logical

databases. Directs the program flow according to the structure of the

logical database.

R                                                                                                                                                                                                       RAISE for Class-Based

Exceptions

Raises an exception.

Syntax

RAISE EXCEPTION TYPE <class> | <ref>.

Terminates processing

and raises an exception of the exception class <class>. If the reference

variable <ref> points to an object of an exception class, <class> can be

specified instead of TYPE.

RAISE for Exceptions of Function

Modules and Methods

Raises exceptions.

Syntax

RAISE <except>.

Only occurs in function

modules and methods. Terminates processing and raises an exception <except>

defined in the interface.

RAISE for Events

Triggers events in ABAP

Objects.

Syntax

Page 58: 1-ABAP

RAISE EVENT <evt>.

Only occurs in methods.

Triggers the event <evt> and calls all registered handler methods.

RANGES

Declares a RANGES table.

Syntax

RANGES <rangetab> FOR <f>.

Declares a RANGES table

for the field <f>. A RANGES table has the same data type as a selection

table, but is not linked to input fields on a selection screen.

READ for Files

Reads a file.

Syntax

READ DATASET <dsn> INTO

<f> 

[MAXIMUM LENGTH <maxlen>]

[ACTUAL LENGTH <len>].

Reads the contents of

the file <dsn> on the application server to the variable <f>. The amount of

data can be specified using MAXIMUM LENGTH. The number of bytes transferred

can be written to <len> using ACTUAL LENGTH.

READ for any Internal Table

Reads a line of an

internal table.

Syntax

READ TABLE <itab>  FROM

<wa>

                  |WITH TABLE KEY <k1> = <f1>… <kn> = <fn> 

                  |WITH KEY = <f>

                  |WITH KEY <k1> = <f1>… <kn> = <fn> 

      INTO <wa> [COMPARING <f1> <f2>… |ALL FIELDS]

                [TRANSPORTING <f1> <f2>… |ALL FIELDS|NO FIELDS]

     |ASSIGNING <FS>

     |REFERENCE INTO <dref>.

This statement reads

either the line of the internal table with the same key as specified in the

Page 59: 1-ABAP

work area <wa>, the line with the key specified in the TABLE KEY addition,

the line that corresponds fully to <f>, or the one corresponding to the

freely-defined key in the KEY addition. The contents of the line are either

written to the work area <wa>, or the line is assigned to the field symbol

<FS>. If you assign the line to a work area, you can compare field contents

and specify the fields that you want to transport.

READ for Index Tables

Reads a line of an

internal table.

Syntax

READ TABLE <itab> INDEX

<idx>   INTO <wa>… 

                              | ASSIGNING <FS>

                              | REFERENCE INTO <dref>.

The line with index 7 is

read. The result is specified as with any internal table.

READ for Lists

Reads the contents of a

line from a list.

Syntax

READ LINE  <n> [INDEX <idx>]

[OF CURRENT PAGE|OF PAGE <p>]

          |CURRENT LINE

          [FIELD VALUE <f1> [INTO <g1>]… <fn> [INTO <gn>]].

Reads either the line

<n> on the current or specified list or page, or the last line to have been

selected by the user. The addition specifies the fields that you want to

read, and the target fields into which they should be placed. The entire

line is always placed in the system field SY-LISEL, and the HIDE area is

filled for the line.

READ for Programs

Reads ABAP programs into

the program library.

Syntax

READ REPORT <prog> INTO

<itab>.

Copies the lines of the

program <prog> into the internal table <itab>.

Page 60: 1-ABAP

RECEIVE

Receives results from an

asynchronous function module call.

Syntax

RECEIVE RESULTS FROM FUNCTION <func> [KEEPING TASK]

                     [IMPORTING … fi = a i… ] 

                     [TABLES    … fi = a i… ] 

                     [EXCEPTIONS… ei = r i… ]

Occurs in special

subroutines to receive IMPORTING and TABLES parameters from function modules

called using the STARTING NEW TASK addition

REFRESH

Initializes an internal

table.

Syntax

REFRESH <itab>.

Resets the internal

table <itab> to its initial value, that is, deletes all of its lines.

REFRESH CONTROL

Initializes a control.

Syntax

REFRESH CONTROL <ctrl> FROM SCREEN <scr>.

The control <ctrl>

defined in the CONTROLS statement is reset with the initial values specified

for screen <scr>.

REJECT

Leaves an GET processing

block.

Syntax

REJECT [<dbtab>].

Terminates the

processing of the current line of the node of the logical database. If you

Page 61: 1-ABAP

use the optional <dbtab>, the logical database reads the next line of the

node <dbtab>.

REPLACE by Pattern

Replaces strings in

fields with other strings using a pattern.

Syntax

REPLACE [ FIRST OCCURENCE OF | ALL OCCURENCES OF ] <old> 

        IN [ SECTION OFFSET <off> LENGTH <len> OF ] <text> WITH <new>

        [IGNORING CASE|RESPECTING CASE]

        [IN BYTE MODE|IN CHARACTER MODE]

        [REPLACEMENT COUNT <c>]

        [REPLACEMENT OFFSET <r>]

        [REPLACEMENT LENGTH <l>].

In the string <text>,

the search pattern <old> is replaced by the content of <new>. By default,

the first occurrence of <old> is replaced. ALL OCCURENCES specifies that all

occurrences be replaced. In the fields <old> and <new>, trailing spaces in C

fields are ignored, but included in <text>. The SECTION OFFSET <off> LENGTH

<len> OF addition tells the system to search and replace only from the <off>

position in the length <len>. IGNORING CASE or RESPECTING CASE (default)

specifies whether the search is to be case-sensitive. In Unicode programs,

you must specify whether the statement is a character or byte operation,

using the IN BYTE MODE or IN CHARACTER MODE (default) additions. The

REPLACEMENT additions write the number of replacements, the offset of the

last replacement, and the length of the last replaced string <new> to the

fields <c>, <r>, and <l>.

REPLACE by Position

Replaces strings in

fields with other strings by position.

Syntax

REPLACE <str1> WITH <str2> INTO <c> [LENGTH <l>].

                                    [IN BYTE MODE|IN CHARACTER MODE].

ABAP searches the field

<c> for the first occurrence of the first <l> characters in the pattern

<str1> and replaces them with the string <str2>. In Unicode programs, you

Page 62: 1-ABAP

must specify whether the statement is a character or byte operation, using

the IN BYTE MODE or IN CHARACTER MODE (default) additions.

REPORT

Introduces a program.

Syntax

REPORT <rep> [MESSAGE-ID <mid>]

             [NO STANDARD PAGE HEADING]

             [LINE-SIZE <col>]

             [LINE-COUNT <n>(<m>)]

             [DEFINING DATABASE <ldb>].

The first statement in

executable ABAP programs. <rep> can be any name you choose. The addition

MESSAGE-ID specifies a message class to be used in the program. The DEFINING

DATABASE addition defines the program as the database program of the logical

database <ldb>. The other additions are formatting specifications for the

default list of the program.

RESERVE

Inserts a conditional

page break in a list.

Syntax

RESERVE <n> LINES.

Executes a page break on

the current page if less than <n> lines are free between the current line

and the page footer.

RETURN

Leaves a processing

block.

Syntax

RETURN.

Leaves the current

processing block. In a reporting event: Jumps directly to the output list.

ROLLBACK

Undoes the changes in a

SAP LUW.

Syntax

Page 63: 1-ABAP

ROLLBACK WORK.

ROLLBACK WORK always

undoes all changes back to the start of the database LUW. The update modules

are not called, and the log entry is deleted from table VBLOG.

S                                                                                                                                                                                                       SCROLL

Scrolls through lists

Syntax

SCROLL LIST

FORWARD|BACKWARD [INDEX <idx>].

SCROLL LIST TO FIRST

PAGE|LAST PAGE|PAGE <pag> 

            [INDEX <idx>] [LINE <lin>].

SCROLL LIST LEFT|RIGHT

[BY <n> PLACES] [INDEX <idx>].

SCROLL LIST TO COLUMN <col>

[INDEX <idx>].

Positions the current

list or the list level <idx> in accordance with the additions specified. You

can scroll by window, page, columns, or to the left- or right-hand edge of

the list.

SEARCH

Searches for strings.

Syntax

SEARCH <f>|<itab> FOR <g> [ABBREVIATED]

                          [STARTING AT <n1>]

                          [ENDING AT <n2>]

                          [AND MARK]

                          [IN BYTE MODE|IN CHARACTER MODE].

Searches the field <f>

or table <itab> for the string in the field <g>. The result is stored in

SY-FDPOS. The additions let you hide intermediate characters, search from

and to a particular position, and convert the found string into uppercase.

In Unicode programs, you must specify whether the statement is a character

Page 64: 1-ABAP

or byte operation, using the IN BYTE MODE or IN CHARACTER MODE (default)

additions.

SELECT

Reads data from the

database.

Syntax

SELECT <result> 

  INTO <target>

  FROM <source> 

  [WHERE <condition>]

  [GROUP BY <fields>] 

  [HAVING <cond>]

  [ORDER BY <fields>].

The SELECT statement

consists of a series of clauses, each of which fulfils a certain task:

SELECT clause

Defines the structure of

the selection.

Syntax

SELECT [SINGLE]|[DISTINCT]

       * | <si> [AS <a i>]… <agg>( [DISTINCT] <s

j>) [AS <a j>]…

The selection can be one

line, SINGLE, or several lines. You can eliminate duplicate lines using the

DISTINCT addition. To select the entire line, use *, otherwise, you can

specify individual columns <si>. For individual columns, you can

use aggregate functions <agg>, and assign alternative column names <a i>.

INTO clause

Defines the target area

into which the selection from the SELECT clause is written.

Syntax

…  INTO [CORRESPONDING

FIELDS OF] <wa>

   | INTO|APPENDING [CORRESPONDING FIELDS OF] TABLE <itab>

Page 65: 1-ABAP

                                             [PACKAGE SIZE <n>]

   | INTO (<f1>, <f 2>,…)

The target area can be a

flat work area <wa>, an internal table <itab>, or a list of fields <fi>.

If you use the CORRESPONDING FIELDS addition, data is only selected if there

is an identically-named field in the target area. If you use APPENDING

instead of INTO, the data is appended to an internal table instead of

overwriting the existing contents. PACKAGE SIZE allows you to overwrite or

extend the internal table in a series of packages.The data type of the

target area must be appropriate for the selection in the SELECT clause.

FROM clause

The FROM clause

determines the database tables from which the data specified in the SELECT

clause is read.

Syntax

… FROM [<tab> [INNER]|LEFT

[OUTER] JOIN] <dbtab> [AS <alias>] 

                               [ON <cond>]

         [CLIENT SPECIFIED] 

         [BYPASSING BUFFER]

         [UP TO <n> ROWS]

You can read both single

fields and groups of fields. You link several tables using inner and outer

joins to link tables with conditions <cond>, where <tab> is a single table

or itself a join condition. The names of database tables may be specified

statically or dynamically, and you can use alias names. You can bypass

automatic client handling with the CLIENT SPECIFIED addition, and SAP

buffering with BYPASSING BUFFER. You can also restrict the number of lines

read from the table using the UP TO <n> ROWS addition.

WHERE clause

Restricts the number of

lines selected.

Syntax

… [FOR ALL ENTRIES IN

<itab>] WHERE <cond>

The condition <cond> may

contain one or more comparisons, tests for belonging to intervals, value

list checks, subqueries, selection table queries or null value checks, all

Page 66: 1-ABAP

linked with AND, OR, and NOT. If you use the FOR ALL ENTRIES addition, the

condition <cond> is checked for each line of the internal table <itab> as

long as <cond> contains a field of the internal table as an operand. For

each line of the internal table, the system selects the lines from the

database table that satisfy the condition. The result set is the union of

the individual selections resulting from each line.

GROUP BY clause

Groups lines in the

selection.

Syntax

… GROUP BY <s1>

<s 2>

Groups lines with the

same contents in the specified columns. Uses aggregate functions for all

other columns in each group. All columns of the SELECT clause that are not

listed in the GROUP BY clause must be included in aggregate functions.

HAVING clause

Restricts the number of

line groups selected.

Syntax

… HAVING <cond>

Like the WHERE clause,

but can only be used in conjunction with a GROUP BY clause. The HAVING

clause uses conditions to restrict the number of groups selected.

ORDER BY clause

Sorts the lines of the

selection.

Syntax

… ORDER BY PRIMARY KEY

|… <si> [ASCENDING|DESCENDING]…

Sorts the selection in

ascending or descending order according to the primary key or the contents

of the fields listed.

SELECT-OPTIONS

Declares selection

criteria for a selection screen.

Syntax

Page 67: 1-ABAP

SELECT-OPTIONS <sel> FOR <f>

               [DEFAULT <g> [to <h>] [OPTION <op>] SIGN <s>]

               [MEMORY ID <pid>]

               [LOWER CASE]

               [OBLIGATORY]

               [NO-DISPLAY]

               [MODIF ID <key>]

               [NO-EXTENSION]

               [NO INTERVALS]

               [NO DATABASE SELECTION].

Declares a selection

table <sel> for the field <f>. For <sel>, places input fields on the

corresponding selection screen. The additions allow you to set a default

value, accept input in lowercase, define a required field, suppress or

modify the display on the selection screen, restrict the selection table to

a line or a selection to a single field, or prevent input from being passed

to a logical database.

SELECTION-SCREEN for

Selection Screen Formatting

Formats selection

screens

Syntax

SELECTION-SCREEN SKIP

[<n>].

SELECTION-SCREEN ULINE

[[/]<pos(len)>] [MODIF ID <key>].

SELECTION-SCREEN COMMENT

[/]<pos(len)> <comm> [FOR FIELD <f>]

                                              [MODIF ID <key>].

SELECTION-SCREEN BEGIN

OF LINE.

 …

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN

OF BLOCK <block> 

                                [WITH FRAME [TITLE <titel>]]

                                [NO INTERVALS].

Page 68: 1-ABAP

 …

SELECTION-SCREEN END OF BLOCK <block>.

SELECTION-SCREEN

FUNCTION KEY <i>.

SELECTION SCREEN

PUSHBUTTON [/]<pos(len)> <push> 

                            USER-COMMAND <ucom> [MODIF ID <key>].

Allows you to insert

blank lines, lines and comments, group input fields together in lines and

blocks, and create pushbuttons.

SELECTION-SCREEN for

Selection Screen Definition

Defines selection

screens.

Syntax

SELECTION-SCREEN BEGIN

OF <numb> [TITLE <tit>] [AS WINDOW].

 …

SELECTION-SCREEN END OF <numb>.

Defines a selection

screen with screen number <numb>. All PARAMETERS, SELECT-OPTIONS, and

SELECTION-SCREEN statements that occur between these two statements define

the input fields and the formatting of this selection screen. The TITLE

<title> addition allows you to define a title for a selection screen. You

can use the AS WINDOW addition to call a selection screen as a modal dialog

box.

SELECTION-SCREEN for

Selection Screen Versions

Defines selection screen

versions.

Syntax

SELECTION-SCREEN BEGIN

OF VERSION <dynnr>

 …

  SELECTION-SCREEN EXCLUDE <f>.

 …

SELECTION-SCREEN BEGIN OF VERSION <dynnr>.

Page 69: 1-ABAP

Only occurs in logical

databases. Hides fields that otherwise appear on the standard selection

screen.

SELECTION-SCREEN for

Logical Databases

Provides special

functions.

Syntax

SELECTION-SCREEN DYNAMIC

SELECTIONS | FIELD SELECTION

                 FOR NODE|TABLE <node>.

Only occurs in logical

databases. Declares a node as accepting dynamic selections or field

selections.

SET BIT

Sets individual bits.

Syntax

SET BIT <n> OF <f> [TO

<b>].

This statement sets the

bit at position <n> of the hexadecimal field <f> to 1 (or to the value of

field <b>). The field <b> must contain the value 0 or 1.

SET BLANK LINES

Allows blank lines in

lists.

Syntax

SET BLANK LINES ON|OFF.

Prevents blank lines

created in WRITE statements from being suppressed in list output.

SET COUNTRY

Sets output Formats

Syntax

SET COUNTRY <c>.

Sets the output formats

for numeric and date fields for the country with the ID <c>.

SET CURSOR

Page 70: 1-ABAP

Sets the cursor on the

screen.

Syntax

SET CURSOR FIELD <f>

[OFFSET <off>]

                     [LINE <lin>].

SET CURSOR LINE <lin>

[OFFSET <off>].

SET CURSOR <col> <line>.

Sets the cursor either

to a particular position in a field, line, or column of a line.

SET DATASET

Syntax

SET

DATASET <dsn> [POSITIONS <pos> | END-OF_FILE]

[ATTRIBUTE <attr>].

Changes the attributes

of a file opened using OPEN DATASET. The POSITIONS addition sets the current

read/write position to the value in the field <pos> or to the end of the

file. The ATTRIBUTE addition passes the attributes to the file in a

structure, <attr>, of the type DSET_ATTRIBUTES.

SET EXTENDED CHECK

Affects the extended

program check.

Syntax

SET EXTENDED CHECK

ON|OFF.

Switches the extended

program check (SLIN) on or off, suppressing the corresponding messages.

SET HANDLER

Registers event handlers

in ABAP Objects.

Syntax

SET HANDLER… <hi>…

[FOR <ref>|FOR ALL INSTANCES].

If you do not use the

FOR addition, the handler is set for all static events. Use the FOR addition

to register handlers for instance events.

Page 71: 1-ABAP

SET HOLD DATA

Sets a screen attribute.

Syntax

SET HOLD DATA ON|OFF.

Sets the screen

attribute "Hold data" from the program.

SET LANGUAGE

Sets the display

language.

Syntax

SET LANGUAGE <lg>.

All text symbols are

refreshed with the contents of the text pool in language <lg>.

SET LEFT SCROLL BOUNDARY

Sets the left boundary

for horizontal scrolling.

Syntax

SET LEFT SCROLL-BOUNDARY

[COLUMN <col>].

Sets the current output

position or the position <col> as the left-hand edge of the scrollable area

on the current list page.

SET LOCALE LANGUAGE

Sets the current text

environment.

Syntax

SET LOCALE LANGUAGE <lg>

[COUNTRY <c>] [MODIFIER <m>].

Sets the text

environment for alphabetical sorting according to the language <lg>, country

<c>, and any further modifier <m>.

SET MARGIN

Sets the margin of a

print page.

SET MARGIN <x> [<y>].

Sends the current list

page to the spool system with a margin of <x> columns from the left-hand

edge and <y> rows from the top edge of the page.

Page 72: 1-ABAP

SET PARAMETER

Sets an SPA/GPA

parameters

Syntax

SET

PARAMETER ID <pid> FIELD <f>.

Writes the value of the

field to the SPA/GPA parameter <pid> in the user-specific SAP memory.

SET PF-STATUS

Sets the GUI status

Syntax

SET PF-STATUS <stat>

[EXCLUDING <f>|<itab>] 

                     [IMMEDIATELY] [OF PROGRAM <prog>].

Sets the GUI status

<stat> for the subsequent screens. The EXCLUDING addition allows you to

deactivate functions dynamically. The IMMEDIATELY addition sets the GUI

status of the list currently displayed. The OF PROGRAM addition allows you

to use a GUI status from another program.

SET PROPERTY

Sets a property of an

OLE2 Automation object.

Syntax

GET

PROPERTY OF <obj> <p> = <f>.

Sets the property <p> of

an external OLE2 Automation object to <f>.

SET RUN TIME ANALYZER

Controls runtime

analysis.

Syntax

SET RUN TIME ANALYZER

ON|OFF.

The runtime analysis

only measures the runtime of the statements in the block between SET RUN

TIME ANALYZER ON and OFF.

SET RUN TIME CLOCK

Page 73: 1-ABAP

Controls runtime

analysis.

Syntax

SET RUN TIME CLOCK

RESOLUTION HIGH|LOW.

Sets the accuracy of the

runtime to low accuracy with long measurement interval or high accuracy with

shorter measurement interval.

SET SCREEN

Sets the next screen.

Syntax

SET SCREEN <scr>.

Temporarily overwrites

the statically-defined next screen with <scr>. <scr> is processed after the

current screen.

SET TITLEBAR

Sets the screen title.

Syntax

SET TITLEBAR <tit> [OF

PROGRAM <prog>] [WITH <g1 >... <g9>].

Sets the title <tit> for

the subsequent screens. The OF PROGRAM addition allows you to use a title

from another program. The WITH addition fills any placeholders in the title.

SET UPDATE TASK LOCAL

Switches on local

update.

Syntax

SET UPDATE TASK LOCAL.

Updates are processed in

the current work process.

SET USER-COMMAND

Triggers a list event.

Syntax

SET USER-COMMAND <fc>.

Triggers a list event

with the function code <fc> and calls the corresponding event block.

SHIFT

Page 74: 1-ABAP

Shifts strings.

Syntax

SHIFT <c> [BY <n>

PLACES] [LEFT|RIGHT|CIRCULAR] 

          [IN BYTE MODE|IN CHARACTER MODE].

Shifts the field <c> by

one or <n> places. The additions allow you to specify the direction, and how

the empty spaces are dealt with. In Unicode programs, you must specify

whether the statement is a character or byte operation, using the IN BYTE

MODE or IN CHARACTER MODE (default) additions.

SKIP for Blank Lines

Generates blank lines in

the display list.

Syntax

SKIP [<n>].

The system writes <n>

blank lines into the current list, starting at the current line. If no value

is specified for <n>, one blank line is output.

SKIP for Positioning

Absolute position of the

display in a list.

Syntax

SKIP TO LINE <lin>.

Positions the list

display in the line <col>.

SORT for Extracts

Sorts an extract

dataset.

Syntax

SORT [ASCENDING|DESCENDING]

[AS TEXT] [STABLE]

    … BY <fi> [ASCENDING|DESCENDING] [AS TEXT]…

Ends the creation of the

extract dataset of a program and, at the same time, sorts its records.

Without the BY option, the system sorts the dataset by the key specified in

the HEADER field group. You can define a different sort key by using the BY

Page 75: 1-ABAP

addition. The other additions specify whether you want to sort in ascending

or descending order, and whether strings should be sorted alphabetically.

SORT for Internal Tables

Sorts internal tables.

Syntax

SORT <itab> [ASCENDING|DESCENDING]

[AS TEXT] [STABLE]

           … BY <fi> [ASCENDING|DESCENDING] [AS TEXT]…

Sorts the internal table

<itab>. If you omit the BY addition, the table is sorted by its key. You can

define a different sort key by using the BY addition. The other additions

specify whether you want to sort in ascending or descending order, and

whether strings should be sorted alphabetically.

SPLIT

Splits a string.

Syntax

SPLIT

<c> AT <del> INTO <c1>… <cn> INTO TABLE <itab>

                  [IN BYTE MODE|IN CHARACTER MODE].

This statement searches

the character field <c> for delimiter strings <del> and the parts before and

after the delimiters are placed in the target fields <c1> …> � <cn>, or

into a new line of the internal table <itab>. In Unicode programs, you must

specify whether the statement is a character or byte operation, using the IN

BYTE MODE or IN CHARACTER MODE (default) additions.

START-OF-SELECTION

Event keywords for

defining event blocks for reporting events.

Syntax

START-OF-SELECTION.

After the selection

screen has been processed, the runtime environment triggers the

LOAD-OF-PROGRAM event, and the corresponding event block is executed.

STATICS

Page 76: 1-ABAP

Defines static

variables.

Syntax

STATICS <f>…

Like DATA. Retains the

value of a local variable beyond the runtime of the procedure in which it

occurs.

STOP

Leaves a reporting

event.

Syntax

STOP.

Only occurs in event

blocks for reporting events. Leaves the event block and goes to the

END-OF-SELECTION block.

SUBMIT

Calls an executable

program of type 1.

Syntax

SUBMIT <rep> [AND

RETURN] [VIA SELECTION-SCREEN]

                          [USING SELECTION-SET <var>]

                          [WITH <sel> <criterion>]

                          [WITH FREE SELECTIONS <freesel>]

                          [WITH SELECTION-TABLE <rspar>]

                          [LINE-SIZE <width>]

                          [LINE-COUNT <length>].

Calls the program <rep>.

If you omit the AND RETURN addition, the current program is terminated.

Otherwise, the data from the current program is retained, and processing

returns to the calling program when <rep> has finished running. The other

additions control the selection screen and set attributes of the default

list in the called program.

SUBTRACT for single fields

Subtracts two single

fields.

Page 77: 1-ABAP

Syntax

SUBTRACT <n> FROM <m>.

The contents of <n> are

subtracted from the contents of <m> and the results are stored in <m>. This

is equivalent to: <m> = <m> – <n>.

SUBTRACT-CORRESPONDING

Subtracts components of

structures.

Syntax

SUBTRACT-CORRESPONDING <struc1> FROM <struc2>.

All the subfields of the

structures <struc1> and <struc2> having the same name are subtracted and the

results are stored in <struc2>.

SUM

Calculates sums of

groups.

Syntax

SUM.

Only occurs in loops

through internal tables. Calculates the sums of the numeric fields in all

lines of the current control level and writes the results to the

corresponding fields in the work area.

SUPPLY

Fills context instances

with values.

Syntax

SUPPLY <key1>

= <f 1>… <key n> = <f n> TO CONTEXT

<inst>.

Fills the key fields <keyn>

of the context instance <inst> with the values <f n>.

SUPPRESS DIALOG

Prevents the current

screen from being displayed.

Syntax

Page 78: 1-ABAP

SUPPRESS DIALOG.

Can only occur in a PBO

dialog module. The screen is not displayed, but its flow logic is still

processed.

T                                                                                                                                                                                                       TABLES

Declares an interface

work area.

Syntax

TABLES <dbtab>.

Declares a structure

with the same data type and the same name as a database table, a view, or a

structure from the ABAP Dictionary. Structures in main programs and

subroutines declared using TABLES use a common data area.

TOP-OF-PAGE

Event keywords for

defining event blocks for list events.

Syntax

TOP-OF-PAGE [DURING LINE-SELECTION].

Whenever a new page

begins while a standard list is being created, the runtime environment

triggers the TOP-OF-PAGE event and the corresponding event block is

executed. The addition DURING LINE-SELECTION has the same function, but for

detail lists.

TRANSFER

Writes to a file.

Syntax

TRANSFER <f> TO [LENGTH

<len>].

Writes the field <f> to

the file <dsn> on the application server. You can specify the length of the

data you want to transfer using the LENGTH addition.

TRANSLATE

Page 79: 1-ABAP

Converts characters to

strings.

Syntax

TRANSLATE <c>  TO

UPPER|LOWER CASE

              |USING <r>.

The characters of the

string <c> are converted into upper- or lowercase, or according to a

substitution rule specified in <r>.

TRY

Introduces a TRY block.

Syntax

TRY.

Class-based exceptions

can be handled using the CATCH statement, within the block ended with ENDTRY.

TYPE-POOL

Introduces a type group.

Syntax

TYPE-POOL <tpool>.

The first statement in a

type group. This statement is not entered in the ABAP Editor, but is

automatically generated by the Dictionary in the ABAP Workbench. A type

group is an ABAP program that contains type definitions and constant

declarations that can be used in several programs.

TYPE-POOLS

Declares the types and

constants of a type group to a program.

Syntax

TYPE-POOLS <tpool>.

This statement allows

you to use all the data types and constants defined in the type group <tpool>

in your program.

TYPES for Single Field

Types

Defines a single field

type.

Page 80: 1-ABAP

Syntax

TYPES <t>[(<length>)]

[TYPE <type>|LIKE <obj>] [DECIMALS <dec>].

Defines the internal

data type <t> in the program with length <len>, reference to the ABAP

Dictionary type <type> or a data object <obj>, and, where appropriate, with

<dec> decimal places.

Syntax

TYPES <t> TYPE REF TO

<class>|<interface>.

Defines the internal

data type <t> in the program with reference to the class <class> or the

interface <interface>.

Syntax

TYPES <t> TYPE REF TO

DATA|<type>.

Defines the internal

data type <t> as a data reference to a data object.

 

TYPES for Complex Types

Defines complex types.

Syntax

TYPES: BEGIN OF

<structure>,

        …

         <ti>…, 

        …

       END OF <structure>.

Combines the data types

<ti> to form the structure <structure>. You can address the

individual components of a structure in a program using a hyphen between the

structure name and the component name as follows: <structure>-<t i>.

Syntax

TYPES <t> TYPE|LIKE <tabkind>

OF <linetype> [WITH <key>].

Defines the local data

type <t> in the program as an internal table with the access type <tabkind>,

the line type <linetype>, and the key <key>.

Page 81: 1-ABAP

Syntax

TYPES <t> TYPE|LIKE

RANGE OF <type>|<obj>.

Defines the internal

data type <t> as a RANGES table. A RANGES table has the same data type as a

selection table, but is not linked to input fields on a selection screen.

U                                                                                                                                                                                                       ULINE

Places horizontal lines

in the display list.

Syntax

ULINE [AT [/][<pos>][(<len>)]].

Without additions,

creates a new line on the current list and fills it with a horizontal line.

The additions allow you to insert a line break and specify the starting

position and length of the line.

UNPACK

Converts type P

variables to type C.

Syntax

UNPACK <f> TO <g>.

Unpacks the packed field

<f> and places it in the string <g> with leading zeros. This can be reversed

with the PACK statement.

UPDATE

Changes entries in

database tables.

Syntax

UPDATE <dbtab> SET  <si>

= <f> 

                   |<si> = <s i> + <f> 

                   |<si> = <s i> – <f> [WHERE <cond>].

The value in the column

<si> is set to the value <f>, increases it by <f>, or decreases

Page 82: 1-ABAP

it by <f> for all lines selected. The WHERE clause specifies the lines that

are changed. If you omit the WHERE clause, all lines are changed.

Syntax

UPDATE <dbtab> FROM <wa>.

UPDATE <dbtab> FROM

TABLE <itab>.

This deletes the line

that has the same primary key as the work area <wa>, or deletes all the

lines in the database that have the same primary key as a line in the

internal table <itab>. The work area <wa> or the lines of the internal table

<itab> must have at least the same length and alignment as the lines of the

database table.

W                                                                                                                                                                                                       WHEN

Introduces a statement

block in a CASE control structure.

Syntax

WHEN <f1> [OR

<f 2> OR…] | OTHERS.

The statement block

following a WHEN statement is executed if the contents of the field <f> in

the CASE statement are the same as those of one of the fields <f 

i

>. Afterwards, the program

carries on processing after the ENDCASE statement. The statement block after

WHEN OTHERS statement is executed if the contents of <f> does not equal any

of the <f 

i

> contents.

WHILE

Introduces a loop.

Syntax

WHILE <logexp> 

[VARY <f> FROM <f1> NEXT <f2>].

Introduces a statement

block that ends with ENDWHILE. The statement block between WHILE and

ENDWHILE is repeated as long as the logical expression <logexp> is true, or

Page 83: 1-ABAP

until a termination statement such as EXIT or CHECK occurs. The VARY

addition allows you to process fields the same distance apart in memory.

WINDOW

Displays a list as a

modal dialog box.

Syntax

WINDOW STARTING AT <x1> <y1> [ENDING AT <x2> <y2>].

Only occurs in list

processing. The current detail list is displayed as a modal dialog box. The

top left-hand corner of the window is positioned at column <x1> and line

<y1>. The bottom right-hand corner is positioned at column <x2> and line

<y2> (if specified).

WRITE

Displays lists.

Syntax

WRITE [AT [/][<pos>][(<len>)]] <f> [AS CHECKBOX|SYMBOL|ICON|LINE]

                                   [QUICKINFO <g>].

                                   [<format>]

The contents of the

field <f> are formatted according to their data type and displayed in the

current list. . The additions before the field allow you to specify a line

break, the starting position, and the length of the field. The additions

after the field allow you to display checkboxes, symbols, icons, and lines.

The <format> addition can contain various other formatting options. The

QUICKINFO addition allows you to assign a tool tip <g> to the field.

WRITE TO

Assigns string values.

Syntax

WRITE <f1> TO <f2> [<format>].

Converts the contents of

a data object <f1> to type C, and assigns the resulting string to the

variable <f2>. You can use the same formatting options available in the

WRITE statement