Table Types and Type Groups in ABAP
Table Types
Table types are type definitions for Internal tables. By using them you can declare internal tables in your program.
Creating a table type
- Go to SE11, select Data type Radio button, provide a name for table type, and click Create button. Ex. ZTSCARR
- Select Table type radio button and click Continue.
- In the maintenance screen provide short text
- Provide an existing DDIC structure name as line type. Ex. SCARR
- under the tab initialization and access select the type of the internal table. Usually we create Standard tables.
- Finally Save and activate.
- In the future programs internal tables without header line can be created using this table type. Ex. DATA it_data TYPE ZTSCARR.
Type Groups
Type group is a DDIC object which is a collection of user defined Data types and constants.
Creating a type group
- Go to SE11, select Type Group radio button and provide a name for it. Ex. ZBRSL, and click on Create button.
- In the maintenance screen, provide short text and start creating your own user defined data types and Constants.
- Every data type and Constant should be prefixed by the name of the type group.
TYPES: ZBRSL_STR(30) TYPE C.
TYPES: ZBRSL_FLOAT TYPE P DECIMALS 3. TYPES: BEGIN OF ZBRSL_STUDENT, RNO TYPE I, NAME(20) TYPE C, FEE TYPE P DECIMALS 2, END OF ZBRSL_STUDENT. CONSTANTS ZBRSL_PI TYPE P DECIMALS 3 VALUE '3.147'.
4. Finally save and Activate.
5. To use a type group in a program attach it to the program by the key word:
TYPE-POOLS Ex: TYPE-POOLS ZBRSL.
Comments
Post a Comment