Sei sulla pagina 1di 11

Syntaxdiagramm

ADD

Syntax
ADD dobj1 TO dobj2.

Effect

This statement has the same effect as the statement

COMPUTE dobj2 = dobj2 + dobj1.

The content of dobj1 is added to the content of dobj2 and the result is assigned to dobj2.
The data objects dobj1 and dobj2 must be numeric. You cannot specify predefined
functions or functional methods. The calculation type is determined in the same way as for an
arithmetic expression.

Note

Obsolete forms: ADD...THEN...UNTIL, ADD-CORRESPONDING

Example

After adding, the result contains the character string " 1.0000000000000E+00". The result
shows that the calculation type is f. The content of the character-type field result is
converted to f before the operation and back to c after the operation.

DATA: operand TYPE f VALUE 1,


result(20) TYPE c.

ADD operand TO result.

Exceptions

Catchable Exceptions

CX_SY_ARITHMETIC_OVERFLOW

• Cause: Overflow during arithmetic operation (type P)


Runtime Error: BCD_OVERFLOW (catchable)
• Cause: Integer overflow during addition
Runtime Error: COMPUTE_INT_PLUS_OVERFLOW (catchable)

CX_SY_CONVERSION_OVERFLOW

• Cause: Overflow during arithmetic operation (type P, with specified length)


Runtime Error: BCD_FIELD_OVERFLOW (catchable)
Non-Catchable Exceptions

Runtime Error: ADD_FIELDS_ILLEGAL_ACCESS

• Cause: P field does not contain correct BCD format


Runtime Error: BCD_BADDATA

SUBTRACT

Syntax
SUBTRACT dobj1 FROM dobj2.

Effect

This statement has the same effect as statement

COMPUTE dobj2 = dobj2 - dobj1.

The content of dobj1 is subtracted from the content of dobj2 and the result is assigned to
dobj2. The data objects dobj1 and dobj2 must be numeric. You cannot specify predefined
functions or functional methods. The calculation type is determined as for an arithmetic
expression.

Note

Obsolete Form: SUBTRACT-CORRESPONDING

Exceptions

Catchable Exceptions

CX_SY_ARITHMETIC_OVERFLOW

• Cause: Overfluw during conversion / arithmetic operation (Typ P)


Runtime Error: BCD_OVERFLOW (catchable)
• Cause: Integer overflow during subtraction
Runtime Error: COMPUTE_INT_MINUS_OVERFLOW (catchable)

CX_SY_CONVERSION_OVERFLOW

• Cause: Overflow during conversion / arithmetic operation (type P, with specified


length)
Runtime Error: BCD_FIELD_OVERFLOW (catchable)

Non-Catchable Exceptions

• Cause: P field does not contain correct BCD format


Runtime Error: BCD_BADDATA
MUTIPLY

Syntax
MULTIPLY dobj1 BY dobj2.

Effect

This statement has the same effect as the statement

COMPUTE dobj1 = dobj1 * dobj2.

The content of dobj1 is multiplied with the content of dobj2 and the result is assigned to
dobj1. The data objects dobj1 and dobj2 must be numeric. You cannot specify built-in
functions or functional methods. The calculation type is determined as for an arithmetic
expression.

Note

Obsolete Form: MULTIPLY-CORRESPONDING

Exceptions

Catchable Exceptions

CX_SY_ARITHMETIC_OVERFLOW

• Cause: Overflow at conversion / arithmetic operation (type P)


Runtime Error: BCD_OVERFLOW (catchable)
• Cause: Integer overflow at multiplication
Runtime Error: COMPUTE_INT_TIMES_OVERFLOW (catchable)

CX_SY_CONVERSION_OVERFLOW

• Cause: Overflow at conversion / arithmetic operation (type P with specified length)


Runtime Error: BCD_FIELD_OVERFLOW (catchable)

Non-Catchable Exceptions

• Cause: P field does not contain a correct BCD format


Runtime Error: BCD_BADDATA
DIVIDE

