使用弹窗批量修改数据POPUP_GET_VALUES
转自:https://blog.csdn.net/huanglin6/article/details/81231215
业务场景:在SAP内,有时候需要用户批量维护某些数据,这时候可以使用标准函数POPUP_GET_VALUES可以进行批量的维护。
效果图
参考代码
FORM CALL_CHANGE CHANGING P_L_RETURN_CODE . DATA: BEGIN OF FIELDS OCCURS .
INCLUDE STRUCTURE SVAL.
DATA: END OF FIELDS. DATA: L_RETURN_CODE TYPE C.
DATA: DATE LIKE T5A4A-DLYDY. CLEAR:FIELDS.
FIELDS-TABNAME = 'ZTSD_SCXQ_H'.
FIELDS-FIELDNAME = 'WERKS'.
APPEND FIELDS. CLEAR:FIELDS.
FIELDS-TABNAME = 'EKKO'.
FIELDS-FIELDNAME = 'EKORG'.
APPEND FIELDS. CLEAR:FIELDS.
FIELDS-TABNAME = 'EKKO'.
FIELDS-FIELDNAME = 'EKGRP'.
APPEND FIELDS. CLEAR:FIELDS.
FIELDS-TABNAME = 'LFA1'.
FIELDS-FIELDNAME = 'LIFNR'.
APPEND FIELDS. *FIELDS-TABNAME = 'LFA1'.
*FIELDS-FIELDNAME = 'NAME1'.
*APPEND FIELDS. CLEAR:FIELDS.
FIELDS-TABNAME = 'T001L'.
FIELDS-FIELDNAME = 'LGORT'.
APPEND FIELDS. CLEAR:FIELDS.
FIELDS-TABNAME = 'ZTMM_ZMWSKZ'.
FIELDS-FIELDNAME = 'MWSKZ'.
APPEND FIELDS. CLEAR:FIELDS.
FIELDS-TABNAME = 'EKKO'.
FIELDS-FIELDNAME = 'BSART'.
APPEND FIELDS. CLEAR:FIELDS.
FIELDS-TABNAME = 'ZTPP_CPDM'.
FIELDS-FIELDNAME = 'ZDM'.
FIELDS-FIELDTEXT = '产品代码'.
APPEND FIELDS. CLEAR:FIELDS.
FIELDS-TABNAME = 'ZTPP_SCDM'.
FIELDS-FIELDNAME = 'ZDM'.
FIELDS-FIELDTEXT = '生产代码'.
APPEND FIELDS. CLEAR:FIELDS.
FIELDS-TABNAME = 'EKKO'.
FIELDS-FIELDNAME = 'ZYFK'.
APPEND FIELDS. CLEAR:FIELDS.
FIELDS-TABNAME = 'ZTMM_ZTERM'.
FIELDS-FIELDNAME = 'ZTERM'.
APPEND FIELDS. CLEAR:FIELDS.
FIELDS-TABNAME = 'BAPIMEPOITEM'.
FIELDS-FIELDNAME = 'UNDER_DLV_TOL'.
APPEND FIELDS. CLEAR:FIELDS.
FIELDS-TABNAME = 'BAPIMEPOITEM'.
FIELDS-FIELDNAME = 'OVER_DLV_TOL'.
APPEND FIELDS. CLEAR:FIELDS.
FIELDS-TABNAME = 'ZTMM_JYD'.
FIELDS-FIELDNAME = 'ZJYD'.
APPEND FIELDS. CLEAR:FIELDS.
FIELDS-TABNAME = 'EKKO'.
FIELDS-FIELDNAME = 'ZCGXY'.
APPEND FIELDS. CLEAR:FIELDS.
FIELDS-TABNAME = 'EKKO'.
FIELDS-FIELDNAME = 'PINCR'.
FIELDS-FIELDTEXT = '日期加'.
APPEND FIELDS. CLEAR:FIELDS.
FIELDS-TABNAME = 'EKKO'.
FIELDS-FIELDNAME = 'LPONR'.
FIELDS-FIELDTEXT = '日期减'.
APPEND FIELDS. CLEAR:FIELDS.
FIELDS-TABNAME = 'EKPO'.
FIELDS-FIELDNAME = 'NETPR'.
FIELDS-FIELDTEXT = '含税单价'.
APPEND FIELDS. CLEAR:FIELDS.
FIELDS-TABNAME = 'EKKO'.
FIELDS-FIELDNAME = 'WAERS'.
FIELDS-FIELD_ATTR = '' .
APPEND FIELDS. CALL FUNCTION 'POPUP_GET_VALUES'
EXPORTING
* NO_VALUE_CHECK = ' '
POPUP_TITLE = '批量赋值'
* START_COLUMN = '5'
* START_ROW = '5'
IMPORTING
RETURNCODE = L_RETURN_CODE
TABLES
FIELDS = FIELDS
EXCEPTIONS
ERROR_IN_FIELDS =
OTHERS =
.
IF SY-SUBRC <> .
* Implement suitable error handling here
ENDIF. READ TABLE FIELDS WITH KEY FIELDNAME = 'WERKS'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_WERKS.
ENDIF. READ TABLE FIELDS WITH KEY FIELDNAME = 'EKORG'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_EKORG.
ENDIF. READ TABLE FIELDS WITH KEY FIELDNAME = 'EKGRP'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_EKGRP.
ENDIF. READ TABLE FIELDS WITH KEY FIELDNAME = 'LIFNR'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_LIFNR.
ENDIF. READ TABLE FIELDS WITH KEY FIELDNAME = 'NAME1'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_NAME1.
ENDIF. READ TABLE FIELDS WITH KEY FIELDNAME = 'LGORT'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_LGORT.
ENDIF. READ TABLE FIELDS INDEX ."WITH KEY FIELDNAME = 'ZDM'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_ZDM_CP.
ENDIF. READ TABLE FIELDS INDEX ."WITH KEY FIELDNAME = 'ZDM'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_ZDM_GS.
ENDIF. *G_ZDM_CP LIKE ZTPP_CPDM-ZDM,"产品代码
* LIKE ZTPP_CPDM-ZDM."生产代码
READ TABLE FIELDS WITH KEY FIELDNAME = 'BSART'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_BSART.
ENDIF. READ TABLE FIELDS WITH KEY FIELDNAME = 'MWSKZ'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_MWSKZ.
ENDIF. "是否预付款 ADD BY HANDLH 2018.5.22
READ TABLE FIELDS WITH KEY FIELDNAME = 'ZYFK'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_ZYFK.
ENDIF. "付款条件 ADD BY HANDLH 2018.5.22
READ TABLE FIELDS WITH KEY FIELDNAME = 'ZTERM'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_ZTERM.
ENDIF. "交货不足限度 ADD BY HANDLH 2018.5.22
READ TABLE FIELDS WITH KEY FIELDNAME = 'UNDER_DLV_TOL'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_UNTTO.
ENDIF. "过量交货限度 ADD BY HANDLH 2018.5.22
READ TABLE FIELDS WITH KEY FIELDNAME = 'OVER_DLV_TOL'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_UEBTO.
ENDIF. "采购单价
READ TABLE FIELDS WITH KEY FIELDNAME = 'NETPR'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_NETPR.
ENDIF. "检验地点
READ TABLE FIELDS WITH KEY FIELDNAME = 'ZJYD'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_ZJYD.
ENDIF. "采购协议号
READ TABLE FIELDS WITH KEY FIELDNAME = 'ZCGXY'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_ZCGXY.
ENDIF. "日期加
READ TABLE FIELDS WITH KEY FIELDNAME = 'PINCR'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_DAY_ADD.
ENDIF. "日期减
READ TABLE FIELDS WITH KEY FIELDNAME = 'LPONR'.
IF SY-SUBRC EQ .
MOVE FIELDS-VALUE TO G_DAY_DEC.
ENDIF. IF L_RETURN_CODE NE 'A'."不是取消 .
LOOP AT GT_OUTPUT ASSIGNING FIELD-SYMBOL(<FW_OUTPUT>) WHERE SLBOX EQ 'X'.
IF G_WERKS IS NOT INITIAL.
MOVE G_WERKS TO <FW_OUTPUT>-DWERK.
ENDIF. IF G_EKORG IS NOT INITIAL .
MOVE G_EKORG TO <FW_OUTPUT>-EKORG.
ENDIF. IF G_EKGRP IS NOT INITIAL .
MOVE G_EKGRP TO <FW_OUTPUT>-EKGRP.
ENDIF. IF G_LIFNR IS NOT INITIAL.
MOVE G_LIFNR TO <FW_OUTPUT>-LIFNR.
ENDIF. IF G_NAME1 IS NOT INITIAL .
MOVE G_NAME1 TO <FW_OUTPUT>-NAME1.
ENDIF. IF G_LGORT IS NOT INITIAL.
MOVE G_LGORT TO <FW_OUTPUT>-LGORT.
ENDIF. IF G_MWSKZ IS NOT INITIAL.
MOVE G_MWSKZ TO <FW_OUTPUT>-MWSKZ.
ENDIF. IF G_BSART IS NOT INITIAL .
MOVE G_BSART TO <FW_OUTPUT>-BSART.
ENDIF. IF G_ZDM_CP IS NOT INITIAL.
MOVE G_ZDM_CP TO <FW_OUTPUT>-ZDM_CP.
ENDIF. IF G_ZDM_GS IS NOT INITIAL.
MOVE G_ZDM_GS TO <FW_OUTPUT>-ZDM_GS.
ENDIF. IF G_ZDM_GS IS NOT INITIAL.
MOVE G_ZDM_GS TO <FW_OUTPUT>-ZDM_GS.
ENDIF. IF G_ZYFK IS NOT INITIAL.
MOVE G_ZYFK TO <FW_OUTPUT>-ZYFK.
ENDIF. IF G_ZTERM IS NOT INITIAL.
MOVE G_ZTERM TO <FW_OUTPUT>-ZTERM.
ENDIF. IF G_UNTTO IS NOT INITIAL.
MOVE G_UNTTO TO <FW_OUTPUT>-UNTTO.
ENDIF. IF G_UEBTO IS NOT INITIAL.
MOVE G_UEBTO TO <FW_OUTPUT>-UEBTO.
ENDIF. IF G_MAKTX IS NOT INITIAL.
MOVE G_MAKTX TO <FW_OUTPUT>-MAKTX.
ENDIF. IF G_NETPR IS NOT INITIAL.
MOVE G_NETPR TO <FW_OUTPUT>-NETPR.
ENDIF. IF G_ZJYD IS NOT INITIAL.
MOVE G_ZJYD TO <FW_OUTPUT>-ZJYD.
ENDIF. IF G_ZCGXY IS NOT INITIAL.
MOVE G_ZCGXY TO <FW_OUTPUT>-ZCGXY.
ENDIF. IF G_DAY_ADD IS NOT INITIAL .
MOVE G_DAY_ADD TO DATE.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = <FW_OUTPUT>-ZJHRK_DAT
days = DATE "天数加N或者减N 不加也不减 写0
months = "月份加N或者减N 不加也不减 写0
signum = '+' "可以是+或者-
years = "年份加N或者减N 不加也不减 写0
IMPORTING
calc_date = <FW_OUTPUT>-ZDDJQ."得到加减之后的日期
ENDIF. IF G_DAY_DEC IS NOT INITIAL .
MOVE G_DAY_DEC TO DATE.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = <FW_OUTPUT>-ZJHRK_DAT
days = DATE "天数加N或者减N 不加也不减 写0
months = "月份加N或者减N 不加也不减 写0
signum = '-' "可以是+或者-
years = "年份加N或者减N 不加也不减 写0
IMPORTING
calc_date = <FW_OUTPUT>-ZDDJQ."得到加减之后的日期
ENDIF. SELECT SINGLE
NAME1
INTO <FW_OUTPUT>-NAME1
FROM LFA1
WHERE LIFNR EQ <FW_OUTPUT>-LIFNR. ENDLOOP.
ENDIF. ENDFORM.
————————————————
版权声明:本文为CSDN博主「SAP-Joker」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/huanglin6/article/details/
使用弹窗批量修改数据POPUP_GET_VALUES的更多相关文章
- 批量修改数据sql
--insert into P_ZPROMOTION_DOC_ITEMS (AKTNR,MATNR,MINGROSS,MCRANK,MCUPRICE,MAXBAKTNR,MAXBPAMONT,MAXB ...
- ArcGIS 批量修改数据名称-arcgis案例实习教程
ArcGIS 批量修改数据名称-arcgis案例实习教程 联系方式:谢老师,135-4855-4328,xiexiaokui#qq.com 功能:批量修改数据/文件名称 使用方法: 输入:文件夹(或者 ...
- php 循环从数据库分页取数据批量修改数据
//批量修改email重复 public function getEmail() { $this->model = app::get('shop')->model('manage'); / ...
- .net Core使用sql语句实现批量修改数据状态
上图为查出的所有满足条件的数据,要选中若干条数据将其状态设置为作废 一共选中6条数据,当点击确认后修改数据状态. 前端代码 1.安装NuGet包 [Abp.Dapper]于EFCore中, 2.创建文 ...
- MySQL+MyBatis下批量修改数据的问题
今天处理数据批量的更新,场景是这样子的,web站管理的字典功能,需要添加一个记录的整体描述,以及详细内容的描述.一个字典整体概述只有一组信息,但是其详细内容,会有很多项,不确定. 这个场景,在关系型数 ...
- Spring Boot + LayUI 批量修改数据 数据包含着对象
页面展示 HTML 代码 <blockquote class="layui-elem-quote demoTable"> <div class="lay ...
- 一百一十三、SAP的SCAT录屏操作,类似按键精灵可用于批量修改数据
一.输入事务代码SCAT,输入Z开头的程序名,点击左上角的新建图标 二.输入标题和模块名 三.保存为本地对象 四.包属性修改为CATT,然后保存 五.可以看到我们新建的一条内容,点击小铅笔修改 六.点 ...
- SQL 查找重复项及批量修改数据成固定格式
1.查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断select * from peoplewhere peopleId in (select peopleId from ...
- Phoenix批量修改数据
很简单的一个东西,查了挺久的,浪费了很多的时间 直接用Upsert Into Select就可以了 例:把tables表中cloumn2列等于bbb的都改成aaa Upsert Into Table ...
随机推荐
- 持续集成实践---基于ant+jmeter+jenkins接口CI
背景: 大纲: jmeter入门教程 jenkins入门教程 ant介绍 jmeter+ant脚本自动执行实践 接口测试CI实践
- Mac OS下安装MongoDB以及配置方法总结【笔记】
首先打开命令框,输入: brew install mongodb 安装完成后 启动.停止.重启如下 brew services start mongodb brew services stop mo ...
- canvas圆形进度条(逆时针)
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8& ...
- Javascript基础(1)
1 Javascript介绍 1.1 js是一款运行在客户端的网页编程语言 1.2 组成部分 (1)ECMAScript:ECMAScript不是一门语言,而是一个标准.符合这个标准的比较常见的有:J ...
- vue tslint报错: Calls to 'console.log' are not allowed
使用Vue CLI 3 的 vue create 创建vue+ts 项目,使用默认配置, 控制台报警告Calls to 'console.log' are not allowed,解决: 在tslin ...
- 多线程下,使用new实现单例
import threading class Test(object): from threading import Lock lock = Lock() flag = None def __new_ ...
- stm32 HardFault_Handler调试及问题查找方法
STM32出现HardFault_Handler故障的原因主要有两个方面: 1.内存溢出或者访问越界.这个需要自己写程序的时候规范代码,遇到了需要慢慢排查. 2.堆栈溢出.增加堆栈的大小. 出现问题时 ...
- Python 之关键字和实例
Python 之关键字和实例 0.0682018.04.09 20:10:28字数 1073阅读 2671 一.python关键字 Screen Shot 2018-04-09 at 19.50.17 ...
- Mac 升级 Python2.7 到 Python3.5
1.去 Python 官网下载一个版本的包 https://www.python.org/downloads/mac-osx/ 2.安装之后,去 /Library/Frameworks/Python ...
- 轻松掌握mongodb
mongodb 是一种非关系型的,面向文档的数据库,也是nosql类的产品 memcache,redis等等 与mysql最大的区别:mongodb 使用javascript语言操作,保存是以json ...