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 ...
随机推荐
- Array实现
(一)基本类型数组实现 public class Array { private int[] data; private int size; // 构造函数,传入数组的容量capacity构造Arra ...
- Postman中文版客户端
"新冷战"蔓延到生产力工具 前端时间,著名 UI 设计软件 Figma 宣布制裁大疆! 这不仅让中国的互联网从业者纷纷一头冷汗:今天是 Figma,明天会是什么?今天是大疆,明天会 ...
- CesiumJS 2022^ 原理[2] 渲染架构之三维物体 - 创建并执行指令
目录 回顾 预备知识:指令 预备知识:通道 1. 生成并执行指令 1.1. Primitive 生成指令 1.2. Context 对象负责执行 WebGL 底层代码 2. 多段视锥体技术 3. 指令 ...
- css 实现流光字体效果
<template> <div> <p data-text="Lorem ipsum dolor"> Lorem ipsum dolor ...
- 推荐一个我写的Python库——PyNAS
介绍 PyNAS是一个以Python的Updog的库为基础,制作而来的库 安装 pip安装(推荐) pip install PyNAS 源码安装(推荐) Github: git clone https ...
- Python获取文件夹下的所有文件名
1 #获取文件夹内的图片 2 import os 3 def get_imlist(path): 4 return [os.path.join(path,f) for f in os.listdir( ...
- 【面试普通人VS高手系列】死锁的发生原因和怎么避免
一个去阿里面试的小伙伴私信我说:今天被一个死锁的问题难到了. 平常我都特意看了死锁这块的内容,但是回答的时候就想不起来. 这里可能存在一个误区,认为技术是要靠记的. 大家可以想想,平时写代码的时候,这 ...
- Django视图函数:CBV与FBV (ps:补充装饰器)
CBV 基于类的视图 FBV 基于函数的视图 CBV: 1 项目目录下: 2 urlpatterns = [ 3 path('login1/',views.Login.as_view()) #.as ...
- 将Excel数据转换为Java可识别时间(Date、Timestamp)
引言 Excel的时间,POI读取到的是double,这个值不是timestamp.需要进行一些转换,将它转换为Date或者Timestamp. Excel中的日期数据: 程序中读取到的数据: 如何转 ...
- 3.yum学习笔记
一.yum介绍 将所有的rpm软件包放到指定服务器上,当进行yum在线安装时,可以自动解决依赖性问题. yum配置文件常位于/etc/yum.repo.d 目录下 [root@aaa251 ~]# c ...