LOOP - WITH CONTROL

Syntax  语法

LOOP [AT itab INTO wa [CURSOR top_line] [FROM n1] [TO n2]]
     WITH CONTROL contrl.
  ...
ENDLOOP.

Variants: 变式

1. LOOP WITH CONTROL contrl.

2. LOOP AT itab CURSOR cur INTO wa
       [CURSOR top_line] [FROM n1] [TO n2]
       WITH CONTROL contrl.

Effect 作用

Definition of a loop in the dynpro flow logic, which is linked to a table control contrl. The loop sequentially processes the presented rows of table control contrl by executing one loop pass per table control row. For contrl, you must directly specify the name of a table control of the dynpro. If the table control does not exist, the loop is ignored. The statement block between LOOP and ENDLOOP can contain the keywords FIELD, MODULE, CHAIN and ENDCHAIN of the flow logic. You cannot nest loops. You can execute loops either with or without reference to an internal table.

在屏幕逻辑流中定义一个和表控件control 联系在一起的LOOP循环,这个LOOP循环通过每执行一次循环通过表控件的一行来处理表控件control的当前行。对于表控件control ,你必须直接指定这个屏幕表控件的名字。如果表控件不存在,Loop循环被忽略。在LOOP和ENDLOOP之间的语句可以包含逻辑流的FIELD, MODULE, CHAINENDCHAIN关键字。在这里不能进行循环嵌套。你可以在参照或者不参照内表的情况下执行循环。

If table controls are defined in a dynpro, you must define one loop for each table control both in the PBO processing block and in the PAI processing block.

如果表控件被定义在一个屏幕中,你必须在PBO处理块和PAI处理块为每一个表控件定义一个LOOP循环。

System Fields 系统字段

Within the loop pass, the system field sy-stepl contains the number of the current table control row, started at the top visible row. The system field sy-loopc contains the total number of table control rows displayed on the screen.

在LOOP循环中,系统字段sy-stepl 保存着当前表控件的行数,从最顶部的可见行开始。系统字段sy-loopc保存着表控件显示在屏幕上的总行数。

Note

To link the loop to a table control, use the addition WITH CONTROL. The statement LOOP without this addition processes stand-alone step loops and is obsolete.

为了把LOOP和表控件联接起来,使用with control 附加项。不包含这个附加项的LOOP语句独立处理每步循环并且已经很被废弃了。

Variant 1 变式1

LOOP WITH CONTROL contrl.
  ...

ENDLOOP.

Effect 作用

If the addition AT itab is not specified, during a loop pass the contents of the screen fields of the current row of table control contrl are transported from (at event PBO) or to (at event PAI) the data objects with the same names of the ABAP program. During PBO processing, the transport is done at the end of, during PAI processing at the beginning of the loop pass. The addition WITH CONTROL must be specified both at PBO and PAI.

如果没有指定AT itab条件,在一个LOOP循环期间表控件control的当前行的屏幕字段内容传送从(事件PBO)或者到(事件PAI)ABAP程序中具有相同名字的数据对象中。在PBO处理期间,传送在结束时完成,在PAI处理期间在LOOP循环开始时完成。WITH CONTROL条件必须在PBO和PAI模块都被指定。

Notes 注释

  • For screen fields of the table control that are defined with a reference to the ABAP Dictionary, the data objects with the same names of the ABAP program must be declared exactly like normal screen fields with TABLES, otherwise there will be no data transport.

对于参照ABAP字典定义的表控件上的屏幕字段,与ABAP程序中有相同名字的数据对象必须像普通的屏幕字段一样用TABLES准确地进行声明,否则将不会传递数据。

  • In the loop, you can call dialog modules to process the relevant data objects of the ABAP program. For example, you can read data from an internal table at PBO and write it back to this internal table at PAI, after processing it on the screen.

在LOOP循环中,你可以调用会话模块来处理和ABAP程序相关的数据对象。例如,你可以在PBO模块从一个内表中读取数据并且在屏幕处理结束后在PAI模块把他写回内表中。

Variant 2 变式2

LOOP AT itab CURSOR cur INTO wa
     [CURSOR top_line] [FROM n1] [TO n2]

     WITH CONTROL contrl.
  ...
ENDLOOP.

Effect 作用

If you specify addition AT itab, during loop processing of the table control the internal table itab of the corresponding ABAP program is processed sequentially in parallel. For each row of the table control, one row of the internal table is processed. The internal table itab must be an index table. You can specify the additions INTO, CURSOR, FROM, TO and WITH CONTROL only at PBO, but not at PAI. At PAI, the internal table is used for reference to the table control.

