楼主: karlyuan

问个语法的问题

[复制链接]
论坛徽章:
3
2017金鸡报晓
日期:2017-01-10 15:39:05
31#
发表于 2009-8-21 19:52 | 只看该作者
看来以后要换地方了,这里提个问题还要版主大人审批,他老人家满意了才能保留下来;而且割割版主都口味不同,让俺们都不知道怎么来伺候。

使用道具 举报

回复
论坛徽章:
2
2010新春纪念徽章
日期:2010-03-01 11:19:502010广州亚运会纪念徽章:垒球
日期:2010-09-23 10:20:02
32#
发表于 2009-8-21 22:22 | 只看该作者
就是啊
大家的水平是参次不齐的

使用道具 举报

回复
论坛徽章:
45
19周年集字徽章-庆
日期:2019-09-06 18:32:52秀才
日期:2015-11-23 09:57:36秀才
日期:2015-11-11 09:48:44天枰座
日期:2015-10-23 19:04:22秀才
日期:2015-10-19 15:49:55双子座
日期:2015-09-16 23:24:45知识
日期:2015-08-31 09:57:172015年新春福章
日期:2015-03-06 11:57:31暖羊羊
日期:2015-03-04 14:50:37秀才
日期:2015-11-23 10:17:19
33#
发表于 2009-8-22 10:32 | 只看该作者
先按F1,这没有什么错误呀。
没有F1可以按,因为是别人问起你的。
你不会教那个问你的人按F1?
为什么这个简单的学习方法你都不想教给别人?
维护你在他OR她 心中的大侠形象?

使用道具 举报

回复
论坛徽章:
8
生肖徽章2007版:龙
日期:2009-09-10 11:23:34ITPUB8周年纪念徽章
日期:2009-09-27 10:21:20祖国60周年纪念徽章
日期:2009-10-09 08:28:002010新春纪念徽章
日期:2010-01-04 08:33:082010新春纪念徽章
日期:2010-03-01 11:04:58ITPUB9周年纪念徽章
日期:2010-10-08 09:28:51ITPUB十周年纪念徽章
日期:2011-11-01 16:20:282012新春纪念徽章
日期:2012-01-04 11:49:54
34#
 楼主| 发表于 2009-8-22 14:10 | 只看该作者
原帖由 gma 于 2009-8-22 10:32 发表
先按F1,这没有什么错误呀。
没有F1可以按,因为是别人问起你的。
你不会教那个问你的人按F1?
为什么这个简单的学习方法你都不想教给别人?
维护你在他OR她 心中的大侠形象?



我不确定F1能不能解决这个问题
我也不确定对方有没有按
但我明确知道对方是会按F1的人,因为我见过他使用过.
所以我假定对方是按过F1没有找到理想答案的人

另外,麻烦你不要主观猜测好不好?
并且,明确告诉你,我不是什么大侠,也没有什么大侠形象要维护,这个东西对我不重要.

使用道具 举报

回复
论坛徽章:
8
生肖徽章2007版:龙
日期:2009-09-10 11:23:34ITPUB8周年纪念徽章
日期:2009-09-27 10:21:20祖国60周年纪念徽章
日期:2009-10-09 08:28:002010新春纪念徽章
日期:2010-01-04 08:33:082010新春纪念徽章
日期:2010-03-01 11:04:58ITPUB9周年纪念徽章
日期:2010-10-08 09:28:51ITPUB十周年纪念徽章
日期:2011-11-01 16:20:282012新春纪念徽章
日期:2012-01-04 11:49:54
35#
 楼主| 发表于 2009-8-22 15:00 | 只看该作者
好吧,既然有人说到F1,那我就把F1后的结果给大家

Variant 5
DATA itab [TYPE linetype|LIKE lineobj] OCCURS n
                                       [WITH HEADER LINE].




This variant is not allowed in an ABAP Objects context.

See Cannot Use OCCURS with Declarative Statements.



Effect
This variant exists for reasons of compatibility with Release 3.x. If this declaration is missing, the type C with a length of 1 is used. Otherwise the variant is synonymous with

   DATA itab {TYPE STANDARD TABLE OF linetype|
              LIKE STANDARD TABLE OF lineobj}
             INITIAL SIZE n [WITH HEADER LINE].

Example
TYPES: BEGIN OF LINE_TYPE,
         NAME(20) TYPE C,
         AGE      TYPE I,
       END   OF LINE_TYPE.
DATA:  PERSONS    TYPE LINE_TYPE OCCURS 20,
       PERSONS_WA TYPE LINE_TYPE.

PERSONS_WA-NAME = 'Michael'.  PERSONS_WA-AGE  = 25.
APPEND PERSONS_WA TO PERSONS.
PERSONS_WA-NAME = 'Gabriela'. PERSONS_WA-AGE  = 22.
APPEND PERSONS_WA TO PERSONS.



The internal table PERSONS now contains two entries:



Variant 6
DATA: BEGIN OF itab OCCURS n,
        ...

      END   OF itab [VALID BETWEEN f1 AND f2].



This variant is not allowed in an ABAP Objects context.

See Cannot Use OCCURS with Declarative Statements.

Effect
Defines an internal table itab with table type STANDARD and a header line. The line type consists of the fields between "BEGIN OF itab OCCURS n" and "END OF itab".

You can use the addition VALID BETWEEN f1 AND f2 to specify that subfields f1 and f2 of the internal table itab contain the validity range. This addition is only relevant in conjunction with the PROVIDE statement.



Example
DATA: BEGIN OF PERSONS OCCURS 20,
        NAME(20),
        AGE TYPE I,
      END   OF PERSONS.
PERSONS-NAME = 'Michael'.
PERSONS-AGE  = 25.
APPEND PERSONS.
PERSONS-NAME = 'Gabriela'.
PERSONS-AGE  = 22.
APPEND PERSONS.



The internal table now has two entries. It also has a header line (work area), which you use to work with the table itself.


Additional help
Internal Table Objects

F1上提到了OCCURS,并且例子中给了个OCCURS 20,但并没有明确解释OCCURS的含义.
如果知道OCCURS的含义了,还是可以从这里面猜测出来,但是对于新手,还是比较难以猜测的,即便能猜测,也不敢十分确认.
sap的词汇表
http://help.sap.com/saphelp_47x2 ... 387c12/frameset.htm
这上面也没有列OCCURS这个关键字.
通过这个帖子的帮助,偶知道了它的含义,但是偶还是没找到官方解释.
偶用abap occurs 作为关键字放狗搜
前两个连接是
http://help.sap.com/abapdocu/de/ABAPDATA_BEGIN_OF_OCCURS.htm
http://www.4ap.de/pages/abap/syntax/itab-deklarieren.php
这上面也没有明确提到.

偶查到的一个非官方的解释是

Body holds the rows of data
Defined using the occurs n

但是这个解释还是不详尽,比如官方的例子指定了OCCURS 20可能是指表的大小是20,而不是实际已经填充的行数为20,如果内表已经满20行了,怎么办?是仅仅不能填充了还是报错误?不能填充和报错误的时候sy-subrc返回值不为零,但是是多少?这些都没有说明.

这些也都不在F1上,偶也没搜索到.哪位的F1给出了解释,麻烦好心贴一下,谢谢你.

使用道具 举报

回复
论坛徽章:
8
生肖徽章2007版:龙
日期:2009-09-10 11:23:34ITPUB8周年纪念徽章
日期:2009-09-27 10:21:20祖国60周年纪念徽章
日期:2009-10-09 08:28:002010新春纪念徽章
日期:2010-01-04 08:33:082010新春纪念徽章
日期:2010-03-01 11:04:58ITPUB9周年纪念徽章
日期:2010-10-08 09:28:51ITPUB十周年纪念徽章
日期:2011-11-01 16:20:282012新春纪念徽章
日期:2012-01-04 11:49:54
36#
 楼主| 发表于 2009-8-22 18:52 | 只看该作者
找到一个解释了,不是官方的
Using the OCCURS addition:
OCCURS 10 does not limit the number of rows.
The system uses the OCCURS clause as a guideline to determine how much memory to allocate.
More is allocated if needed.
By default use OCCURS 0 – The system then allocates 8 KB of memory at run time.

使用道具 举报

回复
论坛徽章:
11
2009新春纪念徽章
日期:2009-01-04 14:52:28ITPUB元老
日期:2009-04-11 21:27:42生肖徽章2007版:牛
日期:2009-06-08 00:31:34
37#
发表于 2009-8-22 22:45 | 只看该作者

你要就给你,官方的

http://help.sap.com/saphelp_nw70 ... 829fbfe/content.htm

Special Features of Standard Tables   
Unlike sorted tables, hashed tables, and key access to internal tables, which were only introduced in Release 4.0, standard tables already existed several releases previously. Defining a line type, table type, and tables without a header line have only been possible since Release 3.0. For this reason, there are certain features of standard tables that still exist for compatibility reasons.
Standard Tables Before Release 3.0
Before Release 3.0, internal tables all had header lines and a flat-structured line type. There were no independent table types. You could only create a table object using the OCCURS addition in the DATA statement, followed by a declaration of a flat structure:
DATA: BEGIN OF itab OCCURS n,
      ...
        f1...,
        f2...,
      ...
      END OF itab.
This statement declared an internal table itabwith the line type defined following the OCCURS addition. Furthermore, all internal tables had header lines.
The number n in the OCCURS addition had the same meaning as in the INITIAL SIZE addition from Release 4.0. Entering ‘0’ had the same effect as omitting the INITIAL SIZE addition. In this case, the initial size of the table is determined by the system.

The above statement is still possible in Release 4.0, and has roughly the same function as the following statements:
TYPES: BEGIN OF itab,
       ...
         f1...,
         f2...,
       ...
       END OF itab.
DATA itab TYPE STANDARD TABLE OF itab
                 WITH NON-UNIQUE DEFAULT KEY
                 INITIAL SIZE n
                 WITH HEADER LINE.
In the original statement, no independent data type itabis created. Instead, the line type only exists as an attribute of the data object itab.
Standard Tables From Release 3.0
Since Release 3.0, it has been possible to create table types using
TYPES type TYPE|LIKE linetype OCCURS n.
and table objects using
DATA itab TYPE|LIKE linetype OCCURS n [WITH HEADER LINE].
statement. The effect of the OCCURS addition is to construct a standard table with the data type linetype. The line type can be any data type. The number n in the OCCURS addition has the same meaning as before Release 3.0. Before Release 4.0, the key of an internal table was always the default key, that is, all non-numeric fields that were not themselves internal tables.
The above statements are still possible in Release 4.0, and have the same function as the following statements:
TYPES|DATA itab TYPE|LIKE STANDARD TABLE OF linetype
                            WITH NON-UNIQUE DEFAULT KEY
                            INITIAL SIZE n
                            [WITH HEADER LINE].
They can also be replaced by the following statements:
Standard Tables From Release 4.0
When you create a standard table, you can use the following forms of the TYPES and DATAstatements. The addition INITIAL SIZE is also possible in all of the statements. The addition WITH HEADER LINE is possible in the DATA statement.
Standard Table Types
Generic Standard Table Type:
TYPES itab TYPE|LIKE [STANDARD] TABLE OF linetype.
The table key is not defined.
Fully-Specified Standard Table Type:
TYPES itab TYPE|LIKE [STANDARD] TABLE OF linetype
                       WITH [NON-UNIQUE] key.
The key of a fully-specified standard table is always non-unique.
Standard Table Objects
Short Forms of the DATA Statement
DATA itab TYPE|LIKE [STANDARD] TABLE OF linetype.
DATA itab TYPE|LIKE [STANDARD] TABLE OF linetype
                      WITH DEFAULT KEY.
Both of these DATA statements are automatically completed by the system as follows:
DATA itab TYPE|LIKE STANDARD TABLE OF linetype
                      WITH NON-UNIQUE DEFAULT KEY.
The purpose of the shortened forms of the DATAstatement is to keep the declaration of standard tables, which are compatible with internal tables from previous releases, as simple as possible. When you declare a standard table with reference to the above type, the system automatically adopts the default key as the table key.
Fully-Specified Standard Tables:
DATA itab TYPE|LIKE [STANDARD] TABLE OF linetype
                       WITH [NON-UNIQUE] key.
The key of a standard table is always non-unique.

使用道具 举报

回复
论坛徽章:
8
生肖徽章2007版:龙
日期:2009-09-10 11:23:34ITPUB8周年纪念徽章
日期:2009-09-27 10:21:20祖国60周年纪念徽章
日期:2009-10-09 08:28:002010新春纪念徽章
日期:2010-01-04 08:33:082010新春纪念徽章
日期:2010-03-01 11:04:58ITPUB9周年纪念徽章
日期:2010-10-08 09:28:51ITPUB十周年纪念徽章
日期:2011-11-01 16:20:282012新春纪念徽章
日期:2012-01-04 11:49:54
38#
 楼主| 发表于 2009-8-23 01:49 | 只看该作者
呵呵,看来你专业水平和英语水平也不过如此
对不起,牙掉了,捡一下先.

使用道具 举报

回复
论坛徽章:
121
紫蛋头
日期:2013-07-02 19:27:392014年新春福章
日期:2014-02-18 16:41:11马上有车
日期:2014-02-18 16:41:112014年世界杯参赛球队: 波黑
日期:2014-06-07 00:05:53喜羊羊
日期:2015-03-04 14:49:392015年新春福章
日期:2015-03-06 11:57:31
39#
发表于 2009-8-24 10:37 | 只看该作者
看来SAP得为F1 HELP做一个"Help on Help"

DATA - BEGIN OF OCCURS.gif (55.67 KB, 下载次数: 8)

DATA - BEGIN OF OCCURS.gif

使用道具 举报

回复
论坛徽章:
0
40#
发表于 2009-8-24 15:38 | 只看该作者
说到F1插句嘴,我装的那个IDES471里面虽然出来ABAP帮助窗口,但是点任何一个主题都没有内容出来,郁闷

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表