BitacoraSapAbap

30-03-2008

WHERE clause (glosario ingles)

Archivado en: abap : glosario — bitacorasapabap @ 20:36:16

Variants
1. … WHERE f op g
2. … WHERE f [NOT] BETWEEN g1 AND g2
3. … WHERE f [NOT] LIKE g
4. … WHERE f [NOT] IN (g1, …, gn)
5. … WHERE f [NOT] IN itab
6. … WHERE f IS [NOT] NULL
7. … WHERE NOT cond
8. … WHERE cond1 AND cond2
9. … WHERE cond1 OR cond2
10. … WHERE (itab)
11. … WHERE cond AND (itab)
12. … FOR ALL ENTRIES IN itab WHERE cond
Effect
If a WHERE clause is specified with the commands SELECT , OPEN CURSOR , UPDATE and DELETE , only the
lines of the database table (or view ) which satisfy the specified condition(s)
are selected.
With Open SQL key words, automatic client handling is normally active. This
ensures that only data from the current client is processed when you are
working with client-specific tables. Therefore, specifying a client in the
WHERE clause does not make sense and is rejected as an error by the syntax
check.
If you use the addition … CLIENT SPECIFIED in the FROM
clause to switch off automatic client handling, the client field is treated
like a normal table field and you can formulate conditions for it in the WHERE
clause.
Notes
If, when using transparent tables, there are frequent
accesses without a complete primary key or the data is sorted in an order other
than by the primary key, you should consider whether it is worth creating an
index .
If no WHERE condition is specified, all lines (in the current client) are
selected.
Variant 1
…WHERE f op g
Effect
The condition is true if the comparison f op g is true. The
condition is false if the comparison f op g is false. Here, f is the name of a
database field (without a prefix) and g is the name of any field or literal.
You can use any of the following comparison operators:
, = EQual
NE, , >< Not Equal
LT, < Less Than
LE, Greater Than
GE, >= Greater than or Equal
Examples
Select all Lufthansa flight connections:
… WHERE CARRID = ‘LH’
Select passenger planes with fewer than 200 seats:
… WHERE SEATSMAX LT 200
Notes
If the database field f contains the NULL value, the result
of evaluating the condition is neither “true” nor “false”,
but “unknown”.
You can reverse the effect of a comparison operator by prefixing it with NOT ,
i.e. NOT EQ corresponds to NE , while NOT LE corresponds to GT , etc.
Example
If a line contains the NULL value for the field TELEPHONE ,
you cannot use any of the following conditions to select this line:
… WHERE TELEPHONE = ‘ ‘
… WHERE TELEPHONE ‘ ‘
… WHERE NOT TELEPHONE = ‘ ‘
Variant 2
… WHERE f [NOT] BETWEEN g1 AND g2
Effect
The condition is true, if the contents of the table field f
(do not) lie between g1 and g2 . Otherwise, the condition is false.
Examples
Select all passenger planes with between 200 and 250 seats:
… WHERE SEATSMAX BETWEEN 200 AND 250
Note
If the database field f contains the NULL value, the result
of evaluating the condition is neither “true” nor “false”,
but “unknown”.
Variant 3
… WHERE f [NOT] LIKE g
Addition
… ESCAPE h
Effect
The condition is true, if the contents of the table field f
(do not) correspond to the contents of the field g . Within the search pattern,
two characters have a particular meaning:
‘_’
stands for any one character.
‘%’
stands for any character string, including a blank string.
If the statement does not apply, the condition is false.
Examples
Select all customers whose names begin with ‘M’ :
… WHERE NAME LIKE ‘M%’
Select all texts which contain the word ‘customer’ :
… WHERE TEXT LIKE ‘%customer%’
Select all customers whose names do not contain ‘n’ as the second letter:
… WHERE NAME NOT LIKE ‘_n%’
Notes
You can
apply LIKE only to alphanumeric database fields, i.e. the table field f must be
one of the Dictionary types ACCP , CHAR , CLNT , CUKY , LCHR , NUMC , UNIT ,
VARC , TIMS or DATS . The comparison field g must always be type C .
The pattern can consist of up to 2n – 1 characters, if n is the same length as
the field f .
Trailing blanks in the comparison field g are ignored. If a pattern
contains trailing blanks, you must enclose it in quotation marks. If a
quotation mark is part of the pattern, you must double the opening and closing
quotation marks.
If the database field f contains the NULL value, the result of evaluating the
condition is neither “true” nor “false”, but
“unknown”.
Addition
… ESCAPE h
Effect
The field h contains an escape symbol. Within the pattern g
, this makes a special character following the escape symbol lose its special
meaning.
Example
Select all function modules whose names begin with ‘EDIT_’ :
… WHERE FUNCNAME LIKE ‘EDIT#_%’ ESCAPE ‘#’
Notes
An escape symbol can only precede one of the special
characters ‘%’ and ‘_’ or itself.
The addition ESCAPE g refers only to the immediately preceding LIKE condition.
If a WHERE clause contains several LIKE conditions, you must specify ESCAPE as
many times as required.
The field g which contains the escape symbol is always treated like a type C
field of length 1.
The addition ESCAPE g is not supported with pooled and cluster tables.
Variant 4
… WHERE f
[NOT] IN (g1, …, gn)
Effect
The condition is true, if the contents of the table field f
are (not) the same as the contents of one of the fields or literals g1, …, gn
. Otherwise, the condition is false.
Examples
Select the flight connections of American Airlines,
Lufthansa and Singapore Airlines:
… WHERE CARRID IN (’AA’, ‘LH’, ‘SQ’)
Select all flight connections apart from those of Lufthansa and Lauda Air:
… WHERE CARRID NOT IN (’LH’, ‘NG’)
Notes
There must be no blanks between the opening parenthesis
which introduces the field list and the name g1 of the first field in the field
list.
If the database field f contains the NULL value, the result of evaluating the
condition is neither “true” or “false”, but
“unknown”.
Variant 5
… WHERE [NOT] in itab
Effect
The condition is true, if the contents of the database table
field f are (not) found in the internal table itab . Otherwise, the condition
is false.
The internal table itab must have the structure of a RANGES
table for f . You can define it with RANGES itab FOR f , SELECT-OPTIONS itab
FOR f or DATA . If itab is defined with SELECT-OPTIONS , it is automatically filled with the
user’s predefined values. Otherwise, you must specify it explicitly in the
program. This is a method of specifying parts of the WHERE condition at runtime.
Each line of itab contains an elementary condition where the columns have the
following meaning:
SIGN Specifies whether the condition is inclusive or exclusive. Possible values
are:
I Inclusive
E Exclusive
OPTION Contains the operator for the elementary condition. Possible values are:
EQ, NE EQual, Not Equal
BT, NB BeTween, Not Between
CP, NP Contains Pattern,
does Not contain Pattern
LT, LE Less Than, Less than or Equal
GT, GE Greater Than, Greater than or Equal
LOW With EQ , NE , LT , LE , GT and GE , this field contains the compare value.
With BT and NB , it contains the lower limit of a range. With CP and NP , it
can extend beyond LOW and HIGH .
HIGH With BT and NB , this field contains the upper limit of a range. With CP
and NP , it contains the end of the specification begun in LOW .
The elementary conditions in itab are combined together to form a complex
condition in the following manner:
If
itab is empty, the condition f IN itab is always true.
If
itab contains only the inclusive elementary conditions i1, …, in , the
resulting condition is
( i1 OR … OR in )
If
itab contains only the exclusive elementary conditions e1, …, em , the
resulting condition is
( NOT e1 ) AND … AND ( NOT em )
If
itab contains the inclusive elementary conditions i1, …, in and the
exclusive elementary conditions e1, …, em , the resulting condition is
( i1 OR … OR in ) AND
( NOT e1 ) AND … AND ( NOT em )
Example
Select the customer numbers
‘10000000′
to ‘19999999′,
‘01104711′
as well as
all
customer numbers greater than or equal to ‘90000000′,
but not the customer numbers
‘10000810′
to 10000815′,
‘10000911
as well as
all
customer numbers where the fifth character is a ‘5′.
TABLES: SCUSTOM.
SELECT-OPTIONS: R FOR SCUSTOM-ID.
* RANGES:       R FOR SCUSTOM-ID.
* Let R be filled as follows (the order of lines is
* of no significance):
*
* SIGN  OPTION  LOW       HIGH
* I     EQ      01104711
* I     BT      10000000  19999999
* I     GE      90000000
* E     EQ      10000911
* E     BT      10000810  10000815
* E     CP      ++++5*
*
* This generates the condition
*
* ( ID = ‘01104711′                        OR
*   ID BETWEEN ‘10000000′ AND ‘19999999′   OR
*   ID >= ‘90000000′ )                       AND
* ID ‘10000911′                           AND
* ID NOT BETWEEN ‘10000810′ AND ‘10000815′   AND
* ID NOT LIKE ‘____5%’
*
SELECT * FROM SCUSTOM WHERE ID IN R.
  …