如果你指定AT itab 项,在表控件的循环处理期间,ABAP程序中相一致的内表itab也同时被处理了。对于表控件的每一行,处理内表中的一行。内表itab必须是索引表。你只能在PBO模块指定INTO, CURSOR, FROM, TOWITH CONTROL些项,而不能在PAI模块指定。在PAI模块,内表用于表控件的参考。

Use addition INTO to specify a work area wa, to which at PBO at the end of each loop pass the current row of the internal table is assigned. If you do not specify the addition wa, an internal table with header row must be used, which will then be used implicitly instead of wa. The content of wa or of the header row is transported after the assinment to the fields with the same names in the current row of the table control. The work area wa must be a global data object of the ABAP program matching the row type of the internal table. At the event PAI, only the work area wa or the header row of the internal table is filled with the content of the table control rows at the beginning of each loop pass. The content of the internal table is not automatically changed.

使用INTO项来指定一个工作区WA,wa在每个LOOP循环结束通过内表的当前行时被指定。如果你不指定wa项,必须使用带表头的内表,表头用来在后台代替wa。Wa的内容或者是表头行的内容在这个作业结束后被传输到表控件的当前行具有相同名字的字段中。Wa工作区必须是ABAP程序的一个和内表的行类型相匹配的全局数据对象。在PAI事件中,只有工作区wa或者是内表的表头被表控件的行在每次循环开始时被填充。内表的数据不会自动改变。

The syntax of additions CURSOR, FROM and TO is identical to the processing of step loops. When looping on table controls, you are allowed to use additions, but they are not really necessary, because the table controls are designed to be controlled by the structure of type CXTAB_CONTROL created via CONTROLS in the ABAP program. Here, top_line of component TOP_LINE corresponds to this structure while the number of rows to be displayed can be controlled using component LINES instead of n1 and n2. If n1 is still specified for table controls, the content of component CURRENT_LINE is calculated as follows, differing from the method shown at CONTROLS: sy-stepl+ (TOP_LINE - 1) + (n1 - 1).

语法中的CURSOR, FROM 和 TO项与循环处理相同。当在表控件上执行loop循环时,你可以使用附加项,但它们也并不是必须的,因为表控件被设计用于被结构类型CXTAB_CONTROL 在ABAP程序中通过生成CONTROLS控制。这里,字段TOP_LINE 的top_line相当于这个结构当行数被显示出来时能够用字段LINES控制从而取代了n1和n2。如果n1仍然被指定了,字段CURRENT_LINE的值通过如下方法计算得到,和在CONTROLS中出现的方法不相同。

Notes 注释

  • For screen fields of the table control defined with a reference to flat structures in the ABAP Dictionary, the data objects with the same names of the ABAP program must be declared identically to normal screen fields using TABLES, otherwise there will be no data transport.

对于表控件上参照ABAP字典的扁平结构定义的屏幕字段,和ABAP程序具有相同名字的数据对象必须和普通屏幕字段一样用TABLES进行声明,否则将不会有数据传递。

  • Between LOOP and ENDLOOP, at PBO no dialog module must be called to read the data from the internal table. At PAI, however, this is necessary provided you want to evaluate the transported data. For example, you can modify the internal table according to the user entries.

在LOOP和ENDLOOP之间,在PBO不必调用会话模块来从内表中读取数据。然而,在PAI,如果想取到传递来的数据你必须提供会话模块。例如,你可以通过用户记录修改内表。

Example

If on the screen of a dynpro a table control FLIGHT_TAB is defined, the relevant flow logic may look like this. The loop is executed with reference to the internal table spfli_tab. At PBO, the loop calls a dialog module prepare_tab to fill the internal table. In the loop, at PBO no dialog module is called, because the table control in this case is filled automotically. At PAI, in the loop a dialog module modify_tab is called to store the changes the user entered in the table control in the internal table. You can find the relevant programming section of the ABAP program in the example for CONTROLS.

如果在主屏幕上定义一个表控件FLIGHT_TAB,相关的流逻辑可能是这样的。LOOP循环参照内表spfli_tab执行。在PBO,LOOP循环调用一个会话模块prepare_tab来填充内表,在LOOP循环中,在PBO块没有调用会话模块,因为在这个例子中的表控件被自动填充了。在PAI,LOOP循环调用了modify_tab会话模块用来保存用户在表控件上的输入修改到内表中。你可以找到ABAP程序示例CONTROLS中相关的程序块。

PROCESS BEFORE OUTPUT.
  MODULE prepare_tab.
  LOOP AT spfli_tab INTO spfli WITH CONTROL flight_tab.
  ENDLOOP.
