SAP Table control
REPORT RSDEMO02.
* demostrates the use of table controls
* unsolved problems: attributes left_col and v_scroll do not work
* correctly
TABLES: SPFLI. "flight connections, flights
DATA: FCODE2(4), FCODE(4). "ok-code
CONTROLS: TC_SPFLI TYPE TABLEVIEW USING SCREEN 100, "flights
TC_COLS TYPE TABLEVIEW USING SCREEN 100. "column props
DATA: COL TYPE CXTAB_COLUMN. "column of table control
TABLES: DEMO_CPROP, DEMO_TPROP. "structures for displaying
* global and column specific props
DATA: BEGIN OF IT_SPFLI OCCURS 20, "flight connections
MARKED. "Check box
INCLUDE STRUCTURE SPFLI.
DATA: END OF IT_SPFLI.
DATA LINNO TYPE I. "line number at cursor position
DATA FLD(20). "field name at cursor position
DATA OFF TYPE I. "offset of cursor position START-OF-SELECTION.
* read flight connections
SELECT * FROM SPFLI UP TO 100 ROWS.
MOVE-CORRESPONDING SPFLI TO IT_SPFLI.
APPEND IT_SPFLI.
ENDSELECT.
DESCRIBE TABLE IT_SPFLI LINES TC_SPFLI-LINES.
TC_COLS-LINES = 6.
* display flights with table control
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module FCODE_100 INPUT
*&---------------------------------------------------------------------*
* handle user command *
*----------------------------------------------------------------------*
MODULE FCODE_100 INPUT.
DATA: FLDNAME(100),FLDNAME2(100),FLDNAME3(100).
* copy global property changes made by the user
TC_SPFLI-FIXED_COLS = DEMO_TPROP-FIXED_COLS.
TC_SPFLI-LINES = DEMO_TPROP-LINES.
TC_SPFLI-LINE_SEL_MODE = DEMO_TPROP-LINE_SEL_M.
TC_SPFLI-COL_SEL_MODE = DEMO_TPROP-COL_SEL_MO.
TC_SPFLI-LINE_SELECTOR = DEMO_TPROP-LINE_SELEC.
TC_SPFLI-V_SCROLL = DEMO_TPROP-V_SCROLL.
TC_SPFLI-H_GRID = DEMO_TPROP-H_GRID.
TC_SPFLI-V_GRID = DEMO_TPROP-V_GRID.
FCODE2 = FCODE.
CLEAR FCODE.
* handle ok code
CASE FCODE2.
WHEN 'INFO'. "display online docu
CALL FUNCTION 'RS_TOOL_ACCESS'
EXPORTING
OPERATION = 'DOCS'
OBJECT_NAME = 'RSDEMO02'
OBJECT_TYPE = 'PROG'
* ENCLOSING_OBJECT =
* position = '1 1'
* DEVCLASS =
* INCLUDE =
* MONITOR_ACTIVATION = 'X'
* IMPORTING
* NEW_NAME =
* TABLES
* OBJLIST =
EXCEPTIONS
NOT_EXECUTED = 1
INVALID_OBJECT_TYPE = 2
OTHERS = 3. WHEN 'SORT'.
DATA: FLD_LIST LIKE TC_SPFLI-COLS.
* search for selected columns.
REFRESH FLD_LIST.
LOOP AT TC_SPFLI-COLS INTO COL.
IF COL-SELECTED = 'X'.
APPEND COL TO FLD_LIST.
ENDIF.
ENDLOOP.
SORT FLD_LIST BY INDEX.
CLEAR:FLDNAME, FLDNAME2, FLDNAME3.
READ TABLE FLD_LIST INDEX 1 INTO COL.
FLDNAME = COL-SCREEN-NAME+9.
READ TABLE FLD_LIST INDEX 2 INTO COL.
FLDNAME2 = COL-SCREEN-NAME+9.
READ TABLE FLD_LIST INDEX 3 INTO COL.
FLDNAME3 = COL-SCREEN-NAME+9.
SORT IT_SPFLI BY (FLDNAME) (FLDNAME2) (FLDNAME3).
WHEN 'BACK'.
SET SCREEN 0.
LEAVE SCREEN.
WHEN 'DELL'.
* remove marked lines
LOOP AT IT_SPFLI WHERE MARKED = 'X'.
DELETE IT_SPFLI.
ENDLOOP.
IF SY-SUBRC <> 0.
GET CURSOR FIELD FLD LINE LINNO OFFSET OFF.
SET CURSOR FIELD FLD LINE LINNO OFFSET OFF.
IF FLD CP 'IT_SPFLI*' AND SY-SUBRC = 0.
LINNO = LINNO + TC_SPFLI-TOP_LINE - 1.
DELETE IT_SPFLI INDEX LINNO.
TC_SPFLI-LINES = TC_SPFLI-LINES - 1.
ENDIF.
ENDIF.
WHEN 'INSL'.
* insert line above cursor position
GET CURSOR FIELD FLD LINE LINNO OFFSET OFF.
SET CURSOR FIELD FLD LINE LINNO OFFSET OFF.
IF FLD CP 'IT_SPFLI*' AND SY-SUBRC = 0.
IF LINNO >= 1.
LINNO = LINNO + TC_SPFLI-TOP_LINE - 1.
CLEAR IT_SPFLI.
INSERT IT_SPFLI INDEX LINNO.
TC_SPFLI-LINES = TC_SPFLI-LINES + 1.
ELSE.
CLEAR IT_SPFLI.
APPEND IT_SPFLI.
TC_SPFLI-LINES = TC_SPFLI-LINES + 1.
ENDIF.
ENDIF.
ENDCASE.
ENDMODULE. " FCODE_100 INPUT
*&---------------------------------------------------------------------*
*& Module INIT_100 OUTPUT
*&---------------------------------------------------------------------*
* *
*----------------------------------------------------------------------*
MODULE INIT_100 OUTPUT.
SET PF-STATUS 'S100'.
* make global props visible
MOVE:
TC_SPFLI-FIXED_COLS TO DEMO_TPROP-FIXED_COLS,
TC_SPFLI-LINES TO DEMO_TPROP-LINES,
TC_SPFLI-TOP_LINE TO DEMO_TPROP-TOP_LINE,
TC_SPFLI-CURRENT_LINE TO DEMO_TPROP-CURRENT_LI,
TC_SPFLI-LEFT_COL TO DEMO_TPROP-LEFT_COL,
TC_SPFLI-LINE_SEL_MODE TO DEMO_TPROP-LINE_SEL_M,
TC_SPFLI-COL_SEL_MODE TO DEMO_TPROP-COL_SEL_MO,
TC_SPFLI-LINE_SELECTOR TO DEMO_TPROP-LINE_SELEC,
TC_SPFLI-V_SCROLL TO DEMO_TPROP-V_SCROLL,
TC_SPFLI-H_GRID TO DEMO_TPROP-H_GRID,
TC_SPFLI-V_GRID TO DEMO_TPROP-V_GRID.
ENDMODULE. " INIT_100 OUTPUT
*&---------------------------------------------------------------------*
*& Module MODIFY_IT_SPFLI INPUT
*&---------------------------------------------------------------------*
* transport changes to internal table *
*----------------------------------------------------------------------*
MODULE MODIFY_IT_SPFLI INPUT.
MODIFY IT_SPFLI INDEX TC_SPFLI-CURRENT_LINE.
ENDMODULE. " MODIFY_IT_SPFLI INPUT
*&---------------------------------------------------------------------*
*& Module READ_COLS OUTPUT
*&---------------------------------------------------------------------*
* Read according column property and make it visible *
*----------------------------------------------------------------------*
MODULE READ_COLS OUTPUT.
READ TABLE TC_SPFLI-COLS INDEX TC_COLS-CURRENT_LINE INTO COL.
IF SY-SUBRC <> 0.
EXIT FROM STEP-LOOP.
ENDIF.
MOVE:
COL-SCREEN-NAME TO DEMO_CPROP-NAME,
COL-SCREEN-GROUP1 TO DEMO_CPROP-GROUP1,
COL-SCREEN-GROUP2 TO DEMO_CPROP-GROUP2,
COL-SCREEN-GROUP3 TO DEMO_CPROP-GROUP3,
COL-SCREEN-GROUP4 TO DEMO_CPROP-GROUP4,
COL-SCREEN-REQUIRED TO DEMO_CPROP-REQUIRED,
COL-SCREEN-INPUT TO DEMO_CPROP-INPUT,
COL-SCREEN-OUTPUT TO DEMO_CPROP-OUTPUT,
COL-SCREEN-INTENSIFIED TO DEMO_CPROP-INTENS,
COL-SCREEN-INVISIBLE TO DEMO_CPROP-INVISIBLEV,
COL-SCREEN-LENGTH TO DEMO_CPROP-LENGTH,
COL-SCREEN-ACTIVE TO DEMO_CPROP-ACTIVE,
COL-INDEX TO DEMO_CPROP-INDEX,
COL-SELECTED TO DEMO_CPROP-SELECTED,
COL-VISLENGTH TO DEMO_CPROP-VISLENGTH,
COL-INVISIBLE TO DEMO_CPROP-INVISIBLEC. ENDMODULE. " READ_COLS OUTPUT
*&---------------------------------------------------------------------*
*& Module MODIFY_COLS INPUT
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
MODULE MODIFY_COLS INPUT.
CLEAR COL.
READ TABLE TC_SPFLI-COLS INDEX TC_COLS-CURRENT_LINE INTO COL.
COL-SCREEN-GROUP1 = DEMO_CPROP-GROUP1.
COL-SCREEN-GROUP2 = DEMO_CPROP-GROUP2.
COL-SCREEN-GROUP3 = DEMO_CPROP-GROUP3.
COL-SCREEN-GROUP4 = DEMO_CPROP-GROUP4.
COL-SCREEN-REQUIRED = DEMO_CPROP-REQUIRED.
COL-SCREEN-INPUT = DEMO_CPROP-INPUT.
COL-SCREEN-OUTPUT = DEMO_CPROP-OUTPUT.
COL-SCREEN-INTENSIFIED = DEMO_CPROP-INTENS.
COL-SCREEN-INVISIBLE = DEMO_CPROP-INVISIBLEV.
COL-SCREEN-LENGTH = DEMO_CPROP-LENGTH.
COL-SCREEN-ACTIVE = DEMO_CPROP-ACTIVE.
COL-INVISIBLE = DEMO_CPROP-INVISIBLEC.
* update column specific property changes made by the user
MODIFY TC_SPFLI-COLS INDEX TC_COLS-CURRENT_LINE FROM COL.
ENDMODULE. " MODIFY_COLS INPUT
SAP Table control的更多相关文章
- SAP ABAP编程 Table Control动态隐藏列
在SAP DIALOG设计中,有时候须要动态的隐藏某些列,以下是方法. ***数据定义 CONTROLS: table_control TYPE TABLEVIEW USING SCREEN 0100 ...
- ABAP中的Table Control编程
SAP中,Table Control是在Screen中用的最广泛的控件之一了,可以实现对多行数据的编辑. 简单来说,Table Control是一组屏幕元素在Screen上的重 ...
- ABAP Table Control
SAP中,Table Control是在Screen中用的最广泛的控件之一了,可以实现对多行数据的编辑. 简单来说,Table Control是一组屏幕元素在Screen上的重复出现,这就是它与普通 ...
- table control里面各种属性和事件
[转自]http://blog.csdn.net/hackai886/article/details/7935366 SAP中,Table Control是在Screen中用的最广泛的控件之一了,可以 ...
- abap table control里面各种属性和事件的写法
SAP中,Table Control是在Screen中用的最广泛的控件之一了,可以实现对多行数据的编辑. 简单来说,Table Control是一组屏幕元素在Screen上的重复出现,这就是它与普通屏 ...
- TABLE CONTROL隐藏列和固定列的实现
一.设置固定列 需求:为了方便对主要关心信息地查看,用户希望TABLE CONTROL左边的一列或者几列在屏幕上固定.针对用户这样子的需求, 我们首先会想到类似与屏幕编辑/可见等字段属性设置,但是此方 ...
- ABAP 表格控制(Table Control)和步循环
表格控制(Table Control)和步循环 1.两个标准Demo: SAPMTZ60,SAPMTZ61 2.简介 3.建立Table Control程序的基本流程 4.使用步循环 5.表格 ...
- ABAP 中 Table Control例子
实现了Table Control的主要的一些功能,可以作为例子参考,实现的功能有是否可编辑切换,选择某一条记录点击按钮显示详细信息,新增记录,删除记录,选择所有记录,选择光标所有记录,取消选择所有,排 ...
- ABAP table control例子
[转自]http://blog.csdn.net/lhx20/article/details/3039909Table control用于在screen上以表格的形式显示数据,在table contr ...
随机推荐
- 微信小程序一些标签
wxml标签 一.视图容器(View Container): 二.基础内容(Basic Content) 标签名 说明 标签名 说明 view 视图容器 icon 图标 scroll-view ...
- IDEA小技巧:Markdown里的命令行可以直接运行了
作为一名开发者,相信大部分人都喜欢用Markdown来写文章和写文档. 如果你经常用开源项目或者自己维护开源项目,肯定对于项目下的README文件也相当熟悉了吧,通常我们会在这里介绍项目的功能.如何使 ...
- nodejs的TCP相关的一些笔记
TCP协议 基于nodejs创建TCP服务端 TCP服务的事件 TCP报文解析与粘包解决方案 一.TCP协议 1.1TCP协议原理部分参考:无连接运输的UDP.可靠数据传输原理.面向连接运输的TCP ...
- WMS、WFS、WCS、WPS、WMTS、WMSC、TMS等常见地图服务的区别
WebGIS的开发者经常需要面对各种地图服务规范,例如WMS.WFS.WCS.WPS.WMTS.TMS.WMSC等.因此了解这些服务的内容是相当重要的,这里对常见的服务进行了整理. OGC联盟: 开放 ...
- oauth协议原理
oauth协议关系图(如获取微信用户信息): oauth一般授权步骤:
- c++:-1
C++第一部分介绍基础:c++:-0,本节介绍C++中函数使用. 函数 函数调用 调用函数需要先声明函数原型 嵌套调用: 参数传递 在函数被调用时才分配形参的存储单元 实参可以是常量.变量或表达式 实 ...
- Spring Boot 启动源码解析结合Spring Bean生命周期分析
转载请注明出处: 1.SpringBoot 源码执行流程图 2. 创建SpringApplication 应用,在构造函数中推断启动应用类型,并进行spring boot自动装配 public sta ...
- TCP 协议灵魂 12 问,巩固你的网路底层基础!
点击上方"开源Linux",选择"设为星标" 回复"学习"获取独家整理的学习资料! 先亮出这篇文章的思维导图 TCP 作为传输层的协议,是一 ...
- Open Harmony移植:build lite配置目录全梳理
摘要:本文主要介绍build lite 轻量级编译构建系统涉及的配置目录的用途,分析相关的源代码. 本文分享自华为云社区<移植案例与原理 - build lite配置目录全梳理>,作者:z ...
- asp.net swagger的使用
最近要从其他系统获取一些数据,准备写个接口让别人把数据塞进来,顺便学习一下如何使用Swagger. 参考大神的教程:asp.net https://mp.weixin.qq.com/s/SHNNQo ...