Application Development and Automation 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: 
Read only

difference between type groups and work area

Former Member
0 Likes
2,537

hi guyz,

i wanna know diff between type groups and work area.

Thanks,

5 REPLIES 5
Read only

Former Member
0 Likes
1,208

Hi,

Work Area is used to store one record at a time expicitly of an internal table.It will have the same structure as internal table

If u are refering type group as like

types:begin of ty-abc,

name type field-name,

name2 type field-name2,

end of ty-abc.

this declares a structure but does not hold memory space.For that u have to create a table of type ty-abc to hold all the records and then create a work area of type ty-abc to hold one record.

ie

data:it_tab like ty-abc occurs 0 with header line, " internal table

wa_tab like line of ty-abc. "work area

reward if helpful.

thanks

Read only

Former Member
0 Likes
1,208

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 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 Groups is like we declare data using TYPES statement instead of LIKE word

types: begin of tygp,

no type kunnr,

name type name1,

amnt type netwr,

end of tygp.

workarea:

While adding or retrieving records to / from internal table we have to keep the record temporarily.

The area where this record is kept is called as work area for the internal table. The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.

e.g.

data: begin of itab occurs 10,

ab type c,

cd type i,

end of itab. " this table will have the header line.

data: wa_itab like itab. " explicit work area for itab

data: itab1 like itab occurs 10. " table is without header line.

reward points if it helps.

rgds

Read only

varma_narayana
Active Contributor
0 Likes
1,208

Hi..

Type group (type Pool) is Created in DDIC (se11) to Store a group of Data types and Constants.

To use these data types in a Program we must call the Type group like this.

TYPE-POOLS : SLIS.

Where as Workarea is a Variable based on a Structured data type.

It can store a single row of data.

Eg: Data: WA_MARA type MARA.

<b>Reward if Helpful</b>

Read only

Former Member
0 Likes
1,208

why dont you just brows to sap.help.com ? all you want to know is there and WE are not a index search for that site.

Read only

Former Member
0 Likes
1,208

WORK area means the place to keep/Store a Single record .

When you declare a table using

TABLES: MARA

this will create a work area for MARA to hold/store a single record of mara

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.

example :

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 DATA statement and the value of the constant is, as the output shows, known in the program.

Regards