Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to use type group

Former Member
0 Kudos

Hi experts,

I Searched the forum for this Issue. But I can't get the answer.

what is the use of type group and how we use it in our program?

1 ACCEPTED SOLUTION

varma_narayana
Active Contributor
0 Kudos

Hii Naresh..

Type-group or Type pool is a collection of Data types and Constants which can be called globally from any program.

It is created in SE11 .

For eg: Type groups delivered by SAP - ABAP,SLIS...

To call a type group in a program

TYPE-POOLS abap.

DATA : V_TEST TYPE ABAP_TRUE. "it is a constant that stores 'X'.

<b>Reward if Helpful</b>

6 REPLIES 6

Former Member
0 Kudos

Hi

Please ignore my previous post.

Type-group is used to declare the different data declarations under single type group. if we want create our own type group go for se11 and create the type group.Please find the given below example for your reference.

type-pools ztvv1.

data : emp type ztvv1_stru,

ded type ztvv1_ded.

data tsal type p decimals 2.

move '123' to emp-no.

move 'RAGHU' to emp-name.

move '9234.55' to emp-sal.

move '1123' to ded-hra.

move '1000' to ded-ta.

move '600' to ded-pf.

tsal = emp-sal + ded-hra + ded-ta - ded-pf + ztvv1_sa-bonus.

write :/10 'EMPLOYEE INFORMATION' color 6 inverse on.

uline.

write :/30 'EMPNO',18 emp-no.

write :/30 'EMPNAME',18 emp-name.

write :/30 'EMPNETSAL', tsal.

Reward points!!

Thanks & Regards,

Vasudeva Rao.

varma_narayana
Active Contributor
0 Kudos

Hii Naresh..

Type-group or Type pool is a collection of Data types and Constants which can be called globally from any program.

It is created in SE11 .

For eg: Type groups delivered by SAP - ABAP,SLIS...

To call a type group in a program

TYPE-POOLS abap.

DATA : V_TEST TYPE ABAP_TRUE. "it is a constant that stores 'X'.

<b>Reward if Helpful</b>

Former Member
0 Kudos

type group : ABAP program that cannot be started independently. Contains the definitions of globally visual data types and constants. Does not support any dynpros of its own.

Before Release 4.5A, it was not possible to define standalone types in the ABAP Dictionary to which you could refer using a TYPEaddition 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 that, you define data types using the statement TYPES. 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: pool_

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.

Note:

As of release 6.40, you can also define data types and constants in the public visibility area of global classes, by which type groups can be completely replaced.

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 this definition with the 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 DATAstatement and the value of the constant is, as the output shows, known in the program.

0 Kudos

Thanks for reply

Former Member
0 Kudos

<a href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3138358411d1829f0000e829fbfe/content.htm">refer this link for type group</a>

regards,

srinivas

<b>*reward for useful answers*</b>

Former Member
0 Kudos

Thanks