ABAP代码编写要求

1、单元格式
************************************************************************
* Copyright 2006 C-Bons Wuhan                                          *
* All Rights Reserved                                                  *
*----------------------------------------------------------------------*
* Program Name : ZXXXXX                                                *
* Project      : C-Bons SAP Implementation Project                     *
* Program Title:                                                       *
* Created by   : DEVXX                                                 *
* Created on   : 2006/02/18                                            *
* Version      : 1.0                                                   *
* Function Description:                                                *
*                                                                      *
*----------------------------------------------------------------------*
* Data Table List:                                                    *
*如维护操作的表,数据计算来源等表
*----------------------------------------------------------------------*
* Refrence Table List:                                                 *
*如联络处描叙,输入帮助等用到的表
*----------------------------------------------------------------------*
* Modification Log:                                                    *
************************************************************************
* Date        Programmer     Correction Number      DesingDoc Number   *
* YYYY/MM/DD  XXXXXXXX       DEVK9nnnnnn                               *
************************************************************************
注意:版本修改信息中设计文档版本有对应的文档则必须填写。

单元命名规则
对于复杂的程序,可以将其编写为多个INCLUDE,不同作用的代码放在不同的INCLUDE中,各个INCLUDE的名称按下表编写
 
代码的作用 单元名称   
Events(TOP-OF-PAGE等) ZXXXXE01   
Subroutines(Form routines) ZXXXXF01   
PAI Modules ZXXXXI01   
PBO Modules ZXXXXO01   
Global Data ZXXXXTOP   
Input Help ZXXXXH01 
其中:ZXXXX为程序名。

事件代码必须遵循编写顺序
Initialization

At Selection-Screen OutPut

At Selection-Screen

START-OF-Selection

At Select-Screen on XXXX

At Select-Screen on value request for XXXXX

At Select-Screen on help request for XXXXX

共用函数的格式
************************************************************************
* Function Name : XXXXX                                                    *
* Created by   : DEVXX                                                 *
* Created on   : 2006/02/18                                            *
* Function Description:                                                *
*                                                                      *
*----------------------------------------------------------------------*
*参数说明                   *
*                                                                      *
*----------------------------------------------------------------------*
* Modification Log:                                                    *
************************************************************************
* Date        Programmer   Description           *
* YYYY/MM/DD  XXXXXXXX                                                 *

子函数的格式
************************************************************************
* Form Name : XXXXX                                                    *
* Created by   : DEVXX                                                 *
* Created on   : 2006/02/18                                            *
* Form Description:                                                *
*                                                                      *
*----------------------------------------------------------------------*
*参数说明                   *
*                                                                      *
*----------------------------------------------------------------------*
* Modification Log:                                                    *
************************************************************************
* Date        Programmer   Description           *
* YYYY/MM/DD  XXXXXXXX                                                 *
************************************************************************
(注:标为蓝色部分可以省略)

变量命名规则
Type Name:T_
Internal tables (global): gt_
Internal Tables (Local):it
工作区(structure): wa_
全局变量: g_
局部变量: l_
Ranges = r_
Selection screen parameter: p_
select-options : s_
函数参数命名规则:
IMPORTING parameters   IM_<parameter name>
EXPORTING parameters  EX_<parameter name>
CHANGING parameters   CH_<parameter name>
返回参数      RE_<result>

变量定义顺序
************************************************************************
*DATA     DECLARATION                                             *
************************************************************************
*----------------------------------------------------------------------*
* CONSTANTS                                  *
*----------------------------------------------------------------------*
CONSTANTS:
      C_TOTAL(8)  TYPE C       VALUE 'WA_TOTAL'.

*----------------------------------------------------------------------*
*TABLES                                        *
*----------------------------------------------------------------------*
TABLES: AFKO,     "Order header data PP orders
        AFPO,     "Order item
        JEST,     "Object status
        RESB,     "Reservation/Dependent Requirements
        AUFK,     "Order master data
        MAKT,     "Material Descriptions
        TJ02T.    "System status texts

*----------------------------------------------------------------------*
* TYPES OR TYPE-POOLS                        *
*----------------------------------------------------------------------*
TYPES: BEGIN OF T_AUFK,
         AUFNR   LIKE AUFK-AUFNR,  "Order number
         AUART   LIKE AUFK-AUART,  "Order type
         LOEKZ   LIKE AUFK-LOEKZ,  "Deletion flag
         OBJNR   LIKE AUFK-OBJNR,  "Object number
       END OF T_AUFK.

*----------------------------------------------------------------------*
* INTERNAL TABLES AND WORK AREAS          *
*----------------------------------------------------------------------*
DATA: I_AUFK    TYPE T_AUFK    OCCURS 0,
      WA_AUFK   TYPE T_AUFK.

*----------------------------------------------------------------------*
* GLOBAL VARIABLES                           *
*----------------------------------------------------------------------*
DATA: G_FLAG.

屏幕编号规则
选择屏幕编号范围:1000-1999
录入屏幕编号范围:1-999
子屏幕编号范围:3000-4999

注释规则
1) 任何全局变量要简单解释作用或使用地方
2) 任何函数超过30行的函数或form必须在关键位置加注释,3) 解释操作意图
4) 

消息提示使用规则
5) 消息请使用ZDEV的标6) 准的消息文本;
7) 如果标8) 准消息文本中没有的请找熊红梅增加,9) 自己不10) 得维护;

注释里的创建日期和修改日期必须认证填写为实际日期
Status命名规则为:Menu+屏幕号,共用的为Menu+Main