ENDSELECT.
Notes
Since a condition of the form f IN itab triggers a complex
condition at runtime, but the size of the SQL statement is restricted by the
underlying database system (e.g. no more than 8 KB), the internal table itab
must not contain too many lines.
If the database field f contains the NULL values, the result of evaluating the
condition is neither “true” nor “false”, but
“unknown”.
Variant 6
… WHERE f IS [NOT] NULL
Effect
The condition is true if the contents of the table field f
(do not) contain the NULL value.
Example
Select all customers with customer numbers for which no
telephone number is specified:
… WHERE TELEPHONE IS NULL
Note
Performance
The SAP buffer does not support this variant. Therefore, the effect of each SELECT command on a buffered table or on a view of fields
from buffered tables that contains … WHERE f IS [NOT] NULL is as if the
addition BYPASSING BUFFER was specified in the FROM
clause.
Variant 7
… WHERE NOT cond
Effect
NOT cond is true if cond is false. The condition is false of
cond is true. This produces the following truth table:
NOT
true
false
unknown
cond can be any condition according to the WHERE variants 1 – 9. NOT takes priority
over AND and OR . You can also determine the evaluation sequence by using
parentheses.
Note
Parentheses which determine the evaluation sequence must be
preceded and followed by a blank.
Example
Select the customers with customer numbers who do not live
in postal code area 68:
… WHERE NOT POSTCODE LIKE ‘68%’
Variant 8
… WHERE cond1 AND cond2
Effect
cond1 AND cond2 is true if cond1 and cond2 are true. The
condition is false if cond1 or cond2 is false. This produces the following
truth table:
AND
true
false
unknown
cond1 and cond2 can be any conditions according to the WHERE variants 1 – 9. AND
takes priority over OR , but NOT takes priority over AND . You can also
determine the evaluation sequence by using prenetheses.
Note
Parentheses which determine the evaluation sequence must be
preceded and followed by a blank.
Example
Select the customers with customer numbers which are less
than ‘01000000′ and do not live in the postal code area 68.
… WHERE ID < ‘01000000′
AND NOT
POSTCODE LIKE ‘68%’
Variant 9
… WHERE cond1 OR cond2
Effect
cond1 OR cond2 is true if cond1 or cond2 is true. The
condition is false if cond1 and cond2 are false. This produces the following
truth table:
OR
true
false
unknown
cond1 and cond2 can be any conditions according to the WHERE variants 1 – 9.
Both NOT and AND take priority over OR . You can also determine the evaluation
sequence by using parentheses.
Note
Parentheses which determine the evalutation sequence must be
preceded and followed by a blank.
Example
Select the customers with customer numbers which are less
than ‘01000000′ or greater than ‘02000000′:
… WHERE ID ‘02000000′.
Select the customers with customer numbers which are less than ‘01000000′ or
greater than ‘02000000′ and do not live in the postal code areas 68 or 69
… WHERE ( ID ‘02000000′ )
AND NOT
( POSTCODE LIKE ‘68%’ OR POSTCODE LIKE ‘69%’ )
Variant 10
… WHERE (itab)
Effect
The condition is true if the contents of the table fields
satisfy the condition stored in the internal table itab . itab is filled at
runtime, i.e. the condition for the fields is specified dynamically.
Notes
This variant is exclusively for use with SELECT . The
internal table itab can only have one field which must be of type C and not be
greater than 72 characters. itab must be specified in parentheses with no
blanks between the parentheses and the table name. The condition specified in
the internal table itab must have the same form as a condition in the ABAP/4
source code. The following restrictions apply:
- You can only use literals as values, not variables.
- The operator IN cannot be used in the form f1 IN itab1 .
The internal table itab can be empty.
Note
Performance
Since the syntax check may not be performed until runtime, a WHERE condition
needs more execution time than a corresponding specification in the program
code.
Example
Display flight connections after entry of airline carrier
and flight number:
TABLES:     SPFLI.
PARAMETERS: CARR_ID LIKE SPFLI-CARRID,
            CONN_ID LIKE SPFLI-CONNID.