Syntax
DIVIDE dobj1 BY dobj2.

Effect

This instruction has the same effect as the instruction

COMPUTE dobj1 = dobj1 / dobj2.

The content of dobj1 is divided by the content of dobj2 and the result is assigned to dobj1.
The data objects dobj1 and dobj2 have to be numeric. You cannot use built-in functions or
functional methods. The calculation type is determined like an arithmetic expression.

Note

Obsolete Form: DIVIDE-CORRESPONDING

Exceptions

Catchable Exceptions

CX_SY_ARITHMETIC_OVERFLOW

• Cause: Overflow during arithmetic operation (type P)


Runtime Error: BCD_OVERFLOW (catchable)
• Cause: Integer-overflow during division
Runtime Error: COMPUTE_INT_DIV_OVERFLOW (catchable)

CX_SY_CONVERSION_OVERFLOW

• Cause: Overflow during arithmetic operation (type P, with specified length)


Runtime Error: BCD_FIELD_OVERFLOW (catchable)

CX_SY_ZERODIVIDE

• Cause: Division by 0 (type P)


Runtime Error: BCD_ZERODIVIDE (catchable)
• Cause: Division by 0 (type F)
Runtime Error: COMPUTE_FLOAT_ZERODIVIDE (catchable)
• Cause: Division by 0 (type I)
Runtime Error: COMPUTE_INT_ZERODIVIDE (catchable)

Non-Catchable Exceptions

• Cause: P-Field does not contain correct


BCD-formatRuntime Error: BCD_BADDATA
PERFORM subr

Syntax
PERFORM subr_identifier [parameter_list].

Effect

This statement calls the subroutine specified with the name subr_identifier and assigns
the actual parameters specified in parameter_list to the formal parameters of the
subroutine.

The name subr_identifier can be specified as follows, with subr as the name of the
subroutine declared in FORM and prog as the name of an ABAP program. sname and pname
are character-like fields that contain the name of a subroutine or program while the statement
is being executed.

• subr
If you specify subr, the system calls any subroutine of the same program. The
subroutine must exist.

• {subr|(sname)} IN PROGRAM [prog|(pname)] [IF FOUND]


This statement calls any subroutine of another program or the current program. The
subroutine and the program can either be specified statically as subr and prog
(static external subroutine call) or dynamically in the character-like fields in
parentheses, sname and pname. sname and pname must contain the names of a
subroutine or program in block capitals when the statement is executed (dynamic
external subroutine call). If you do not make an entry afer IN PROGRAM, the system
searches for the subroutine in the current program.
If the addition IF FOUND is not specified and the system is unable to find the
specified subroutine or program, an untreatable exception is created.
If the addition IF FOUND is specified and the specified program does not exist, the
system ignores the PERFORM statement. If the specified program does exist, it is
loaded into the internal session, if necessary, and the system searches for the
specified subroutine without triggering the event LOAD-OF-PROGRAM. If the
subroutine exists, the event LOAD-OF-PROGRAM is triggered, if this has not already
happened, and the subroutine is then executed.

• n OF subr1 subr2 ...


This statement selects a subroutine subr in the same program from a list. The list
subr1 subr2 ... can contain up to 256 subroutines specified directly. For n, you
must specify a numeric data object that contains a number between 1 and the
number of subroutines specified when executed. The system calls the subroutine
subr, for which the list item i is contained in n. You cannot specify
parameter_list for this variant and you can only call subroutines without a
parameter interface.

• subr(prog) [IF FOUND]


With this specification, a subroutine subr of a program prog is directly specified. If
the specified subroutine or program does not exist and the addition IF FOUND is
specified, the PERFORM statement is ignored. Otherwise, the system creates an
untreatable exception.

Note

Since the direct program name prog is specified in parentheses instead of a character-like
field for the specification subr(prog) [IF FOUND], this form of the name
subr_identifier is only allowed outside classes. Instead, you must use the specification
with the addition IN PROGRAM.

Example

See parameter_list.

Exceptions

Catchable Exceptions

CX_SY_PROGRAM_NOT_FOUND

• Cause: The specified program was not found.


Runtime Error: LOAD_PROGRAM_NOT_FOUND
• Cause: The specified program cannot exist because the program name is longer than
40 characters.
Runtime Error: PERFORM_PROGRAM_NAME_TOO_LONG

CX_SY_DYN_CALL_ILLEGAL_FORM

• Cause: The specified subroutine was not found.


Runtime Error: PERFORM_NOT_FOUND
• Cause: The specified index was too small.
Runtime Error: PERFORM_INDEX_0
• Cause: The specified index was negative.
Runtime Error: PERFORM_INDEX_NEGATIVE
• Cause: The specified index was too large.
Runtime Error: PERFORM_INDEX_TOO_LARGE

CX_SY_DYN_CALL_PARAM_MISSING

• Cause: The called FORM expects more parameters than were specified.
Runtime Error: PERFORM_PARAMETER_MISSING

CX_SY_DYN_CALL_PARAM_NOT_FOUND

• Cause: More parameters were specified than expected by FORM.


Runtime Error: PERFORM_TOO_MANY_PARAMETERS

CX_SY_DYN_CALL_ILLEGAL_TYPE

• Cause: In the parameter transfer using the addition STRUCTURE, the addressing
offsets/> do not match in the current and target structures.
Runtime Error: PERFORM_BASE_WRONG_ALIGNMENT
• Cause: The deep components contained in the current and target structures cannot
be passed to each other. This error can only occur in parameter transfer using
STRUCTURE.
Runtime Error: PERFORM_CAST_DEEP_MISMATCH
• Cause: During the transfer of a generically defined type to the form, a type conflict
occurred.
Runtime Error: PERFORM_CONFLICT_GENERIC_TYPE
• Cause: The table type of the current parameter does not match the table type of the
parameter defined in the form.
Runtime Error: PERFORM_CONFLICT_TAB_TYPE
• Cause: The type of current parameter does not match the type of parameter defined
in the form.
Runtime Error: PERFORM_CONFLICT_TYPE
• Cause: The current parameter occupies less storage space than the target parameter
defined in the form. This error occurs only with parameter specification using
STRUCTURE.
Runtime Error: PERFORM_PARAMETER_TOO_SHORT
• Cause: During parameter transfer with the addition STRUCTURE, the fragment views
of the current and target parameters do not match. This error only occurs in Unicode
programs in
Runtime Error: PERFORM_CONFLICT_UC_STRUCT
• Cause:When the form is called, an internal table is expected as current parameter.
Runtime Error: PERFORM_TABLE_REQUIRED
• Cause: A hash table was passed to a parameter defined using TABLES.
Runtime Error: PERFORM_STD_TAB_REQUIRED

CALL FUNCTION func

Syntax
CALL FUNCTION func { parameter_list
| parameter_tables }.

Effect

This statement calls the function module specified in func. The identifier func must be a
character-type data object, which contains the name of a function module in uppercase letters
during the statement execution. Each function module of an SAP system has a unique name,
which is why you need not specify the function group.

Use additions parameter_list or parameter_tables (as of release 6.10) to statically or


dynamically assign actual parameters to the formal parameters of the function module and
return values to the non-class-based exceptions.

Note

If the name of a function module is specified by a constant or as a literal, the extended syntax
check can check the statement.
Exceptions

Catchable Exceptions

CX_SY_DYN_CALL_ILLEGAL_FUNC

• Cause: The called function is known but not active.


Runtime Error: CALL_FUNCTION_NOT_ACTIVE
• Cause: The called function is unknown.
Runtime Error: CALL_FUNCTION_NOT_FOUND

CX_SY_DYN_CALL_ILLEGAL_TYPE

