*&---------------------------------------------------------------------*
*& Report ZMMF013
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zmmf013. TABLES:ikpf,iseg,mara,makt. TYPES:BEGIN OF ty_show,
sel(),
iblnr TYPE iseg-iblnr,
gjahr TYPE iseg-gjahr,
zeili TYPE iseg-zeili,
matnr TYPE iseg-matnr,
maktx TYPE makt-maktx,
wrkst TYPE mara-wrkst,
werks TYPE iseg-werks,
lgort TYPE iseg-lgort,
lgobe TYPE t001l-lgobe,
charg TYPE iseg-charg,
bldat TYPE ikpf-bldat,
budat TYPE iseg-budat,
xloek TYPE iseg-xloek,
menge TYPE iseg-menge,
buchm TYPE iseg-buchm,
zcysl TYPE iseg-menge,
meins TYPE iseg-meins,
usnam TYPE ikpf-usnam,
END OF ty_show. DATA:gt_show TYPE TABLE OF ty_show,
gw_show LIKE LINE OF gt_show.
DATA:gt_fieldcat TYPE lvc_t_fcat.
DATA gs_fieldcat LIKE LINE OF gt_fieldcat.
DATA ls_layout TYPE lvc_s_layo. DATA:GT_T001w TYPE STANDARD TABLE OF T001w,
GS_T001w TYPE T001w.
"define
DEFINE append_fieldcat .
CLEAR GS_FIELDCAT.
GS_FIELDCAT-FIELDNAME = &.
GS_FIELDCAT-SCRTEXT_L = &.
GS_FIELDCAT-OUTPUTLEN = &.
GS_FIELDCAT-NO_ZERO = &.
IF & = 'MEINS'.
gs_fieldcat-CONVEXIT = 'ZCONV'.
ENDIF.
APPEND GS_FIELDCAT TO gt_fieldcat.
END-OF-DEFINITION. "宏定义
DEFINE rt_tab.
CLEAR:&.
&-LOW = &.
&-HIGH = &.
&-OPTION = &.
&-SIGN = &.
APPEND &.
END-OF-DEFINITION. SELECTION-SCREEN:BEGIN OF BLOCK blk01 WITH FRAME TITLE text-.
SELECT-OPTIONS:s_iblnr FOR ikpf-iblnr.
PARAMETERS:p_gjahr TYPE ikpf-gjahr DEFAULT sy-datum+().
SELECT-OPTIONS:s_werks FOR ikpf-werks DEFAULT ''.
SELECT-OPTIONS:s_lgort FOR ikpf-lgort.
SELECT-OPTIONS:s_bldat FOR ikpf-bldat.
SELECT-OPTIONS:s_budat FOR ikpf-budat.
SELECT-OPTIONS:s_usnam FOR ikpf-usnam.
SELECTION-SCREEN END OF BLOCK blk01. *************屏幕控制***********
AT SELECTION-SCREEN. "屏幕执行声明
IF sy-ucomm = 'ONLI'.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE GT_T001w
FROM T001w WHERE werks IN S_WERKS AND SPRAS = .
LOOP AT GT_T001w INTO GS_T001w.
AUTHORITY-CHECK OBJECT 'M_MATE_WRK'
* ID 'ACTVT' FIELD '*'
ID 'WERKS' FIELD GS_T001w-WERKS.
IF SY-SUBRC <> .
MESSAGE '您没有分配工厂代码' && GS_T001w-WERKS && '权限,请检查' TYPE 'E'.
ENDIF.
ENDLOOP.
ENDIF. START-OF-SELECTION.
PERFORM prm_get_data. PERFORM prm_proce_data. PERFORM prm_set_field. PERFORM prm_show. *&---------------------------------------------------------------------*
*& Form PRM_GET_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM prm_get_data . SELECT ikpf~iblnr" TYPE iseg-iblnr,
ikpf~gjahr" TYPE iseg-gjahr,
iseg~zeili" TYPE iseg-zeili,
iseg~matnr" TYPE iseg-matnr,
makt~maktx" TYPE makt-maktx,
mara~wrkst" TYPE mara-wrkst,
ikpf~werks" TYPE iseg-werks,
ikpf~lgort" TYPE iseg-lgort,
t001l~lgobe" TYPE t001l-lgobe,
iseg~charg" TYPE iseg-charg,
ikpf~budat" TYPE iseg-budat,
ikpf~bldat" TYPE iseg-budat,
iseg~xloek" TYPE iseg-xloek,
iseg~menge" TYPE iseg-menge,
iseg~buchm" TYPE iseg-buchm,
"zcysl TYPE iseg-menge,
iseg~meins" TYPE iseg-meins,
ikpf~usnam" TYPE iseg-meins,
INTO CORRESPONDING FIELDS OF TABLE gt_show
FROM ikpf
INNER JOIN iseg
ON ikpf~iblnr = iseg~iblnr
AND ikpf~gjahr = iseg~gjahr
INNER JOIN t001l
ON t001l~werks = iseg~werks
AND t001l~lgort = iseg~lgort
INNER JOIN mara
ON iseg~matnr = mara~matnr
INNER JOIN makt
ON iseg~matnr = makt~matnr
AND makt~spras = ''
WHERE ikpf~iblnr IN s_iblnr
AND ikpf~gjahr = p_gjahr
AND ikpf~werks IN s_werks
AND ikpf~lgort IN s_lgort
AND ikpf~bldat IN s_bldat
AND ikpf~budat IN s_budat
AND ikpf~lstat = ''
AND ikpf~usnam IN s_usnam
AND iseg~xloek = ''. IF gt_show[] IS INITIAL.
MESSAGE '无选择条件的结果!' TYPE 'S' DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form PRM_PROCE_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM prm_proce_data . LOOP AT gt_show INTO gw_show.
gw_show-zcysl = gw_show-menge - gw_show-buchm.
MODIFY gt_show FROM gw_show.
ENDLOOP.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form PRM_SET_FIELD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM prm_set_field .
ls_layout-cwidth_opt = 'X'. "优化列宽选项是否设置
ls_layout-zebra = 'X'.
ls_layout-box_fname = 'SEL'. append_fieldcat: 'IBLNR' '盘点凭证' 'X',
'GJAHR' '会计年度' '',
'ZEILI' '行号' '',
'MATNR' '物料号' '',
'MAKTX' '物料描述' '',
'WRKST' '补充描述' '',
'WERKS' '工厂' '',
'LGORT' '库位' '',
'LGOBE' '仓储地点的描述' '',
'CHARG' '批号' '',
'BUDAT' '过帐日期' '',
'BLDAT' '凭证日期' '',
'MENGE' '实盘数量' '',
'BUCHM' '帐面数量' '',
'ZCYSL' '盘亏/盘盈数量' '',
'MEINS' '单位' ''.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form PRM_SHOW
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM prm_show .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'PRM_SET_STATUS'
i_callback_user_command = 'PRM_USER_COMMAND'
is_layout_lvc = ls_layout
it_fieldcat_lvc = gt_fieldcat[]
i_default = 'X'
i_save = 'A'
TABLES
t_outtab = gt_show[]
EXCEPTIONS
program_error =
OTHERS = .
IF sy-subrc <> .
ENDIF.
ENDFORM.
FORM prm_set_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTAT'." EXCLUDING lt_code.
ENDFORM.
FORM prm_user_command USING p_ucomm LIKE sy-ucomm
p_selfield TYPE slis_selfield.
DATA:lt_select TYPE TABLE OF ty_show.
DATA:gt_head TYPE TABLE OF zmmf013h,
gw_head TYPE zmmf013h,
gt_item TYPE TABLE OF zmmf013i,
gw_item TYPE zmmf013i.
DATA:lv_flag TYPE c.
DATA:ls_control TYPE ssfctrlop.
DATA:lv_con TYPE ssfcrescl.
DATA:lv_sfname TYPE tdsfname VALUE 'ZMMF013'.
DATA:lv_fname TYPE rs38l_fnam. CHECK p_ucomm = 'PRNT'. APPEND LINES OF gt_show TO lt_select. DELETE lt_select[] WHERE sel = ''. "打印控制参数
ls_control-no_open = 'X'.
ls_control-no_close = 'X'. "获取打印函数
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lv_sfname
IMPORTING
fm_name = lv_fname
EXCEPTIONS
no_form =
no_function_module =
OTHERS = .
IF sy-subrc <> .
ENDIF. CALL FUNCTION 'SSF_OPEN'. SORT lt_select[] BY gjahr iblnr zeili ASCENDING. LOOP AT lt_select INTO gw_show.
AT NEW iblnr.
lv_flag = 'X'.
ENDAT. IF lv_flag = 'X'.
gw_head-iblnr = gw_show-iblnr.
gw_head-gjahr = gw_show-gjahr.
gw_head-werks = gw_show-werks.
gw_head-lgort = gw_show-lgort.
gw_head-lgobe = gw_show-lgobe.
gw_head-usnam = gw_show-usnam.
gw_head-bldat = gw_show-bldat.
gw_head-budat = gw_show-budat.
SELECT SINGLE name_text INTO gw_head-usnam
FROM adrp
INNER JOIN usr21
ON adrp~persnumber = usr21~persnumber
WHERE usr21~bname = gw_show-usnam.
* APPEND gw_head TO gt_head.
* CLEAR:gw_head,lv_flag.
ENDIF. gw_item-iblnr = gw_show-iblnr.
gw_item-gjahr = gw_show-gjahr.
gw_item-zeili = gw_show-zeili.
gw_item-matnr = gw_show-matnr.
gw_item-maktx = gw_show-maktx && gw_show-wrkst.
gw_item-menge = gw_show-menge.
gw_item-buchm = gw_show-buchm.
gw_item-zcysl = gw_show-zcysl.
gw_item-meins = gw_show-meins. SELECT SINGLE msehl INTO gw_item-msehl FROM t006a WHERE spras = '' AND msehi = gw_show-meins. APPEND gw_item TO gt_item.
CLEAR:gw_item. AT END OF iblnr.
lv_flag = 'E'.
ENDAT. IF lv_flag = 'E'.
CALL FUNCTION lv_fname
EXPORTING
control_parameters = ls_control
gw_head = gw_head
TABLES
gt_item = gt_item[]
EXCEPTIONS
formatting_error =
internal_error =
send_error =
user_canceled = . CLEAR:gt_item[],gw_head. ENDIF.
ENDLOOP. CALL FUNCTION 'SSF_CLOSE'. ENDFORM.