DATA:       WTAB(72) OCCURS 100 WITH HEADER LINE,
            AND(3).
REFRESH WTAB.
IF NOT CARR_ID IS INITIAL.
  CONCATENATE ‘CARRID = ”’ CARR_ID ”” INTO WTAB.
  APPEND WTAB.
  AND = ‘AND’.
ENDIF.
IF NOT CONN_ID IS INITIAL.
  CONCATENATE AND ‘ CONNID = ”’ CONN_ID ”” INTO WTAB.
  APPEND WTAB.
ENDIF.
SELECT * FROM SPFLI WHERE (WTAB).
  WRITE: / SPFLI-CARRID, SPFLI-CONNID, SPFLI-CITYFROM,
           SPFLI-CITYTO, SPFLI-DEPTIME.
ENDSELECT.
Variant 11
… WHERE cond AND (itab)
Effect
Like variant 10. For the condition to be true, the table
fields must also satisfy the condition cond .
Note
When specifying a condition cond in the program code
together with a condition in an internal table itab , the table name must
appear in parentheses after the condition cond and be linked with AND . There
must be no blanks between the name of the internal table and the parentheses.
Variant 12
… FOR ALL ENTRIES IN itab WHERE cond
Effect
Selects only those lines of the database table which satisfy
the WHERE condition cond where each occurring replacement symbol itab-f is
replaced by the value of the component f in the internal table itab for at
least one line. Clearly, a SELECT command with … FOR ALL ENTRIES IN itab
WHERE cond forms the union of solution sets for all SELECT commands which
result when, for each line of the internal table itab , each symbol itab-f
addressed in the WHERE condition is replaced by the relevant value of the
component f in this table line. Duplicate lines are eliminated from the result
set. If the internal table itab contains no entries, the processing continues
as if the WHERE condition cond has failed.
Example
Display a full list of flights on 28.02.1995:
TABLES SFLIGHT.
DATA:  BEGIN OF FTAB OCCURS 10,
         CARRID LIKE SFLIGHT-CARRID,
         CONNID LIKE SFLIGHT-CONNID,
       END OF FTAB,
       RATIO TYPE F.
