TABLE TYPES IN DATA DICTIONARY

TABLE TYPES IN DATA DICTIONARY:

Table type: 

Table type is used to declare the internal table globally. Table type is a collection of structures ( Each line in the table type is similar as structure ).

Creation of Table type is two step procedure.
   1. Create the Structure with the required fields.
   2. Create the Table type based on structure.

Steps to Create the Structure:

1. Execute SE11.
2. Select the radio button "data type".
3. Provide the structure name ( Eg: ZST_COMP ) and click on Create.



4. Select the radio button "Structure" and click on Enter.


5. Provide short description ( Eg: Company Structure ).
6. Provide component (fields) and component type (data element).



7. Save, Check and Activate the Structure.

Steps to create Table type based on the Structure:

1. Execute SE11.
2. Select the radio button "data type".
2. Provide the Table type name ( Eg: ZTT_COMP ) and click on Create.



4. Select the radio button "Table type" and click on Enter.



5. Provide short description ( Eg: Table type for company ).
6. Provide Line type as Structure name ( Eg: ZST_COMP ).



7. Save, Check and Activate the Table type.

Using Table Type in Program:

*&---------------------------------------------------------------------*
*& Report  ZTT_IN_PROGRAM
*&
*&---------------------------------------------------------------------*

REPORT  ZTT_IN_PROGRAM.

* Declaration
Data : LT_T001 TYPE ZTT_COMP,    '' Declared with table type
           LS_T001 LIKE LINE OF LT_T001.

* Fetch the data
SELECT BUKRS
       BUTXT
       ORT01
       FROM T001
       INTO TABLE LT_T001.

* Display the data 
LOOP AT LT_T001 INTO LS_T001.
   WRITE: / LS_T001-BUKRS,
            LS_T001-BUTXT,
            LS_T001-ORT01.

   ENDLOOP.

OUTPUT: