2009年2月8日星期日

ABAP第二步:建立、维护数据表



top-down: proceeding by breaking large general aspects (as of a problem) into smaller more detailed constituents : working from the general to the specific
bottom-up: progressing upward from the lowest levels (as of a stratified organization or system)

A Data Model have three basic components: Entities, Attributes, Entity Types.

Entity: An entity is a uniquely identifiable object for which information is to be collected.

Attribute: An attribute is a characteristic of an entity.
Entity Type: An entity type is a set of entities with common attributes.

Primary Key: A primary key is that attribute or combination of attributes that uniquely identifies an entity of a particular type. A customer ID number might serve as the primary key of the customers entity type.

Relationships between entities can be classified in several ways:
Cardinality: the cardinality of a relationship describes the number of entities of one type that relate to entities of other types.

Optionality: The optionality of a relationship describes whether or not entities of one type must refer to entities of another type.

Category: A relationship’s category provides information about whether one entity is identified by its relationship to another entity


ABAP第二步:建立、维护数据表

主要ABAP相关技术

简称        描述             备注
Internal Table   内表处理
CATT       计算机辅助测试工具      SCAT
BDC        批量数据处理程序       SHDB等
List        数据列表,报表输出使用
Selection     数据选择
Screen       屏幕设计           SE51
Menu       菜单绘制器          SE41
Form       单据打印           SE71
SmartForms   单据打印           SmartForms
Query       简单查询           SQ01
BAPI       API接口           BAPI
ALV        SAP List Viewer
ALV Tree     ALV分类汇总
Table Control   Screen相关
Excel处理     读入和存出
UserExit      用户出口          CMOD,SMOD
Tree Control    Tree 控件  
数据字典     数据字典           SE11
逻辑库       逻辑库           SE36
权限        用户权限管理(BASIS)   PFCG
测试跟踪      SQL跟踪          ST05
授权        授权及权限检测       SU21、SU20
LSMW       数据导入工具       LSMW


常用T-Code及描述
TCODE    描述             备注
ABAPDOCU  ABAP文档和范例
BAPI     BAPI浏览器
CMOD/SMOD 系统增加
LSMW     数据导入工具          数据导入
PFCG     权限管理
SA38     程序执行
SCAT     计算机辅助测试工具,测试,数据导入等 数据导入
SCC1     集团拷贝
SCC4     显示集团
SE09     运输组织者,查询传输请求
SE11     数据字典
SE16     数据浏览器
SE32     文本元素设定
SE36     逻辑数据器
SE37     函数据模块
SE38     ABAP编辑器
SE41     菜单制作器
SE51     屏幕制作器
SE55     生成表维护程序
SE71     Form设计            单据打印
SE78     Form、SmartForms使用图片上载
SE80     对象浏览器
SE90     对象浏览器
SE91     消息设定
SE93     维护事务代码
SHDB     批输入代码           数据导入
SM04     显示在线用户
SM30     维护表视图
SM35     进程监控
SM50     超时用户
SMARTFORMS  SmartForms设计        单据打印
SNUM     编号对象维护
SO10     标准文本,设定Form使用的TIFF图片等
SPAD     假脱机管理
SQ01     Query查询制作
ST05     SQL跟踪
SU20     授权字段              授权
SU21     授权对象              授权
WE21     IDOC处理中的端口         IDOC


Internal Table:
ABAP/4中的Internal Table是一种Data Structure,类似于其它语言中的STRUTURE,它可以由几个不同类型的字段(field)组成,用来表示具有不同属性的某一事物,单独一笔数据表示某个事物,多笔数据表示具有相同属性的多个事物.例如:
为了存取或记录某班的同学资料,我们创建如下的internal table:

DATA: BEGIN OF STUDENT OCCURS 20,
STD_ID TYPE N,
NAME(10) TYPE C,
AGE TYPE I,
BIRTH TYPE D,
SCORE TYPE P DECIMALS 2,
END OF STUDENT.

此时我们已经创建了名叫STUDENT的internal table,并且为它预先申请了能够存放20笔资料的Buffer(当然,如果存取资料不止20笔,程序执行时,会自动申请系统Buffer)
Internal table 的定义有以下几种格式:

格式一. DATA: BEGIN OF OCCURS ,
TYPE ,
[ TYPE ,
TYPE ,
… ]
END OF .

格式二. TYPES: BEGIN OF ,
TYPE ,
[ TYPE ,
TYPE ,
… ]
END OF .
TYPES TYPE OCCURS .

格式三. DATA: BEGIN OF .
INCLUDE STRUCTURE .
DATA: END OF .
DATA: LIKE OCCURS .

SE11: Create new Table “YTCITY”



Delivery and Maintenance” Tab:

Delivery Class: we can choose ”A” as Application Table, or we can select other delivery class as well.

Data Browser/ Table View Maint: we choose “Display/Maintenance Allowed”, so we can edit the Database Table later without restrictions.




Fields” Tab:


Select “Predefined Type” to define Data Type and Length



Input data required


Click the “Technical Settings”, after input the Data Class and Size Category, click the green arrow to return the last page, save and active the database table.



Maintain database dictionary: SE16


Press “Enter”, then the Selection Screen appears.



F8 execute,


Drill down to see the separate record



Batch Maintain datas


Find Screen Number, and let the system Propose Screen Numbers




Click the “Create” button



Choose “Local Object”, then “Request completed without errors” appears at the state bar.



SM30 Maintain the datas


Choose “Maintain” button

没有评论:

发表评论