ABAP:Interactive list

本文详细介绍了ABAP中交互式列表的实现机制,包括基本列表与详细列表的区别,列表层级的概念,以及如何通过不同事件处理来控制列表的行为。文中还提到了用于创建列表头部、隐藏字段和其他关键操作的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

可以同时存在20detail lists,每个list都有自己的内存空间,这块儿空间称为list bufferdetail lists中可以使用的功能跟basic lists一样,通过BackCancel可以结束当前的list并返回到上一个list,通过Exit可以回到selection screenSTART-OF-SELECTIONGETEND-OF-SELECTIONTOP-OF-PAGEEND-OF-PAGE都是用来创建basic list的,一旦创建了basic list这些事件便不会再被触发,AT LINE-SELECTIONAT USER-COMMAND是创建detail list的基础事件,TOP-OF-PAGE DURING LINE-SELECTION用来创建detail listheader。当应用显示多个detail list通过case语句通过sy-dynnr来决定那个secondary headings会被显示。Sy-lsind表示当前的list level,在AT LINE-SELECTION或者AT USER-COMMAND被触发的时候这个值就会增一。程序员可以控制detail lists的最大数量,只要其在某个sy-lsind之后不再运行语句:WRITEULINESKIP。通过HIDE把变量和值存储起来,通常hide用来存储key fields,或者需要的其他额外信息。Hide语句应紧跟在最后一个write语句之后出现。当碰到一个line-feed characteroutput line由于line size不够被折成两行时,sy-lilli都会自增一。这样的话必须保证detail line不会被wrap,以保证所hide的变量用户选择的行保持一致。大于当前detail list levellistlist buffer都会自动被删除。每个list level都有自己的hide area。如果你选择的行没有任何hide area存储,那么就称为invalid line selectionInvalid lines包括headerfooters。必须保证对于invalid line selection没有detail list创建。示例代码如下:

REPORT  ZTESTDETAILLIST.
NODES: spfli.
GET SPFLI.
  
WRITE: / spfli-carrid,
           spfli-connid.
  
HIDE: spfli-carrid,spfli-connid.
END-OF-SELECTION.
  
CLEAR: spfli-carrid.
AT LINE-SELECTION.
  
CHECK NOT spfli-carrid IS INITIAL.
  
WRITE'OL'.
  
CLEAR: spfli-carrid.

粗体红色部分保证了这一点。

Title name的长度为20个字符,并且字母必须大写,title始终为激活状态年直到设置下一个titleSET TITLE <TITLE> WITH中可以带最多9个变量。所有的变量的长度不能够超过70个字符。TOP-OF-PAGE DURING LINE SELECTION用来创建detail listheader,可以通过sy-lsind来确定在不同的detail list上创建不同的header。当用户选择一行时,所选择的行号就会被存储在sy-lisel中,可以用它在detail listpage header中来显示那一行被选中了。可以通过WINDOW STARTING AT <C1> <R1> ENDING AT …来把detail list显示到模式对话框中。如果<R1><= 0detail list仍然显示在full screen中而不是model dialog box中。可以通过SET TITLEBAR来为模式对话框创建title。由于系统为所有的model dialog box指定了标准的gui,所以指定custom gui status是没有意义的。可以通过GET CURSOR STATEMENT来根据鼠标的位置来创建detail listFIELD提供了output field的名称,VALUE提供了output field的值。值得注意的是不要将value得到的值放到SELECTWHERE CONDITIONG中,对于这种case还应当使用hide technique

interactive list相关的系统字段列表:

SY-LSIND Index for the current list

SY-LISTI Index of the last list displayed

SY-LILLI Absolute number of a selected line in the list displayed

SY-CPAGE Number of the upper-most displayed line in the list displayed

SY-CUCOL Number of the column in the window where the cursor was last positioned in the list displayed

SY-CUROW Number of the line in the window where the cursor was last positioned in the list displayed

SY-STACO Number of the first column displayed in the list displayed

SY-STARO Number of the first visible line in the top displayed page (SY-PAGE) in the list displayed (not including header lines)

SY-UCOMM Function code that triggered the interactive event in the list displayed

SY-PFKEY Status of the list displayed

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值