Skip to Content
Author's profile photo Ashish Trivedi

Creating Type Group and Using it in ABAP Program

Introduction: This document explains the very basic topic of creating the type group and its use in ABAP program.

What is type group: There are several type groups available in SAP. For example ‘ABAP’ and ’SLIS’ etc. To use them in program we use key word ‘TYPE-POOLS’. It allows us to define non-predefined types. Combination of all such non-predefined types is knows as type-pool or type-group. In simple terms, if we want to use some custom types in various programs then we need not define them separately, we can simply create a type group in ABAP dictionary and use that in our programs.

Steps to create:

i)              Go to transaction SE11; select the radio button ‘Type Group’. Click ‘Create’ button.

            /wp-content/uploads/2012/10/1_147659.png

         Note: – Maximum length of type-group name can be ‘5’.

ii)             Provide some meaningful description in short text

/wp-content/uploads/2012/10/2_147660.png

And click on save button.

iii)            Then next screen appears where we can write our source code as highlighted in the below screenshot. As an example, I have created two constants. One thing that needs to be taken care of while declaring the structures, constants, etc. in Type Group is that every object must start with ‘<name of type group>_’. In this example the constants that are declared starts with ‘ZATYP_’. The system gives syntax error in case the above naming convention is not followed.

/wp-content/uploads/2012/10/3_147661.png

iv)            Now save /wp-content/uploads/2012/10/4_147662.png and activate/wp-content/uploads/2012/10/5_147663.png    the type group.

v)             Now we can use the type group created above in our SAP programs. Please find below the screenshot for the same

/wp-content/uploads/2012/10/6_147664.png

Output will be following:

    /wp-content/uploads/2012/10/7_147665.png

Summary: In this way we can create type group and use it in ABAP programs.

Assigned Tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Hendrik Brandes
      Hendrik Brandes

      Hello Ashish,

      thank you for sharing this. However, I would prefer using ABAP OO-Interfaces as type-pool replacement which can deliver also types and constants. When using such an interface, you will gain a lot more control over your types and constants, because 1) the compiler likes them more;-) and 2) you can change them much more independent as it will be in type-pools.

      When defining huge type-pools, you will have a lock problem, when changes of a type-pool are transported separately from your development.

      Kind regards,

      Hendrik

      Author's profile photo Ashish Trivedi
      Ashish Trivedi
      Blog Post Author

      Hi Hendrik,

      Thanks for ur valuable comment. Actually i posted this document to describe type-pool for beginners, who want to just check what is type-pool and how to create that.

      Regards,

      Ashish

      Author's profile photo Hendrik Brandes
      Hendrik Brandes

      Hello Ashish,

      you have well done. In the past, I have been faced more than once with this "huge-type-pool" problem. Out of the historical-view the ID-limitation to 5 characters is now a problem, because implementation-projects are often restricted through naming-conventions and so they have at least.

      I just would suggest, to look forward to a solution, which enables every modern implementation to use an equal OO-pattern.

      Kind regards,

      Hendrik

      Author's profile photo Ashish Trivedi
      Ashish Trivedi
      Blog Post Author

      Hi Hendrik,

      Sure I will search a better solution. Thanks for your valuable suggestion 🙂

      Author's profile photo Former Member
      Former Member

      Good Work Ashish.. Really helpful. Keep it up 🙂

      Author's profile photo Ashish Trivedi
      Ashish Trivedi
      Blog Post Author

      Hi Chirag,

      Thank you 🙂

      Regards,

      Ashish