2.Program structure
2.1ABAP程序类型
1. Executable program,可执行程序,使用SUBMIT,dynpro,使用Tcode执行selection screen,不能再Function Module中使用;
2. Class pool,类,使用Call,只能在Method中使用;
3. Function group or function pool,使用CALL FUNCTION执行;
4. Interface pool,接口;
5. Module pool,使用Tcode执行的dynpro;
6. Subroutine pool,子程序;
7. Type group or type pool,数据类型;
程序类型声明
1. REPORT;
2.PROGRAM;
3.FUNCTION POOL;
4.CLASS POOL;
5.INTERFACE POOL;
6. TYPE POOL;
示例1:
"function pool
FORM f_program_type_function.
"Function Group
"Function Pool命名规则
"LXXXTOP,定义数据
"LXXXDxx,定义本地class
"LXXXUxx,function module实现;
"LXXXPxx,本地class,method实现;
"LXXXOxx,PBOmodule;
"LXXXIxx,PAImodule;
"LXXXExx,Event block;
"LXXXFxx,子程序subroutine;
* Function group SAPLABAP_DOCU is structured from include programs.
*
* *&---------------------------------------------------------------------*
**& Function Group SAPLABAP_DOCU
**&---------------------------------------------------------------------*
*
*INCLUDE labap_docutop. " Global Declarations
*
*INCLUDE labap_docue00. " Load of Program
*
*INCLUDE labap_docuuxx. " Function Modules
*
*INCLUDE labap_docuo01. " PBO Modules
*
*INCLUDE labap_docui01. " PAI Modules
*
*INCLUDE labap_docue01. " Handling of Runtime-Events</
*
*INCLUDE labap_docup01. " Class implementations
*INCLUDE labap_docup02.
*INCLUDE labap_docup03.
*INCLUDE labap_docup04.
*
*The function group includes the top include in the first place; it contains the FUNCTION-POOL statement and other include programs for data and class declarations:
*
* *&---------------------------------------------------------------------*
**& Include LABAP_DOCUTOP
**&---------------------------------------------------------------------*
*
*FUNCTION-POOL abap_docu.
*
*INCLUDE labap_docud00. " Global Data for Screens
*
*INCLUDE labap_docud01. " Classes for Docu Display
ENDFORM.
示例2:
"程序类型
FORM f_program_type_report.
"Report程序
"语法:
* REPORT rep [list_options]
* [MESSAGE-ID mid]
* [DEFINING DATABASE ldb]
* [REDUCED FUNCTIONALITY].
"[list_options]
"[NO STANDARD PAGE HEADING],系统变量:sy-wtitl = 'N';
"[LINE-SIZE width],系统变量:sy-linsz,最大值1023,默认为0;
"[LINE-COUNT page_lines[(footer_lines)]],系统变量:sy-linct,0~60000;
"示例:REPORT z_report LINE-COUNT 65(8) LINE-SIZE 132.
"DEFINING DATABASE ldb
"定义逻辑数据库
"MESSAGE-ID mid
"message id,指定程序使用message,message class表:T100
"REDUCED FUNCTIONALITY ,只用于subroutine pools,应用于PROGRAM
"Program程序
"语法:
* PROGRAM prog [list_options]
* [MESSAGE-ID mid]
* [REDUCED FUNCTIONALITY].
"[list_options]忽略,[REDUCED FUNCTIONALITY]只在subroutine pools有效
ENDFORM.
示例3:
"语法:
"CLASS-POOL [MESSAGE-ID id].
"语法:
"INTERFACE-POOL.
示例4:
"语法:
"TYPE-POOL tpool.