* Let FTAB be filled as follows:
*
* CARRID  CONNID
* ————–
* LH      2415
* SQ      0026
* LH      0400
SELECT * FROM SFLIGHT FOR ALL ENTRIES IN FTAB
                      WHERE CARRID = FTAB-CARRID AND
                            CONNID = FTAB-CONNID AND
                            FLDATE = ‘19950228′.
  RATIO = SFLIGHT-SEATSOCC / SFLIGHT-SEATSMAX.
  WRITE: / SFLIGHT-CARRID, SFLIGHT-CONNID, RATIO.
ENDSELECT.
Notes
… FOR ALL ENTRIES IN itab WHERE cond can only be used with
a SELECT command.
In the WHERE condition … FOR ALL ENTRIES IN itab WHERE cond , the symbol
itab-f always has the meaning of a replacement symbol and must not be confused
with the component f of the header line in the internal table itab . The internal
table itab does not have to have a header line.
The line structure of the internal table itab must be a field string. Each
component of this field string which occurs in a replacement symbol in the
WHERE condition must be of exactly the same type and length as the
corresponding component in the table work area (see TABLES
).
Replacement symbols must not occur in comparisons with the operators LIKE ,
BETWEEN and IN .
FOR ALL ENTRIES IN itab excludes ORDER BY f1 … fn in the ORDER-BY clause .
The internal table itab cannot be used at the same time in the INTO clause .
Notes
Performance
Conditions should always be checked with the WHERE clause, not with CHECK , because
the data can then be selected with an index. Also, this reduces the load on the
network.
For frequently used SELECT statements, you should employ an index. In the WHERE
clause, the fields of the index should be specified in the defined order and linked
by the logical AND with comparisons for equality.
Complex WHERE clauses are unsuitable for the statement optimizer of a database
system because they must be broken down into several single statements.
In a WHERE clause, the logical NOT cannot be supported by an index.
Index
© SAP AG 1996

WHEN (glosario ingles)

Archivado en: abap : glosario — bitacorasapabap @ 20:36:15

Variants
1. WHEN f.
2. WHEN OTHERS.
Effect
See CASE .
Index
© SAP AG 1996

UPDATE (glosario ingles)

Archivado en: abap : glosario — bitacorasapabap @ 20:36:15

Variants
1. UPDATE dbtab SET s1 … sn.
2. UPDATE dbtab. or
UPDATE *dbtab. or
UPDATE (dbtabname) … .
3. UPDATE dbtab FROM TABLE itab. or
UPDATE (dbtabname) FROM TABLE itab.
Effect
Updates values in a database table (see Relational database
). You can specify the name of the database table either directly in the form
dbtab or at runtime as contents of the field dbtabname . In both cases, the
table must be known to the ABAP/4 Dictionary . If you specify the name of the
database table directly, the program must also contain an appropriate TABLES statement. Normally, lines are updated only in the
current client. Data can only be updated using a view if the view refers to a
single table and was created in the ABAP/4 Dictionary with the maintenance
status “No restriction”.
UPDATE belongs to the Open SQL command set.
Notes
Authorization checks are not supported by the UPDATE
statement. You must include these in the program yourself.
Changes to lines made with the UPDATE command only become final after a
database commit (see LUW ). Prior to this, any database update can be canceled
by a database rollback (see Programming transactions ).
In the dialog system, you cannot rely on the database system locking mechanism
alone to synchronize simultaneous access to the same database by several users.
Therefore, it is often necessary to use the SAP locking mechanism .
Variant 1
UPDATE dbtab SET s1 … sn.
Additions
1. … WHERE condition
2. … CLIENT SPECIFIED
Effect
Updates values in a database table. If there is no WHERE clause , all lines (in the current client) are
updated. If a WHERE condition is specified, only those records which satisfy
the condition are updated.
The SET clause s1 … sn identifies the columns to be updated and assigns
values to them. Three types of SET statements si are supported:
f = g In all selected lines, the database table column determined by f receives
the values of the ABAP/4 field or literal g .
f = f + g In all selected lines, the contents of the ABAP/4 field or literal g
is added to the value in the database table column determined by f . The NULL
value remains unchanged. This statement can only be applied to a numeric field.
f = f – g In all selected lines, the contents of the ABAP/4 field or literal g
is subtracted from the value in the database table column determined by f . The
NULL value remains unchanged. This statement can only be applied to a numeric
field.
When the command has been executed, the system field SY-DBCNT contains the
number of updated lines.
The return code value is set as follows:
SY-SUBRC = 0 At least one line was updated,
SY_SUBRC = 4 No line was updated because no line could be selected.
Note
With pooled and cluster tables, an UPDATE cannot change any primary
key field.
Examples
Update discount for all customers (in the current client) to
3 percent:
TABLES SCUSTOM.
UPDATE SCUSTOM SET DISCOUNT = ‘003′.
Note
The ‘colon and comma’ logic in the program fragment
UPDATE SCUSTOM SET: DISCOUNT  = ‘003′,
                    TELEPHONE = ‘0621/444444′
              WHERE ID        = ‘00017777′.
