*&---------------------------------------------------------------------*
*& 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. Java String 函数常用操作 & format() 格式化输出,代码详解

    package _String_; import java.util.*; import java.math.*; import java.lang.*; public class _Strings ...

  2. 文档对象模型DOM

    文档对象模型 DOM 1 DOM概述 1.1 什么是DOM 文档对象模型 Document Object Model 提供给用户操作document obj 的标准接口 文档对象模型 是表示和操作 H ...

  3. java stackoverflowerror与outofmemoryerror区别(转)

    1.stackoverflow: 每当java程序启动一个新的线程时,java虚拟机会为他分配一个栈,java栈以帧为单位保持线程运行状态:当线程调用一个方法是,jvm压入一个新的栈帧到这个线程的栈中 ...

  4. pl/sql编译存储过程卡住的解决方法

    oracle编译存过卡住处理: 问题描述: 在编译某个存过时,由于没提交或断网或者test没停止又重新编译,导致编译存过一直卡死 问题分析: 存过或某张表被锁 问题处理: 1.查看存过是否锁住,loc ...

  5. Spring Bean 定义继承

    本例子源于:W3CSchool,在此作记录 bean 定义可以包含很多的配置信息,包括构造函数的参数,属性值,容器的具体信息例如初始化方法,静态工厂方法名,等等. 子 bean 的定义继承父定义的配置 ...

  6. 2019热门JAVA面试问题

    收到不少读者反馈,说自己在应聘一些中大型互联网公司的Java工程师岗位时遇到了不少困惑. 这些同学说自己也做了精心准备,网上搜集了不少Java面试题,然而实际去互联网公司面试才发现,人家问的,和你准备 ...

  7. centos7在upgrade的时候显示:Delta RPMs disabled because /usr/bin/applydeltarpm not installed

    前面安装信息,太多,省略 总计:113 MIs this ok [y/d/N]: yDownloading packages:Delta RPMs disabled because /usr/bin/ ...

  8. MySQL学习(八)

    连接查询 1 集合的特点:无序性,唯一性 集合的运算:求并集,求交集,求笛卡尔积 表和集合的关系 一张表就是一个集合,每一行就是一个元素 疑问:集合不能重复,但我有可能两行数据完全一样 答:mysql ...

  9. 第 8 章 容器网络 - 053 - overlay 是如何隔离的?

    overlay 是如何隔离的? 不同的 overlay 网络是相互隔离的. 创建第二个 overlay 网络 ov_net2 并运行容器 bbox3. docker network create -d ...

  10. Windows 7 Update Settings Disabled (Important Updates Grayed Out)

    This worked for me: 1) Hold WindowsKey + R     (is hold Start & press R on your keyboard) 2) Typ ...