Data Element - Data Element defines the data type, structure component, field labels, search help, search help etc. There are two types in which
data element is describe - 1. Elementary Type, and 2. Reference Type.
Elementary type is define by the built-in data type, field length and decimal places. Whereas Reference type defines the type of reference variable in
Data Element is used for defining -
1. Data Type
2. Field Label
3. Search Help
4. Parameter ID
5. Change document flag
6. Further Characteristics
Important Notes -
You cannot use domain to define parameter or select-options or variable or even you can't define the type
from the domain. For example, MENG13 is a domain, and you can't define this -
TYPES: p9 TYPE MENG13. [It will throw error]
You can define variable either using data element or you can use table or structure component. Like EDIDD is an structure, from this you
can define both variable and define the TYPES as well.
TYPES: p10 TYPE edidd-docnum. [This will work perfectly]
- Using type and like both will give you F4 and F1 help (Checked in ECC 6.0), for example -
PARAMETERS: p4 TYPE VBAK-FKARA. [FKARA is a field and data element name]
PARAMETERS: p5 LIKE VBAK-FKARA.
Select-options: p6 FOR VBAK-VBELN. [VBELN is a field and data element name]
PARAMETERS: p7 TYPE WERKS_D. [WERKS_D is a data element and have a search help H_T001W_C attach]
PARAMETERS: p8 LIKE MARC-WERKS. [WERKS is a field and a name of domain and not data element]
PARAMETERS: p13 TYPE MARC-WERKS. [This will give you both F1 and F4 help, since search help - H_T001W is attach to table MARC]
All these above will give you F4 and F1 help.
Note - WERKS_D is not a structure but a data element and domain. You can't use statement -
PARAMETERS: p19 LIKE WERKS_D.
This will throw an error. Even writing below statement for data declaration it will give you the same error -
DATA: p19 LIKE WERKS_D.
But you can use the below statement without any error -
DATA: p19 LIKE marc-WERKS.
DATA: p20 LIKE WERKS. [Note - WERKS is not data element but a structure and domain]
DATA: p21 TYPE WERKS.
Or can use MATNR with TYPE without any error, for example -
DATA: p22 TYPE matnr. [Note - MATNR is a domain and data element]
Also you can use - TYPES: p19 TYPE matnr. [Without any error]
But you can't use the below statement -
DATA: p23 LIKE matnr. [This gives you an error]
Difference between TYPE and LIKE is that you cannot reference an internal tables, strings, references, or structures as component
using LIKE statement but you can refrence this with TYPE statement.