Age: 175 Joined: 04 Oct 2007 Posts: 1218 Location: Санкт-Петербург
Posted: Tue Nov 06, 2007 12:40 am Post subject:
Написать в коде TYPE-POOLS: <имя> и кликнуть два раза на имени.
Имена типов и констант, определенных в пуле, должны начинаться с имени пула.
Quote:
TYPE-POOLS tp
Type-pools are used to declare a type pool to be used in the program.The specified type pool should already exists in the ABAP DICTONARY(SE11).Once the type pool has been declared we can use any of the constants and types declared in that type pool.
TYPE-POOL tp
Type-pool statement is used to create a type group in the ABAP dictionary.It is the first statement in the definition.The type group is used to declare constants and types and these must begin with the name of the type pool and underscore.
e.g. TYPE-POOL owntypes.
TYPES num TYPE P DECIMALS 2.
TYPES name(14) TYPE C.
To use these types in the abap program we have to use the statement
TYPE-POOLS .
e.g. TYPE-POOLS owntypes.
DATA customer TYPE owntypes_num.
DATA name TYPE owntypes_name.
Before Release 4.5A, it was not possible to define standalone types in the ABAP Dictionary to which you could refer using a TYPE addition in an ABAP program. It was only possible to refer to flat structures. Structures in programs corresponded to the structures of database tables or structures in the ABAP Dictionary. In ABAP programs, you could only refer to database tables and structures in the ABAP Dictionary using LIKE. It was, however, possible to refer to individual components of the Dictionary type. Complex local data types such as internal tables or deep structures had no equivalent in the ABAP Dictionary. The solution to this from Release 3.0 onwards was to use type groups. Type groups were based on the include technique, and allowed you to store any type definitions globally in the Dictionary by defining them using TYPES statements.
The definition of a type group is a fragment of ABAP code which you enter in the ABAP Editor. The first statement for the type group <pool> is always:
TYPE-POOL <pool>.
After this came the definitions of data types using the TYPES statement, as described in Local Data Types in Programs. It was also possible to define global constants using the CONSTANTS statement. All the names of these data types and constants must begin with the name of the type group and an underscore:
In an ABAP program, you must declare a type group as follows before you can use it:
TYPE-POOLS <pool>.
This statement allows you to use all the data types and constants defined in the type group <pool> in your program. You can use several type groups in the same program.
Let the type group HKTST be created as follows in the ABAP Dictionary:
Code:
TYPE-POOL hktst.
TYPES: BEGIN OF hktst_typ1,
col1(10) TYPE c,
col2 TYPE i,
END OF hktst_typ1.
TYPES hktst_typ2 TYPE p DECIMALS 2.
CONSTANTS hktst_eleven TYPE i VALUE 11.
This type group defines two data types HKTST_TYP1 and HKTST_TYP2, as well as a constant HKTST_ELEVEN with the value 11.
Any ABAP program can use this definition with the TYPE-POOLS statement:
Code:
TYPE-POOLS hktst.
DATA: dat1 TYPE hktst_typ1,
dat2 TYPE hktst_typ2 VALUE '1.23'.
WRITE: dat2, / hktst_eleven.
The output is:
1,23
11
The data types defined in the type group are used to declare data objects with the DATA statement and the value of the constant is, as the output shows, known in the program.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.