ALV打印模板(存代码)的更多相关文章

  1. EasyBPM打印模板的缓存问题

    业务平台EasyBPM(易实管理软件)有一个功能是模板打印的功能.就是可以使用一个docx格式的模板,输出一个docx格式的单据的文档. 打印的逻辑是先从服务端获取模板,如果没有对应的模板,就提示先上 ...

  2. 吉特仓储管系统(开源WMS)--Web在线报表以及打印模板分享

    很早之前就想写这篇文章与大家分享一下自己在吉特仓储管理系统中开发打印和报表的功能,在GitHub(https://github.com/hechenqingyuan/gitwms)上公开下载的代码中很 ...

  3. C# C/S程序使用HTML文件作为打印模板

    C#   C/S程序使用HTML文件作为打印模板 在网上找了一堆的资料,整理到郁闷呀,慢慢试慢慢改.哎,最终成功了,哈,菜鸟伤不起呀 public partial class Print : Form ...

  4. C++模板类代码只能写在头文件?

      这个问题,实际上我几年前就遇到了.最近写个模板类玩的时候,再次遇到.   当我非常仔细的将定义和实现分开,在头文件中保留了最少的依赖后,一切就绪.cpp单独编过.但是当使用的时候,就会报告所有的函 ...

  5. heredoc(实现模板与代码的分离)

    heredoc(实现模板与代码的分离) 一.总结 heredoc实现模板与代码的分离,实现的是在后台编程语言中批量输出html代码,在这个批量输出的html代码中又可以嵌套编程语言变量.所以很方便. ...

  6. 重复造轮子系列——基于FastReport设计打印模板实现桌面端WPF套打和商超POS高度自适应小票打印

    重复造轮子系列——基于FastReport设计打印模板实现桌面端WPF套打和商超POS高度自适应小票打印 一.引言 桌面端系统经常需要对接各种硬件设备,比如扫描器.读卡器.打印机等. 这里介绍下桌面端 ...

  7. 创建JDBC模板简化代码、JDBC应用的事务管理以及连接池的作用

    一.创建JDBC模板简化代码 一个简单的查询.要做这么一大堆事情,并且还要处理异常,我们不防来梳理一下: 1.获取connection  2.获取statement  3.获取resultset  4 ...

  8. 编程算法 - 求1+2+...+n(模板类) 代码(C++)

    求1+2+...+n(模板类) 代码(C++) 本文地址: http://blog.csdn.net/caroline_wendy 题目: 求1+2+...+n, 要求不能使用乘除法\for\whil ...

  9. Confluence未授权模板注入/代码执行(CVE-2019-3396)

    --- title: Confluence未授权模板注入/代码执行(CVE-2019-3396) tags: [poc,cve] num :g7y12 --- # 简介 --- Confluence是 ...

随机推荐

  1. 几个优化SQL查询的方法

    1.什么是执行计划 执行计划是数据库根据SQL语句和相关表的统计信息作出的一个查询方案,这个方案是由查询优化器自动分析产生的,比如一条SQL语句如果用来从一个 10万条记录的表中查1条记录,那查询优化 ...

  2. 使用 jenkins 搭建CI/CD流水线 (MAC)

    如何搭建持续集成/持续交付平台?? 如何使用jenkins搭建持续交付流水线,以及和其他工具(如artifactory)集成?如何使用元数据,记录软件发布过程的构建信息,测试结果,并用rest Api ...

  3. React Native 组建之IOS和Android通用抽屉

    /** * Sample React Native App * https://github.com/facebook/react-native * @flow *npm:https://www.np ...

  4. 切片对象的demo

    a = slice(, ) s = 'HelloWorld' print(a.indices(len(s))) for i in range(*a.indices(len(s))): print(s[ ...

  5. go 多态

    demo1 // Sample program to show how polymorphic behavior with interfaces. package main import ( &quo ...

  6. 四: 使用vue搭建网站前端页面

    ---恢复内容开始--- 在搭建路由项目的时候的基本步骤 一:创建项目 安装好vue 搭好环境 (步骤在上篇博客中) 进入项目目录      cd   目录路径/ 目录名 创建项目          ...

  7. Qt532.QString::split()

    1.效果 和 JS里面 貌似是一样的 1.1.QString 编码转换(https://www.cnblogs.com/CodeSkill/p/5082447.html) 2.代码: void Mai ...

  8. WebAPI使用Token进行验证

    1.需要用到的包  可以先敲代码   发现没有包在添加 2.在项目根目录下Web层添加“Startup”类   这个是Token的配置 3.在WebAPI层添加WebApiConfig类  也是Tok ...

  9. leecode第五十三题(最大子序和)

    class Solution { public: int maxSubArray(vector<int>& nums) { int len=nums.size(); )//特殊情况 ...

  10. 在cmd中登录MySQL数据库

    mysql -uroot -p 输入密码,即可