当前位置:网站首页>SAP ABAP data types and data objects

SAP ABAP data types and data objects

2022-06-11 08:54:00 Boating in rainy days

Data type and data object

stay abap In the sentence , Before using variables , Variables must be declared . During the declaration process , The following concepts will be involved :

1. data type

1.1.1. Data types describe the technical attributes of data objects ( Type and length ), User defined data objects 

1.1.2. Itself cannot be directly referenced or assigned 

1.1.3. data elements (data element ): The user defines a variable of field type 

1.1.4. Structure (structre) :  The user defines a structure variable in memory 

1.1.5. Internal table type (table type):  Used to define an internal table in memory 

1.2 Where data types are used

1.2.1. Define screen fields 

1.2.2. Define data objects in memory 

1.2.3. Define subroutine (subroutine) Parameters of 

1.2.4. Define the parameters of class methods in object-oriented 

1.2.5. Definition function module Parameters in 

1.3 Data type classification

1.3.1. Global type data element : structure,table type

1.3.2. Standard type 

1.3.3. Local type :data type,structure type,tabletype

1.3.4. Type creation basic syntax :

 grammar :
TYPE obj2 [TYPE type1 | LIKE obj1]
 Example :
TYPE gty_char TYPE C LENGTH 10 . " Definition char The type length is 10  The type of 

1.4. Variable

Declaration method 1: Reference data type

 example :
DATA GV_DATA TYPE DATA_TYPE.

Classification of data types :

  1. Global type (se11) -data element , Str ,tty
  2. Standard type (C,N,D,T,F,I,P,STRING…)
  3. Local type ( In the program types)

Declaration method 2: Parameters are based on data objects

 example :
DATA GV_DATA2 LIKE GV_DATA1.

1.5. structure

Local struct type declaration

example :

TYPES BEGIN OF STR_TYPE
TYPES F1 ....
TYPES F2 ....
.............
TYPES END OF STR_TYPE.

DATA GS_STR TYPE STR_TYPE.

1.6. Internal table

Table type declaration :

TYPES TABLE_TYPE TYPR TABLE OF LINE_TUPE

Internal table :

DATA  GT_ITAB TYPE TABLE_TYPE.

DATA GT_ITAB2 TYPE TABLE OF STR_TYPE .
* suffix :
WITH HEADER LIKE " With header row 
INITIAL SIZE N " Initialization size 
OCCURS  " Initialization size 

2. Data objects

2.1. Data objects ( Text , Variable , Constant )

2.2.data The variable or entity structure that the keyword is used to declare has actual memory space .

3. System standard parameters

System defined data objects do not need to be declared , It can be used directly in the program (syst) In structure

  1. SY-SUBRC: Return code value ( 0 Represents successful operation )
  2. SY-UNAME: Current user name
  3. SY-TCODE Current transaction code
  4. SY-DATUM The current date
  5. SY-UZEIT current time
  6. SY-REPID Current program name
原网站

版权声明
本文为[Boating in rainy days]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206110838489940.html