Ansicht
Dokumentation
ABENUNICODE_CREATE - UNICODE CREATE
Fill RESBD Structure from EBP Component Structure rdisp/max_wprun_time - Maximum work process run timeThis documentation is copyright by SAP AG.
Creating Data Objects Dynamically
Overview
1. Data objects
2. Table objects
1. Data objects
CREATE DATA allows you to create fields in a pre-defined or user-defined data type. The statement has the following variants:
CREATE DATA dref TYPE typ.
CREATE DATA dref TYPE (typname).
CREATE DATA dref LIKE field.
CREATE DATA dref TYPE LINE OF itab.
CREATE DATA dref LIKE LINE OF itab.
In the following example, the content of a specific field of a database table is read, whereby the field and table names are not known until runtime.
Example
PARAMETERS:
tab_name TYPE tname, "Table name
tab_comp TYPE tfieldname, "Field name
line_num TYPE i DEFAULT 10. "Line number
FIELD-SYMBOLS:
<wa> TYPE ANY,
<comp> TYPE ANY.
DATA:
wa_ref TYPE REF TO DATA.
CREATE DATA wa_ref TYPE (tab_name). "Suitable work area
ASSIGN wa_ref->* TO <wa>.
SELECT * FROM (tab_name) INTO <wa>.
CHECK SY-DBCNT < line_num.
ASSIGN COMPONENT tab_comp OF STRUCTURE <wa> TO
WRITE: / tab_comp,
ENDSELECT.
2. Table objects
Another variant of CREATE DATA allows you to create table objects at runtime. The line type and table key can be entered statically or dynamically.
CREATE DATA dref (TYPE [STANDARD|SORTED|HASHED] TABLE
OF (linetype | (Name) | REF TO DATA | REF TO obj))
| (LIKE [STANDARD | SORTED | HASHED] TABLE OF lineobj )
[ WITH (UNIQUE|NON-UNIQUE)
( KEY (K1 ... Kn | (KEYTAB) | TABLE_LINE )
| DEFAULT KEY ) ]
[ INITIAL SIZE M ]
The following constraints apply to this variant:
- m must be a variable or a constant without a sign, whose content at runtime has the type NUMLIKE
- keytab must be a table of the type CHARLIKE, which must not be empty, and whose components must not contain any offset, length, or overlapping key entries. You can use the TABLE_LINE addition, if the table contains only one line.
- The system returns a syntax error if either the type, or the line and key declarations are static.
-
If you do not define a key, the system uses the default key.
Note
You can also use the generic Basis types C, N, X, and P with the CREATE DATA statement, along with additions to specify the length and (for type P) the number of decimal places.
CREATE DATA dref TYPE (t | (typeName))
[ LENGTH len ]
[ DECIMALS dec ].
You can only use the LENGTH addition for types C, N, X, and P and you must always include it after the TYPE keyword. If you do not comply with syntax conventions when entering LENGTH or DECIMALS values, an exception that can be handled is raised.
General Material Data rdisp/max_wprun_time - Maximum work process run time
This documentation is copyright by SAP AG.
Length: 4219 Date: 20240329 Time: 155130 sap01-206 ( 45 ms )