Creating Type Group in SAP ABAP

Type Group :
Type group is used to declare different type declarations under a single group in data dictionary.
This enables us to globally declare a custom type and use it in multiple programs using TYPE-POOLS statement.


How to create Type Group in SAP ABAP

In addition to Types,Constants can also be created in it.
Some of the commonly used SAP standard type groups are SLIS, ABAP etc.
We can also create our custom type groups.
The restriction for creating the types/constants in it is all the type names and constant names should begin with the type group name.
        Example ; for SLIS type group...the namming convention is SLIS_<type/constant name>.

Steps to create Type Group:


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

 
Creating Type Group in SAP ABAP

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

Provide some meaningful description in short text
Creating Type Group in SAP ABAP



And click on save button and save it as a local object.
Creating Type Group in SAP ABAP

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 ‘ZTGR_’. The system gives syntax error in case the above naming convention is not followed.
Creating Type Group in SAP ABAP



Now save   and activate     the type group.
Creating Type Group in SAP ABAP

Now we can use the type group created above in our SAP programs. Please find below the screenshot for the same
Creating Type Group in SAP ABAP



Output will be following:


Creating Type Group in SAP ABAP

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

Popular posts from this blog

How to create Interactive Report in SAP ABAP

How to create ALV Interactive Report in SAP ABAP

BDC Call Transaction Method Program