• Cause: The type of the actual parameter does not fulfill the requirements of the
function interface.
Runtime Error: CALL_FUNCTION_CONFLICT_GEN_TYP
• Cause: The actual parameter does not have the length expected by the function.
Runtime Error: CALL_FUNCTION_CONFLICT_LENG
• Cause: The actual parameter does not have the type expected by the function.
Runtime Error: CALL_FUNCTION_CONFLICT_TYPE
• Cause: Only those functions can be called in the update task that are intended for it.
Runtime Error: CALL_FUNCTION_NO_VB
• Cause: An actual parameter does not fulfill the alignment requirements of the
respective formal parameter.
Runtime Error: CALL_FUNCTION_WRONG_ALIGNMENT

CX_SY_DYN_CALL_PARAM_MISSING

• Cause: The function expects a parameter, which has not been passed by the caller.
Runtime Error: CALL_FUNCTION_PARM_MISSING

CX_SY_DYN_CALL_PARAM_NOT_FOUND

• Cause: The caller has passed a parameter, which is not known to the function.
Runtime Error: CALL_FUNCTION_PARM_UNKNOWN

MODIFY

Syntax
MODIFY { {LINE line
[OF {PAGE page}|{CURRENT PAGE}] [INDEX idx] }
| {CURRENT LINE} }
[source].
Extras:

1. ... LINE line [{OF PAGE page }|{OF CURRENT PAGE}] [INDEX idx]

2. ... CURRENT LINE

Effect

This statement overwrites a line saved in the list buffer with the content of the sy-lisel
system field and permits additional modifications as specified in source. Furthermore, all
values that are saved for this line using HIDE are assigned the relevant variables.

The first output of a data object in the list buffer with the WRITE statement defines the output
length, which cannot be changed by the MODIFY statement. The MODIFY statement ignores
any output alignments that are specified for the output with WRITE and CENTERED, RIGHT-
JUSTIFIED.

System fields

sy-subrc Meaning
0 The specified line is available and was changed.
Not equal to0 The specified line is not available.

Notes

• It is recommended that you fill the sy-lisel system field before you execute the
MODIFY LINE statement with the content of the list line to be changed, and then
change the line exclusively using the information in source, not by changing sy-
lisel. The sy-lisel system field is filled either using list events or with the READ
LINE statement.
• For modifying icons and quick info in list lines, you can use the
LIST_ICON_PREPARE_FOR_MODIFY and LIST_MODIFY_QUICKINFO function
modules.

Addition 1

... LINE line [{OF PAGE page }|{OF CURRENT PAGE}] [INDEX idx]

Addition 2

... CURRENT LINE

Effect

The line to be changed is specified with the LINE addition or CURRENT LINE. The syntax
and description of the additions are the same as for the READ LINE statement.

Example
When you double-click on a line in the basic list, the background of the lines that are output
becomes yellow, and the background of the remaining list becomes green.

START-OF-SELECTION.
DO 10 TIMES.
WRITE / sy-index.
ENDDO.

AT LINE-SELECTION.
MODIFY CURRENT LINE FIELD FORMAT sy-index COLOR 3
LINE FORMAT COLOR 5.

DESCRIBE

Syntax Forms

Field Properties

1. DESCRIBE FIELD ...

Properties of an Internal Table

2. DESCRIBE TABLE ...

Distance Between Two Fields

3. DESCRIBE DISTANCE ...

Effect

You can use the variants of the statement DESCRIBE listed above to specify some of the
properties that have data objects at runtime.

Notes

• The statement DESCRIBE is basically used to specify the properties of data objects of
elementary data types. If DESCRIBE is used for structures or data objects of deeper
data types like strings, internaltables, or reference variables, only elementary
properties can be specified. Additional information, for example, the static or dynamic
type of a reference variable cannot be determined by DESCRIBE. For this information,
you must use the type classes of the Run Time Type Services (RTTS), which allow
the specification all properties of data objects of all data types. Since the functions of
the RTTS type classes comprise the complete functions of the DESCRIBE statement,
the system classes can be used instead of the statement.
• The variant DESCRIBE LIST specifies the properties of lists in the list buffer.

Potrebbero piacerti anche