defines record chains,
not
through a single statement which updates the discount and the telephone
number of the customer with the customer number ‘00017777′,
but
by means of two statements where the first updates the discount for all
customers and the second changes the telephone number of the customer with
the customer number ‘00017777′.
Addition 1
… WHERE condition
Effect
Updates only those lines which satisfy the WHERE clause condition .
Example
Increase the number of occupied seats on Lufthansa flight
0400 on 28.02.1995 by 3 (in the current client):
TABLES SFLIGHT.
UPDATE SFLIGHT SET   SEATSOCC = SEATSOCC + 3
               WHERE CARRID   = ‘LH’   AND
                     CONNID   = ‘0400′ AND
                     FLDATE   = ‘19950228′.
Addition 2
… CLIENT SPECIFIED
Effect
Switches off automatic client handling. This allows you to
update across all clients when using client-specific tables. The client field
is treated like a normal table field, for which you can formulate suitable
conditions in the WHERE clause.
This addition must immediately follow the database table name.
Example
Increase the number of occupied seats on Lufthansa flight
0400 on 28.02.1995 by 3 in
client 2:
TABLES SFLIGHT.
UPDATE SFLIGHT CLIENT SPECIFIED
               SET   SEATSOCC = SEATSOCC + 3
               WHERE MANDT    = ‘002′  AND
               WHERE CARRID   = ‘LH’   AND
                     CONNID   = ‘0400′ AND
                     FLDATE   = ‘19950228′.
Variant 2
UPDATE dbtab. or
UPDATE *dbtab. or
UPDATE (dbtabname) … .
Additions
1. … FROM wa
2. … CLIENT SPECIFIED
Effect
These are SAP-specific short forms which update one single
line of a database table. The primary key for identifying the line to be
updated and the values to be changed when specifying the database table name in
the program are taken from the table work area – dbtab or *dbtab . If the
database table name is determined at runtime, you need to use the addition …
FROM wa .
When the command has been executed, the system field SY-DBCNT contains the
number of updated lines (0 or 1).
The return code value is set as follows:
SY-SUBRC = 0 The specified line was updated,
SY_SUBRC = 4 No line was updated because no line with the specified primary key
exists.
Examples
Update discount for the customer with the customer number
‘00017777′ to 3 percent (in the current client):
TABLES SCUSTOM.
SCUSTOM-ID       = ‘00017777′.
SCUSTOM-DISCOUNT = ‘003′.
UPDATE SCUSTOM.
Addition 1
… FROM wa
Effect
Takes the values for the line to be updated not from the
table work area dbtab , but from the explicitly specified work area wa . Here,
the data is taken from wa , moving from left to right according to the
structure of the table work area dbtab (defined with TABLES
). Since the structure of wa is ignored, the work area wa must be at least as
wide (see DATA ) as the table work area dbtab and the
alignment of the work area wa must correspond to the alignment of the table
work area. Otherwise, a runtime error occurs
Example
Update the telephone number of the customer with the
customer number ‘12400177′ in the current client:
TABLES SCUSTOM.
DATA   WA LIKE SCUSTOM.
WA-ID        = ‘12400177′.
WA-TELEPHONE = ‘06201/44889′.
UPDATE SCUSTOM FROM WA.
Note
If you do not explicitly specify a work area, the values for
the line to be updated are taken from the table work area dbtab , even if the
statement appears in a FORM or FUNCTION
where the table work area is held in a formal parameter or a local variable.
Addition 2
… CLIENT SPECIFIED
Effect
Like variant 1.
Variant 3
UPDATE dbtab FROM TABLE itab. or
UPDATE (dbtabname) FROM TABLE itab.
Addition
… CLIENT SPECIFIED
Effect
Mass update of several lines in a database table. Here, the
primary key for identifying the lines to be updated and the values to be
changed are taken from the lines of the internal table itab . The lines of the
internal table must satisfy the same conditions as the work area wa in addition
1 to variant 2.
The system field SY-DBCNT contains the number of updated lines, i.e. the number
of lines in the internal table itab which have key values corresponding to
lines in the database table.
The return code value is set as follows:
SY-SUBRC = 0 All lines from itab could be used to update the database table.
SY_SUBRC = 4 At least one line of the internal table itab in the database
table, had no line with the same primary key. The other lines of the database
table were updated.
Note
If the internal table itab is empty, SY-SUBRC and SY-DBCNT
are set to 0.
Addition
… CLIENT SPECIFIED
Effect
Like variant 1.
Index
© SAP AG 1996

UNPACK (glosario ingles)

Archivado en: abap : glosario — bitacorasapabap @ 20:36:14

Basic form
UNPACK f TO g.
Effect
Unpacks the packed field f and places it in the field g with
leading zeros. If g is too short, it is truncated on the left.
Example
DATA: P_FIELD(2) TYPE P VALUE 103,
      C_FIELD(4) TYPE C.
UNPACK P_FIELD TO C_FIELD.
P_FIELD: P’103C’
–> C_FIELD: C’0103′
Notes
If f is not type P , it is converted to type P (see MOVE ).
g should always be type C . Otherwise, unwanted side effects may occur.
The sign in the packed number is ignored.
Index
© SAP AG 1996

ULINE (glosario ingles)

Archivado en: abap : glosario — bitacorasapabap @ 20:36:13

