2.2.3 |
CONSTANTS |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
例如声明一些OK_CODE, SIGN ‘I’,’E’ OPTION ‘EQ’,’BT’等 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
如值相同,但表示不同意思时,最好使用两个常量 |
|
|
|
|
|
|
|
例:CONSTANTS:CNS_BUKRS_XXX TYPE BKPF-BUKRS VALUE ‘1000’,(凭证表头中的公司代码) |
|
|
|
CNS_KOKRS_XXX TYPE CSKS-KOKRS VALUE ‘1000’.(成本中心中的管理领域) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2.2.4 |
RANGES |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DATA : |
|
|
|
|
|
|
|
|
|
|
|
RD_MARA TYPE RANGE OF MARA-MATNR, |
|
|
|
|
|
|
|
|
RH_MARA LIKE LINE OF RD_MARA. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2.2.5 |
内表的定义 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<TYPES定义>…① |
|
|
|
|
|
|
|
|
|
|
TYPES: |
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN OF TYP_MARC, |
|
|
|
|
|
|
|
|
|
|
MATNR TYPE MARC-MATNR, |
|
|
|
|
|
|
|
|
|
WERKS TYPE MARC-WERKS, |
|
|
|
|
|
|
|
|
END OF TYP_MARC. |
|
|
|
|
|
|
|
|
TYPES: |
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN OF TYP_MARA, |
|
|
|
|
|
|
|
|
|
|
MATNR TYPE MATNR, |
|
|
|
|
|
|
|
|
|
WERKS TYPE WERKS_D, |
|
|
|
|
|
|
|
|
END OF TYP_MARA. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<DATA定义>…② |
|
|
|
|
|
|
|
|
|
|
|
TYPES定后使用DATA声明内表及工作区 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DATA: |
|
|
|
|
|
|
|
|
|
|
|
|
TH_MARA TYPE TYP_MARA, |
|
|
|
|
|
|
|
|
|
TD_MARA TYPE STANDARD TABLE OF TYP_MARA. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2.2.6 |
类型 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
如果是自定义的类型使用TYPE关键字,如果是现有的类型使用LIKE关键字 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
数值类型,使用的时候一定不要加”以便跟文本类型区分开 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
例) |
DATA : CTR_OBJECT TYPE I. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DESCRIBE TABLE TD_OBJECT LINES CTR_OBJECT |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IF CTR_OBJECT >= 10000 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ENDIF. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
日期类型,判定空值的时候使用IS INITIAL,而不是使用’00000000′ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
例) |
DATA : WK_STARTDAY TYPE SY-DATUM. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IF WK_STARTDAY IS INITIAL. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ENDIF. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CLEAR WK_STARTDAY. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|