2007 Oct 13 6:19 PM
please tell me the difference between this two.
TYPES: begin of itab,
matnr type mara-matnr,
mtart type mara-mtart,
end of itab.
DATA : begin of itab,
matnr type mara-matnr,
mtart type mara-mtart,
end of itab.
When to use which one.Which is the best one .
and also please tell me the difference between
matnr like mara-matnr
matnr type mara-matnr.
Thanks for all the replies
please tell me the difference between this two.
TYPES: begin of itab,
matnr type mara-matnr,
mtart type mara-mtart,
end of itab.
DATA : begin of itab,
matnr type mara-matnr,
mtart type mara-mtart,
end of itab.
When to use which one.Which is the best one .
and also please tell me the difference between
matnr like mara-matnr
matnr type mara-matnr.
Thanks for all the replies
2007 Oct 13 6:24 PM
Hi Madan,
The first one is a define type which you can use to define the work-area and internal table.
The second is direct defination of workarea.
The first one should be use as it is more recommended and suitable for ABAP OO.
To find the diffeence between TYPE and LIKE just search forum using "TYPE vs LIKE" there are lots of threads for this.
Regards,
Atish
2007 Oct 13 6:32 PM
There are two types of declaring internal talbe.
1)DATA : begin of itab occurs 0,
matnr type mara-matnr,
mtart type mara-mtart,
end of itab.
But this is obsolte.
2) TYPES: begin of wa,
matnr type mara-matnr,
mtart type mara-mtart,
end of wa.
data:itab type standard table of wa with header line.
The 2nd method is recommended.
Generally use like while referring to the dictionary field.Use type while referring the data type of field.
for example
matnr like mara-matnr
now if you see field matnr in table mara , its data elemnt is matnr.
now comes the use of <b>type</b>.
data:matnr type matnr.
2007 Oct 13 9:03 PM
Hi madan,
TYPES will just give a description of a data object. Something like a blueprint. No variable defined at this time.
You can give description for any kind of complexity. This type definition can be used to declare real variables or to give the type of a parameter used in FORM or METHOD.
It is necessary to have TYPES defined if you want to pass internal tables as USING or CHANGING parameters. If you do not use such a type you can't loop or read the table in the FORM or METHOD.
Regards,
Clemens
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |