Skip to Content
author's profile photo Former Member
Former Member

TYPE POOLS

Hi,

What is meant by TYPE POOLS? what is the use of it???

Thanks in advance.

Sharin.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 06, 2008 at 11:59 AM

    Hi,

    Type Groups

    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:

    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 these definition by including a TYPE-POOLS statement:

    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.

    TYPE-POOLS: statement is used to INCLUDE the TYPE group in your program.

    SO that you can use the TYPES and CONSTANTS that are defined in this type group in your program.

    SLIS is the type group for the ALV types and contants.

    TYPE GROUP is an option to create TYPES and CONSTANTS that are logically related to one other under one POOL.

    Double click on SLIS and see.

    Goto SE11-> Select the radio button Type group and there enter SLIS.

    IF you dont see the Radio button Type group in Se11 use

    Utilities->Other Dictionary objects and there selet Type group.

    Type pool is a collection of pre defined data types..

    Frequently used data types in programming are clubbed into a type pool so that if u write in ur code:

    TYPE-POOLS: slis.

    the declarations in SLIS will apply to ur code also..

    SLIS contains data definitions for ALV structures & internal tables. so that u dont need to declare alv data everytime in ur program..

    check out type pools: ICON, etc.. In SE11, type groups..

    We can use ABAP ALV LIST and GRID function modules to display Normal LIST and Hiearchical LISTS .

    All the definitions TYPES and STRUCTURES and CONSTANTS are defined

    in the TYPE-POOL 'SLIS' ,so it should be declared first.

    TYPE-POOLS : 'SLIS' .

    To display ALV LISTS the function module used are :

    REUSE_ALV_LIST_DISPLAY "For Normal LIST

    REUSE_ALV_HIERARCHICAL_LIST_DISPLAY "For Hierarchical LIST

    To display ALV GRID the function module used are :

    REUSE_ALV_GRID_DISPLAY . "For GRID display

    The most important component of the ALV is the FIELDCATALOG which is of

    TYPE SLIS_T_FIEDLCAT_ALV

    or of

    TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV .

    The line items of the field catalog are of

    TYPE SLIS_FIELDCAT_ALV .

    FIELDCATALOG

    To prepare field catalog certain fields are essential .There are various other fields allowing for vaarious possibilities and display options.

    TABNAME

    FIELDNAME

    REF_TABNAME

    SELTECT_M

    e.g.

    DATA: WS_FCAT TYPE SLIS_FIELDCAT_ALV . "LINE ITEM OF FCAT

    DATA: IN_FCAT TYPE SLIS_T_FIELDCAT_ALV.

    WS_FCAT-TABNAME = 'MARA'.

    WS_FCAT-FIELDNAME = 'MATNR'.

    WS_FCAT-SELTEXT_M = 'Material Number'.

    APPEND WS_FCAT TO IN_FCAT .

    CLEAR WS_FCAT.

    WS_FCAT-TABNAME = 'MAKT'.

    WS_FCAT-FIELDNAME = 'MAKTX'.

    WS_FCAT-SELTEXT_M = 'Material Description'.

    APPEND WS_FCAT TO IN_FCAT .

    This will create fieldcatalog with two columns for displaying material and material description .

    RESUSE_ALV_LIST_DISPLAY.

    The following FM is used to display the data in the internal table in the form of ALV

    LIST. The Event table is only required if event handling is being done.

    CALL FUNCTION 'RESUSE_ALV_LIST_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = W_REPID "of TYPE SY-REPID and

    " value SY-REPID

    IS_LAYOUT = W_LAYOUT "of TYPE SLIS_LAYOUT_ALV

    IT_FIELDCAT = IN_FCAT "of TYPE SLIS_T_FIELDCAT_ALV

    I_SAVE = W_SAVE "of TYPE C ,values A ,U ,' '

    IT_EVENTS = IN_EVENTS " of TYPE SLIS_T_EVENT

    TABLES

    T_OUTTAB = IN_DATA "internal table conatining data

    "corresponding to IN_FCAT

    EXCEPTIONS

    PROGRAM_ERROR = 1

    OTHERS = 2

    IF SY-SUBRC NE 0.

    MESSAGE ENNN .

    ENDIF.

    REUSE_ALV_EVENTS_GET.

    This FM is used to get the default event table of the ALV LIST DISPLAY.

    The IN_EVENTS internal table is of TYPE SLIS_T_EVENT. This table contains

    all the events wrapped up in the ALV LIST or ALV GRID and consistsof two fields

    NAME and FORM .The NAME corresponds to names of the events like TOP_OF_PAGE and END_OF_PAGE ,USER_COMMAND and FORM will contain the name of the FORM ROUTINE that will be called dynamically through callback mechanism when the particular event will fire and is initial for all events bt default and has to be filled for

    events for which handling is required.

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    I_LIST_TYPE = 0

    IMPORTING

    ET_EVENTS = IN_EVENTS[].

    e.g.

    DATA: W_EVENT TYPE SLSI_ALV_EVENT "LINE ITEM OF EVENT TABLE

    DATA: IN_EVENTS TYPE SLSI_T_EVENT . "Internal table containing events

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    I_LIST_TYPE = 0

    IMPORTING

    ET_EVENTS = IN_EVENTS[].

    RTEAD TABLE IN_EVENTS WITH KEY NAME = 'TOP_OG_PAGE'

    INTO W_EVENT.

    IF SY-SUBRC EQ 0.

    MOVE 'F3000_TOP_OF_PAGE' TO W_EVENT -FORM.

    MODIFY IN_EVENTS FROM W_EVENT INDEX SY-TABIX.

    ENDIF.

    Here the FORM ROUTINE 'F3000_TOP_OF_PAGE' is being set up for the

    event TOP_OF_PAGE which will fire when the ALV LIST will be displayed ,This form

    will be called dynamically by th ALV LIST display during top_of_page event and for this the modified Events internal table has to be passed to the FM 'REUSE_ALV_LIST_DISPLAY' in the exporting parameter IT_EVENTS. Failing this the form '3000_TOP_OF_PAGE' will not be called . This event is used for placing heading information like Current date and time and the name of the report.

    For Sample programs..

    Check this link.

    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid.htm

    Regards,

    SHiva KUmar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 06, 2008 at 12:02 PM

    TYPE-POOLS

    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.

    reward if useful

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 06, 2008 at 12:04 PM

    hi check this..

    what is the purpose of the type-pools and

    regards,

    venkat

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 06, 2008 at 11:58 AM

    hi,

    TYPE-POOL

    Basic form

    TYPE-POOL tpool.

    Effect

    The TYPE-POOL statement introduces a table group.

    You can only maintain type groups in the ABAP Dictionary (Transaction SE11). The name tpool must correspond to the name in the ABAP Dictionary. You may only define types and constants in a type group. The name of each type and constant must begin with the name of the type group followed by an underscore. You declare the types and constants of a type group using the TYPE-POOLS statement.

    Example

    TYPE-POOL ABCDE.

    TYPES: ABCDE_PACKED TYPE P,

    ABCDE_INT TYPE I.

    reward if hlpful.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 06, 2008 at 12:17 PM

    Thank u every one for helping me...........

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.