PROCESS AFTER INPUT.
  LOOP AT spfli_tab.
    MODULE modify_tab.
  ENDLOOP.

由于水平有限,并且也是刚接触这些不久,所以翻译显得很生硬,请谅解。翻译也是旨在提高自己的英语水平,希望自己能有所提高,这样坚持下去吧……

希望大家批评指正,谢谢。

转载于:https://www.cnblogs.com/clsoho/archive/2010/01/22/1654379.html

LOOP WITH CONTROL 用法相关推荐

  1. php.ini 关闭输出缓冲,php 输出缓冲 Output Control用法实例详解

    本文实例讲述了php 输出缓冲 Output Control用法.分享给大家供大家参考,具体如下: 关于php的输出缓冲,首先要说明的是什么是缓冲(buffer),比如我们通过记事本在编辑文件的时候, ...

  2. loop和goto用法

    loop和goto用法 之所以写这个博客是因为,我在csDN查loop时搜到的文章都要money ,或者积分,但我不想消耗积分在这上面.

  3. 织梦 DEDECMS LOOP标签的用法及调用

    DEDECMS LOOP标签的用法及调用 LOOP标签] 说明:用于调用任意表的数据,一般用于调用论坛贴子之类的操作 范围:所有模板 (1) 语法 {dede:loop table='' sort=' ...

  4. control的用法及短语_out of control用法及例句

    out of control短语的意思是"失去控制;不受控制".如果Out-of-control 三个单词之间用横杠连接,做形容词,意思是失控的. out of control用法 ...

  5. MFC Edit control用法

    MFC里面的EDIT Control控件的用法是怎么样的,1.怎么样才能赋值给EDIT Control控件并在EDIT Control控件显示出来;2.怎么取得EDIT Control控件的值并传递给 ...

  6. 汇编loop指令及用法解释

    首先知道寄存器的类别, 其中CX寄存器是计数寄存器,在循环,位移等操作中重要 loop指令格式 初始化寄存器CX的次数 标识符: ;完成的操作 LOOP 标识符 说明:loop指令会使每循环一次,cx ...

  7. 帝国cms e loop php,帝国CMS灵动标签e:loop的一些用法

    附加SQL条件新闻系统自定义字段picurl 图片地址不为空:[e:loop={0,12,3,1,"picurl<>""}] [/e:loop] 默认表随机调 ...

  8. Picture control用法

    把Picture控件的Notify属性改为enable 即可相应鼠标消息 方法1.先从最简单的开始,用picture 控件来实现. 步骤: 先在资源里Import一张图片,ID为IDB_BITMAP2 ...

  9. table control的修改/排序/删除功能实现实例

    本实例仿照SAP DEMO而写 DEMO名称是:demo_dynpro_tabcont_loop_at,自动动手写一次的目的是把将该程序的注释写明白一点,希望本文对刚入门的博友在理解table con ...

最新文章

  1. 7.RabbitMQ RFC同步调用
  2. python中国大学排名爬虫写明详细步骤-Python爬虫 2020中国大学排名
  3. Win64 驱动内核编程-30.枚举与删除线程回调
  4. SignalR集成Autofac
  5. 如何发现假库存照片(并将合适的人归于属性)
  6. confusion中文_confusion
  7. C++ 纯虚函数 虚函数 override
  8. keytool的使用
  9. 手机远程控制电脑如何做到?
  10. 一个按键控制数码管的开和关_按键控制数码管显示
  11. python如何写简历_用Python写简历
  12. 地表反射率影响因素_【专题突破】影响气候形成的因素及主要气候判别(高中地理),务必掌握!...
  13. 大数据技术之Hive 第6章 查询
  14. 两台不同的型号的路由器桥接
  15. correl函数_WPS表格办公— CORREL 函数的用法
  16. webRTC(十二):webrtc 传输速率控制
  17. cve-2019-0708 exp 漏洞复现(bluekeep rce)
  18. CAD进阶练习(五)
  19. 计算日期是星期几(基姆拉尔森计算公式)
  20. eNSP静态路由配置详细命令

热门文章

  1. Linux:程序员必备的21条Linux 命令
  2. 收集100 个网络基础知识
  3. T-SQL 实用函数总结
  4. 在linux安装不了apache,Apache 不能安装在linux?
  5. 进程间通信IPC(一)(半双工管道和消息队列)
  6. python 多继承的问题
  7. Serverless 究竟是什么?
  8. 10个前端8个用Vue的,怎么才能在面试中出彩?
  9. 利用Python查看微信共同好友
  10. ESMap+Html5+SpringBoot+FastDFS实现导航导购App