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

type key word

Former Member
0 Likes
1,264

what is types keyword used for?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,220

Hi,

It defines a new type within the program..

Ex..

TYPES: BEGIN OF type_material_plant,

MATNR type MATNR,

WERKS type werks_d,

END OF type_material_plant.

DATA: WA TYPE type_material_plant.

Thanks,

Naren

what is types keyword used for?

9 REPLIES 9
Read only

Former Member
0 Likes
1,221

Hi,

It defines a new type within the program..

Ex..

TYPES: BEGIN OF type_material_plant,

MATNR type MATNR,

WERKS type werks_d,

END OF type_material_plant.

DATA: WA TYPE type_material_plant.

Thanks,

Naren

Read only

Former Member
Read only

Former Member
0 Likes
1,220

Hi,

You can use the TYPE addition of an appropriate ABAP statement to refer to these data types in any ABAP program in the system.

In ABAP programs, you can use the TYPE addition with the data type of a database table or view. You may refer to the whole structure or to individual components:

... TYPE <dbtab> ...

refers to the complex data type of the structure,

... TYPE <dbtab>-<ci> ...

refers to the elementary data type of component <ci>.

If you define a complex data type <t> as a structure using

TYPES <t> TYPE <dbtab>.

the components of the data type <t> inherit the names of the components of the database table or view, and can be addressed in the program using <t>-<ci>.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
1,220

Hi Krishna,

If you use the key work types

it will create a structure for your

given fields.

For example.

Types : Begin of str,

Vbeln like anla-vbeln,

Bukrs like anla-bukrs,

end of str,

  • Now the above commands will

create a structure for the two fields

Data itab type table of str with header line.

  • This will create one internal table for your

structure with header line.

Actually when you doing some coding,

in that if u need to create an internal table

you should follow this way only.

Dont declare directly an internal table.

Hope u got.

Reward if it useful.

Read only

Former Member
0 Likes
1,220

hi krishna,

TYPES are used to define structures....it does include any memory area...

it defines an internal table without header line..

Define:

TYPES : begin of TY_ITAB,

field type DBtable-field,

End of ITAB.

this will define a structure. to define an internal table use the following command.

types : TT_ITAB type table of TY_ITAB.

this will define an internal table without header line...

so when you are defining an internal table with types always define the work area for that internal table...

hope this could solve ur problem...

Regards,

Prashant

Read only

Former Member
0 Likes
1,220

TYPES is used to declare a data type. Anything declared using this keyword will NOT have any memory allocated with it, just a data type will be declared. This datatype is then used to declare data objects using the keyword DATA.

Note that the use of TYPES is a must from ECC 6 onwards, to avoid EPC errors.

Reward if helpful

Regards

Read only

Former Member
0 Likes
1,220

Hai, Krishna latha.

The TYPES statement introduces user-defined data types .

As with standard data types, you can use them when creating data objects and when assigning types to formal parameters and field symbols. User-defined data types are an essential component of the ABAP/4 type concept .

Read only

Former Member
0 Likes
1,220

Hi

Type keyword is mainly used for grouping the different fields/variables which comes under single category like

Type : begin of itab_final,

matnr like mara-matnr,

werks like mara-werks,

end of itab_final.

if you type keyword the memory will not be allocated immeadiately instead it would be allocated during runtime.

REWARD IT PLEASE....!!!

Read only

Former Member
0 Likes
1,220

Hi,

TYPE means it is a predefined data type.

and refer the link

Regards,

Murali