Variants
1. ULINE.
2. ULINE AT pl.
Variant 1
ULINE.
Effect
Outputs an unbroken underline.
Note
The underline extends across the entire line depending on
the list width. Then, the cursor is positioned at the beginning of the next
line.
Variant 2
ULINE pl.
Effect
Outputs an underline with a position and length determined
by pl .
The position and length specification can consist of three parts:
/ New line
p Output position (one- to three-character number or
variable)
(l) Output length (one- to three-character number or
variable)
Any of these components can be omitted (see WRITE ).
Note
If the position and length specification contains
exclusively direct values, it can be specified without an introductory AT .
The statement
ULINE AT 3(10).
corresponds to the statement
WRITE AT 3(10) SY-ULINE.
Index
© SAP AG 1996

TYPE-POOLS (glosario ingles)

Archivado en: abap : glosario — bitacorasapabap @ 20:36:12

Basic form
TYPE-POOLS typepool.
Effect
Includes the types and constants of a type group. If the
type group typepool has already been included, the statement is ignored. You
can only maintain a type group via the ABAP/4 Dictionary (using Transaction
SE11 ). You introduce a type group with the TYPE-POOL
statement. Since the types and constants specified in a type group have global
validity, you cannot use the statement within a FORM or FUNCTION .
Example
TYPE-POOLS VERI1.
DATA X TYPE VERI1_TYP1.
Index
© SAP AG 1996

TYPE-POOL (glosario ingles)

Archivado en: abap : glosario — bitacorasapabap @ 20:36:12

Basic form
TYPE-POOL typepool.
Effect
Introduces a type group. You can only maintain a type group
via the ABAP/4 Dictionary (using Transaction SE11 ). The name typepool must
match the name in the ABAP/4 Dictionary . You can only define types and
constants in type groups. The names of all these types and constants must begin
with the name of the type group and an underscore.
Example
TYPE-POOL ABCDE.
TYPES: ABCDE_PACKED TYPE P,
       ABCDE_INT    TYPE I.
Index
© SAP AG 1996

TYPES (glosario ingles)

Archivado en: abap : glosario — bitacorasapabap @ 20:36:11

Variants
1. TYPES typ.
2. TYPES typ(len).
3. TYPES: BEGIN OF rectyp,

END OF rectyp.
Effect
The TYPES statement introduces user-defined data types . As
with standard data types, you can use them when creating data objects and when
assigning types to formal parameters and field symbols. User-defined data types
are an essential component of the ABAP/4 type concept .
Variant 1
TYPES f.
Additions
1. … TYPE typ1
2. … LIKE f
3. … TYPE typ1 OCCURS n
4. … LIKE f OCCURS n
5. … TYPE LINE OF itabtyp
6. … LIKE LINE OF itab
7. … DECIMALS n
Effect
Creates a new type. If the TYPE addition is not used, the
new type points to the standard type C .
The type name typ can be up to 30 characters long. Apart from the special
characters ‘(’, ‘)’, ‘+’, ‘.’, ‘,’, ‘:’, ‘-’, ‘’, you can use
any characters. Numbers are allowed, but the name cannot consist of numbers
alone.
Recommendations for type names:
Always use a letter as the first character.
Use the underscore as the link in multiple word names (e.g. NEW_PRODUCT ).
Addition 1
… TYPE typ1
Effect
Defines the new type with the type typ1 . typ1 can be one of
the predefined types specified below or a type you define yourself with TYPES .
The length (SL) of the type typ is the same as the type typ1 .
Type Description Std len. Initial value
C Text (character) 1 Blank
N Numeric text 1 ‘00…0′
D Date (YYYYMMDD) 8 ‘00000000′
T Time (HHMMSS) 6 ‘000000′
X Hexadecimal 1 X’00′
I Whole number (integer) 4 0
P Packed number 8 0
F Floating point number 8 ‘0.0′
Example
TYPES NUMBER TYPE I.
This defines the type NUMBER NUMBER with the type I . It can then be used in
the program.
Notes
The data type I is the whole number type for the hardware
you are using. Its value range is -2**31 to 2**31-1 (-2.147.483.648 to
2.147.483.647).
While type P is used for money amount fields, you should use type I for number
fields, index fields, position specifications, etc.
Apart from zero, type F allows you to display positive and negative numbers in
the range from 1E-307 to 1E+307 with 15 decimal places. (The ABAP/4 processor
uses the floating point operations of the relevant hardware and does not
attempt to standardize them.) Floating point literals must be enclosed in
quotation marks. The standard output length is 22.
Input in type F fields can be formatted differently:
Decimal number with or without sign, with or without decimal point.
In the form E, where the mantissa is a decimal number and the exponent can be
specified with or without a sign. (Examples of floating point literals: ‘1′,
‘-12.34567′, ‘-765E-04′, ‘1234E5′, ‘+12E+34′, ‘+12.3E-4′, ‘1E160′).
Floating point arithmetic is fast on our hardware platforms. It is ideal when
you require a large value range and can take rounding errors into account when
making calculations. Such rounding errors can occur when converting from
external (decimal) format to internal format (base 2 or 16) or vice-versa (see
ABAP/4 number types ).
Addition 2
… LIKE f
Effect
Defines the type typ with the type of the field f . f may be
a database field or an already defined internal field.
Example
TYPES TABLE_INDEX_TYP LIKE SY-TABIX.
The type TABLE_INDEX_TYP now points to the type of the field SY-TABIX (index
for internal tables).
Note
This addition is useful in a number of cases, since any
field type changes are automatically known to the program. Also, any
unnecessary and unwanted conversions are not performed.
Addition 3
… TYPE typ1 OCCURS n
Effect
Defines the type of an internal table without a header line.
An internal table without a header line consists of any number of table lines
that have the same structure as that specified by TYPE .
You fill and process an internal table with statements such as APPEND , READ TABLE , LOOP and SORT .
The OCCURS parameter n specifies how many table lines of storage is required.
This storage reservation process does not happen until the first line is
inserted in the table. The value n of the OCCURS specification has no effect on
type checking, i.e. data objects which have types with different OCCURS
specifications are type-compatible.
Example
TYPES: TAB_TYPE TYPE I OCCURS 20.
DATA: TAB TYPE TAB_TYPE,
TAB_WA TYPE I.
TAB_WA = 1.
APPEND TAB_WA TO TAB.
TAB_WA = 2.
APPEND TAB_WA TO TAB.
The internal table TAB now consists of two table entries.
Addition 4
… LIKE f OCCURS n
Effect
Defines the type of an internal table without a header line.
This table consists of any number of table lines which have the structure
specified by the data object f . Processing is the same as for addition 3.
Example
DATA:  BEGIN OF PERSON,
         NAME(20),
         AGE TYPE I,
       END OF PERSON.
TYPES  TYPE_PERSONS LIKE PERSON OCCURS 20.
DATA   PERSONS TYPE TYPE_PERSONS.
PERSON-NAME = ‘Michael’.
PERSON-AGE  = 25.
APPEND PERSON TO PERSONS.
PERSON-NAME = ‘Gabriela’.
PERSON-AGE  = 22.
APPEND PERSON TO PERSONS.
The internal table PERSONS now consists of two table entries.
Addition 5
… TYPE LINE OF itabtyp
Effect
The specified type itabtyp must be the type of an internal
table with or without a header line. The statement creates a type corresponding
to the line type of the specified table type.
Example
TYPES TAB_TYP TYPE I OCCURS 10.
TYPES MY_TYPE TYPE LINE OF TAB_TYP.
The type MY_TYPE now has the same attributes as a line of
the table type TAB_TYP and is thus type I .
Addition 6
… LIKE LINE OF itab
Effect
The data object itab must be an internal table with or
without a header line. The statement defines a type which corresponds to the
line type of the specified table.
Example
DATA  TAB TYPE I OCCURS 10.
TYPES MY_TYPE LIKE LINE OF TAB.
The type MY_TYPE now has the same attributes as the line type of the table TAB
and thus has the type I .
Addition 7
… DECIMALS n
Effect
This addition only makes sense with the field type P . When
making calculations and outputting data, a field of this type has n decimal
places. n must be a value between 0 and 14.
Normally, the attribute for fixed point arithmetic is set with newly created
programms. If you switch this attribute off, the DECIMALS -specification is
taken into account on output, but not when making calculations. In this case,
the programmer must take care that the decimal point is in the right place by
multiplying or dividing (COMPUTE ) by the appropriate
power of ten.
When making calculations, you should always have fixed point arithmetic
switched on. Then, even intermediate results (division!) are calculated with
the greatest possible accuracy (31 decimal places).
To decide whether the fixed point type P or the floating point type F is more
suitable, see also “ABAP/4 number types “.
Variant 2
TYPES typ(len).
Additions
Similar to variant 1
Effect
Creates the type typ with the
length len .
This variant should only be used with the types C , N , P and X . Other types
can only be created in the standard length (see table under effect of variant
1).
The permitted lengths depend on the type being pointed to:
Type Permitted lengths
C 1 – 65535
N 1 – 65535
P 1 – 16
X 1 – 65535
Note
For each byte, you can display one character, two decimal
digits or two hexadecimal digits. With P fields, one place is reserved for the
leading sign, so that a P field of the length 3 can contain 5 digits, while an
X field of the length 3 can contain 6 digits. Both have an output length of 6.
Variant 3
TYPES: BEGIN OF rectyp,

END OF rectyp.
Effect
Defines the field string type rectyp by grouping together
all fields of the type rectyp defined between ” BEGIN OF rectyp ” and
” END OF rectyp “. Each name is prefixed by ” rectyp- “.
Example
TYPES: BEGIN OF PERSON,
         NAME(20) TYPE C,
         AGE      TYPE I,
       END   OF PERSON.
Index
© SAP AG 1996

TRANSLATE (glosario ingles)

Archivado en: abap : glosario — bitacorasapabap @ 20:36:10

Variants
1. TRANSLATE c TO UPPER CASE.
2. TRANSLATE c TO LOWER CASE.
3. TRANSLATE c USING c1.
4. TRANSLATE c FROM CODE PAGE g1 TO CODE PAGE g2.
5. TRANSLATE c FROM NUMBER FORMAT n1 TO NUMBER FORMAT n2.
Variant 1
TRANSLATE c TO UPPER CASE.
Variant 2
TRANSLATE c TO LOWER CASE.
Effect
In the field c , converts all lower case letters to upper
case or all upper case letters to lower case, as specified.
Example
DATA LETTERS(3).
MOVE ‘abc’ TO LETTERS.
TRANSLATE LETTERS TO UPPER CASE.
The field LETTERS now contains ‘ABC’ .
Variant 3
TRANSLATE c USING c1.
Effect
Replaces the letters in the field c according to the
contents of c1 .
If a character in c also exists in c1, it is replaced by the letter that f o l
l o w s it in c1. If a character from c is not found in c1, it remains
unchanged.
Example
DATA: LETTERS(10) VALUE ‘abcX’,
      CHANGE(6)   VALUE ‘aXBY’.
TRANSLATE LETTERS USING CHANGE.
The field LETTERS now contains ‘XbcX’ .
Variant 4
TRANSLATE c …FROM CODE PAGE g1 …TO CODE PAGE g2.
TRANSLATE F TO CODE PAGE G2.
TRANSLATE F FROM CODE PAGE G1.
Effect
Performs a character code conversion in the field F . To
achieve this, the SAP character code is determined from the conversion table G1
and a new character code derived from G2 . You can use the Transaction SPAD to
maintain the conversion tables TCP00 – TCP02 .
Example
DATA F(72).
TRANSLATE F FROM CODE PAGE ‘1110′ TO CODE PAGE ‘0100′.
translates the contents of F from the HP character set to
EBCDIC ( IBM 274).
Note
Type I , P , F and X fields remain unchanged. Field strings
and work areas of internal tables are converted to the correct type for each
individual field. At present, table work areas (as defined in TABLES … ) are
not treated according to type, but are converted as a whole. If necessary,
declare a field string with INCLUDE STRUCTURE and then perform a conversion.
Variant 5
TRANSLATE c …FROM NUMBER FORMAT n1 …TO NUMBER FORMAT n2.
TRANSLATE F TO NUMBER FORMAT N1.
TRANSLATE F FROM NUMBER FORMAT N1.
Effect
Performs a number format conversion in the field F . The
number formats supported at present are ‘0000′ ( HP , SINIX , IBM ) and ‘0101′
( DEC alpha OSF ). Any attempt to enter formats other than these results in a
runtime error. If you omit FROM NUMBER FORMAT or TO NUMBER FORMAT , the system
number format is used for the omitted part.
Example
DATA: F TYPE F,
      HEX (2) TYPE X,
      NFORM LIKE TCP00-CPCODEPAGE.

* In /ARCHIV was stored by another platform from HEX and F.
* HEX contains the valid number format and can be read on all
* platforms.
READ DATASET ‘/ARCHIV’ INTO HEX.
READ DATASET ‘/ARCHIV INTO F.
NFORM = HEX.  “Conversion of machine-independent HEX to NUMC(4)
TRANSLATE F FROM NUMBER FORMAT NFORM.
Effect
Converts the contents of F from the format NFORM of a
platform to the system format.
Note
Type I and F fields are converted. Field strings and work
areas of internal tables are converted to the correct type for each individual
field. Table work areas (as defined with TABLES … ) are treated as type C at
present and are not converted. If necessary, declare a field string with
INCLUDE STRUCTURE and then perform a conversion.
In the interests of storing additional information for archiving purposes, you
can use the function module SYSTEM_FORMAT to display the system code page and
system number format.
Note
Performance
Converting lower case letters to upper case letters or upper case letters to
lower case letters in a 10-byte long character field takes approx. 7 msn
(standardized microseconds).
Replacing two letters in a 10-byte long field with the variant … c USING c1
… takes approx. 9 msn.
Note
Runtime errors
TRANSLATE_WRONG_NUM_FORMAT
: Invalid number format.
Related REPLACE , OVERLAY
Index
© SAP AG 1996

TRANSFER (glosario ingles)

Archivado en: abap : glosario — bitacorasapabap @ 20:36:09

Basic form
TRANSFER f TO dsn.
Addition
… LENGTH len
Effect
Transfers the field f (usually a field string) to the
sequential file specified in dsn (this may be a literal or a field).
Binary
mode (addition IN BINARY MODE of the OPEN DATASET
statement):
Write to the file in the length of field f .
Text
mode (addition IN TEXT MODE of the OPEN DATASET
statement):
Write a line.
If the specified file is not open, TRANSFER attempts to open the file dsn FOR
OUTPUT ( IN BINARY MODE or using the further specifications of the last OPEN
command for this file). If this fails, a runtime error occurs.
Example
DATA REC(80).
TRANSFER REC TO ‘/usr/test’.
Notes
You
can read sequential datasets with READ DATASET
.
The
structure of file names depends very much on the operating system you are
using. You can access portable programs with the function module
GET_FILE_NAME . This returns the relevant physical name for a given
logical file name.
Addition
… LENGTH len
Effect
Transfers the length of the record to be output in the
length len .
Index
© SAP AG 1996
TRANSFER-DYNPRO is not an ABAP/4 key word (in R/3).
To create batch input sessions, please use the function modules BDC_… in the
function group SBDC .
Index
© SAP AG 1996

« Entradas más recientesEntradas más antiguas »

Blog de WordPress.com.