SAP打印出库单需求
*&---------------------------------------------------------------------*
*& Report Z_SD_CKD
*&
*&---------------------------------------------------------------------*
*&产品出库单
*&
*&---------------------------------------------------------------------*
REPORT ZSDF002.
INCLUDE ZSDF002_INC.
*INCLUDE Z_SD_CKD_INC.
TYPE-POOLS: slis.
TABLES:LIKP, KNA1, LIPS ,MKPF.
TYPES: BEGIN OF TY_ALL,
VGBEL LIKE LIPS-VGBEL ,"销售订单编号
VBELN LIKE LIKP-VBELN, "交货单号
NAME1 LIKE KNA1-NAME1,"客户 VBFA-VBELV 读取送达方客户代码和名称
KUNNR LIKE LIKP-KUNNR,"送达方
STRAS LIKE KNA1-STRAS,"客户地址
BLDAT LIKE LIKP-BLDAT,"出库时间
TELFX LIKE KNA1-TELFX,"电话
USNAM LIKE MKPF-USNAM,"经办人
MATNR LIKE LIPS-MATNR,"物料编码
ARKTX LIKE LIPS-ARKTX,"物料描述
LGORT LIKE LIPS-LGORT,"库存地点
LFIMG LIKE LIPS-LFIMG,"数量
VRKME LIKE LIPS-VRKME ,"单位
VGPOS LIKE LIPS-VGPOS,"项目
BRGEW LIKE LIPS-BRGEW,"单项目毛重
BEIZHU(20) TYPE C ,"备注
END OF TY_ALL.
TYPES:BEGIN OF TY_HEADER,
VGBEL LIKE LIPS-VGBEL ,"销售订单编号
VBELN LIKE LIKP-VBELN, "交货单号
NAME1 LIKE KNA1-NAME1,"客户 VBFA-VBELV 读取送达方客户代码和名称
KUNNR LIKE LIKP-KUNNR,"送达方
STRAS LIKE KNA1-STRAS,"客户地址
BLDAT LIKE LIKP-BLDAT,"出库时间
TELFX LIKE KNA1-TELFX,"电话
USNAM LIKE MKPF-USNAM,"经办人
TOTAL_BRGEW LIKE LIPS-BRGEW,"项目总毛重
END OF TY_HEADER.
TYPES:BEGIN OF TY_ITEMS,
ZSEL TYPE C,"选择标识
VBELN LIKE LIKP-VBELN, "交货单号
MATNR LIKE LIPS-MATNR,"物料编码
ARKTX LIKE LIPS-ARKTX,"物料描述
LGORT LIKE LIPS-LGORT,"库存地点
LFIMG LIKE LIPS-LFIMG,"数量
VRKME LIKE LIPS-VRKME ,"单位
VGPOS LIKE LIPS-VGPOS,"项目
BRGEW LIKE LIPS-BRGEW,"单项目毛重
BEIZHU(20) TYPE C ,"备注
END OF TY_ITEMS.
DATA:WA_ALL TYPE TY_ALL,
GT_ALL TYPE TY_ALL OCCURS 0.
DATA:WA_HEADER TYPE TY_HEADER,
GT_HEADER TYPE TY_HEADER OCCURS 0 .
DATA:WA_ITEMS TYPE TY_ITEMS,
GT_ITEMS TYPE TY_ITEMS OCCURS 0.
*定义传入到smartforms的变量开始
DATA:fm_name TYPE rs38l_fnam.
DATA:itemsname(32) TYPE c.
DATA:headername(32) TYPE c.
*定义传入到smartforms的变量结束
*定义存储ALV向smartforms传入数据的内表开始
DATA:GT_HEADER_TEMP TYPE TY_HEADER OCCURS 0.
DATA:GT_ITEMS_TEMP TYPE TY_ITEMS OCCURS 0.
DATA:GT_ALL_TEMP TYPE TY_ALL OCCURS 0.
*定义存储ALV向smartforms传入数据的内表结束
"控制smartforms参数声明开始
DATA :control_parameters TYPE ssfctrlop.
"控制smartforms参数声明结束
DATA: gs_fcat TYPE lvc_s_fcat,
gt_fcat TYPE lvc_t_fcat,
gs_layo TYPE lvc_s_layo,
gs_grid TYPE lvc_s_glay.
DATA: gt_event TYPE slis_t_event WITH HEADER LINE,
gt_event_exit TYPE slis_t_event_exit WITH HEADER LINE.
DATA: ref_grid TYPE REF TO cl_gui_alv_grid .
START-OF-SELECTION.
SELECT-OPTIONS: P_VBELN FOR LIKP-VBELN, "交货单号
P_WERKS FOR LIPS-WERKS OBLIGATORY, "工厂 ,
P_LGORT FOR LIPS-LGORT OBLIGATORY ,"库存地点
P_BUDAT FOR MKPF-BUDAT,"过账日期
P_USNAM FOR MKPF-USNAM."创建者
"P_TPLST FOR VTTK-TPLST ,
"P_ERNAM FOR VTTK-ERNAM ,
"P_ROUTE FOR VTTK-ROUTE .
PERFORM FRM_GET_DATA.
PERFORM display_data .
END-OF-SELECTION.
"当屏幕失去焦点时,自动刷新声明类开始
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS handle_modify
FOR EVENT data_changed_finished OF cl_gui_alv_grid
IMPORTING e_modified et_good_cells.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_modify.
* PERFORM refresh.
DATA stbl TYPE lvc_s_stbl.
stbl-row = 'X'." 基于行的稳定刷新
stbl-col = 'X'." 基于列稳定刷新
CALL METHOD ref_grid->refresh_table_display
EXPORTING
is_stable = stbl.
ENDMETHOD. "HANDLE_MODIFY
ENDCLASS. "LCL_EVENT_RECEIVER IMPLEMENTATION
DATA gt_event_receiver TYPE REF TO lcl_event_receiver .
"当屏幕失去焦点时,自动刷新声明类结束
FORM FRM_GET_DATA .
SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_ALL
FROM LIPS AS LS
INNER JOIN LIKP AS LP
ON LS~VBELN = LP~VBELN
INNER JOIN KNA1 AS K
ON K~KUNNR = LP~KUNNR
INNER JOIN MKPF AS M
ON LP~VBELN = M~LE_VBELN
WHERE LS~VBELN IN P_VBELN AND
LS~WERKS IN P_WERKS AND
LS~LGORT IN P_LGORT AND
M~BUDAT IN P_BUDAT AND
M~USNAM IN P_USNAM.
ENDFORM.
FORM display_data .
PERFORM set_fcat.
PERFORM set_layout.
PERFORM show_alv TABLES gt_fcat GT_ALL[]
USING gs_layo.
ENDFORM. " DISPLAY_DATA
*&---------------------------------------------------------------------*
FORM set_fcat .
PERFORM csalv_set_fcat USING:
" 'Field' 'Text' 'Edit' 'Zero' 'Type' 'Qfieldname' 'Key' 'Hostspot' 'Emphasize' 'Checkbox'
'VGBEL' '销售订单号' '' '' '' '' '' '' '' '' '' '',
'VBELN' '交货单号' '' '' '' '' '' '' '' '' '' '',
'NAME1' '客户' '' '' '' '' '' '' '' '' '' '',
'KUNNR' '送达方' '' '' '' '' '' '' '' '' '' '',
'VGPOS' '序号' '' '' '' '' '' '' '' '' '' '',
'MATNR' '物料编码' '' '' '' '' '' '' '' '' '' '',
'ARKTX' '物料描述' '' '' '' '' '' '' '' '' '' '',
'VRKME' '单位' '' '' '' '' '' '' '' '' '' '',
'LFIMG' '数量' '' '' '' '' '' '' '' '' '' '0',
'LGORT' '库存地点' '' '' '' '' '' '' '' '' '' '',
'BEIZHU' '备注' 'X' '' '' '' '' '' '' '' '' ''.
" 'zsel' '是否打印 ' 'X' '' '' '' '' '' '' 'X' ''.
ENDFORM. " SET_FCAT
*&---------------------------------------------------------------------*
FORM set_layout .
gs_layo
-zebra = 'X'.
* gs_layout-stylefname = 'FIELD_STYLE'.
* gs_layo-CWIDTH_OPT = 'X'.
ENDFORM. " SET_LAYOUT
*&---------------------------------------------------------------------*
FORM csalv_set_fcat USING
p_name
p_text
p_edit
p_zero
p_type
p_qfieldname
p_key
p_hotspot
p_emphasize
p_checkbox
P_DO_SUM
P_decimals_out
.
gs_fcat
-fieldname = p_name.
* gs_fcat-reptext_l =
* gs_fcat-selddictxt =
gs_fcat
-reptext = p_text.
gs_fcat
-edit = p_edit.
gs_fcat
-no_zero = p_zero.
gs_fcat
-datatype = p_type.
gs_fcat
-qfieldname = p_qfieldname.
gs_fcat
-key = p_key.
gs_fcat
-hotspot = p_hotspot.
gs_fcat
-emphasize = p_emphasize.
gs_fcat
-checkbox = p_checkbox.
gs_fcat
-DO_SUM = P_DO_SUM.
gs_fcat
-decimals_o = P_decimals_out.
APPEND gs_fcat TO gt_fcat.
ENDFORM. "csalv_set_fcat
*&---------------------------------------------------------------------*
FORM show_alv TABLES pt_fcat
pt_tab
USING ps_layout.
gs_grid
-edt_cll_cb = 'X'."当屏幕失去焦点时,自动刷新
gt_event
-name = 'CALLER_EXIT'. "slis_ev_caller_exit_at_start事件
gt_event
-FORM = 'FM_BUTTON'.
APPEND gt_event .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program
= sy-repid
i_callback_user_command
= 'USER_COMMAND'
i_grid_settings
= gs_grid
i_callback_pf_status_set
= 'SET_PF_STATUS'
is_layout_lvc
= gs_layo
it_fieldcat_lvc
= pt_fcat[]
it_events
= gt_event[]
* it_event_exit = gt_event_exit[]
TABLES
t_outtab
= pt_tab
EXCEPTIONS
PROGRAM_ERROR
= 1
OTHERS = 2
.
ENDFORM. "csalv_set_fcat
FORM PRINT.
DATA:PTR_COUNT(10) TYPE C.
CLEAR GT_ALL_TEMP.
CLEAR GT_HEADER_TEMP.
CLEAR GT_ITEMS_TEMP.
DATA COUNT LIKE LIPS-BRGEW VALUE 0.
DATA:ls_row TYPE lvc_s_row,
lt_rows
type lvc_t_row.
"CLEAR GT_HEADER.
"CLEAR GT_ITEMS.
CALL METHOD ref_grid->get_selected_rows
IMPORTING
et_index_rows
= lt_rows
* et_row_no =
.
LOOP AT lt_rows INTO ls_row.
READ TABLE GT_ALL INTO WA_ALL INDEX ls_row-index.
APPEND WA_ALL TO GT_ALL_TEMP.
* APPEND WA_ITEMS TO GT_ITEMS_TEMP.
* COUNT = WA_ITEMS-BRGEW + COUNT.
ENDLOOP.
MOVE-CORRESPONDING GT_ALL_TEMP TO GT_HEADER.
MOVE-CORRESPONDING GT_ALL_TEMP TO GT_ITEMS.
DELETE ADJACENT DUPLICATES FROM GT_HEADER.
* LOOP AT GT_ITEMS INTO WA_ITEMS.
CLEAR: CONTROL_PARAMETERS.
CONTROL_PARAMETERS
-PREVIEW = 'X'.
CONTROL_PARAMETERS
-NO_OPEN = 'X'.
CONTROL_PARAMETERS
-NO_CLOSE = 'X'.
CALL FUNCTION 'SSF_OPEN'
EXPORTING
CONTROL_PARAMETERS
= CONTROL_PARAMETERS
EXCEPTIONS
FORMATTING_ERROR
= 1
INTERNAL_ERROR
= 2
SEND_ERROR
= 3
USER_CANCELED
= 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
EXIT.
ENDIF.
LOOP AT GT_HEADER INTO WA_HEADER.
APPEND WA_HEADER TO GT_HEADER_TEMP.
LOOP AT GT_ITEMS INTO WA_ITEMS.
IF ( WA_ITEMS-VBELN EQ WA_HEADER-VBELN ).
APPEND WA_ITEMS TO GT_ITEMS_TEMP.
COUNT = WA_ITEMS-BRGEW + COUNT.
ENDIF.
ENDLOOP.
WA_HEADER
-TOTAL_BRGEW = COUNT.
MODIFY TABLE GT_HEADER_TEMP FROM WA_HEADER.
CLEAR WA_ITEMS.
CLEAR WA_HEADER.
CLEAR COUNT.
IF GT_ITEMS_TEMP IS INITIAL.
MESSAGE i000(0k) WITH '请选中要打印的内容!'.
EXIT .
ENDIF.
call function 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname
= 'ZSDSF002'
IMPORTING
fm_name
= fm_name
EXCEPTIONS
no_form
= 1
no_function_module
= 2
OTHERS = 3.
"SET HANDLER gt_event_receiver->handle_modify FOR ref_grid.
PERFORM FRM_PRINT_DATA.
ENDLOOP.
CALL FUNCTION 'SSF_CLOSE'
EXCEPTIONS
FORMATTING_ERROR
= 1
INTERNAL_ERROR
= 2
SEND_ERROR
= 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
FORM FRM_PRINT_DATA.
CONCATENATE 'ZDDITEMMM' SY-UZEIT INTO itemsname.
CONCATENATE 'ZDDHEADER' SY-UZEIT INTO headername.
savebuffer GT_ITEMS_TEMP itemsname
.
savebuffer GT_HEADER_TEMP headername
.
* PTR_COUNT = GV_COUNT .
*调用 smartForms
call function fm_name
EXPORTING
control_parameters
= CONTROL_PARAMETERS
PTR_ITEMS
= itemsname
PTR_HEADER
= headername
* PTR_TOTAL = GV_COUNT
EXCEPTIONS
formatting_error
= 1
internal_error
= 2
send_error
= 3
user_canceled
= 4.
clearbuffer itemsname
.
clearbuffer headername
.
CLEAR GT_HEADER_TEMP.
CLEAR GT_ITEMS_TEMP.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form user_command
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_UCOMM text
* -->PS_SELFIELD text
*----------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield
TYPE slis_selfield.
CASE r_ucomm.
WHEN '&DATA_SAVE'.
WHEN '&PRINT'.
PERFORM PRINT.
WHEN OTHERS.
LEAVE TO SCREEN 0.
ENDCASE.
ENDFORM. "user_command
*&---------------------------------------------------------------------*
*& Form SET_PF_STATUS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->RT_EXTAB text
*----------------------------------------------------------------------*
FORM set_pf_status USING rt_extab TYPE slis_t_extab..
SET PF-STATUS 'STANDARD'.
ENDFORM. "SET_PF_STATUS
*&---------------------------------------------------------------------*
*& Form fm_button
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->E_GRID text
*----------------------------------------------------------------------*
FORM fm_button USING e_grid TYPE slis_data_caller_exit.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
* EXPORTING
* IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
* ET_EXCLUDING =
* E_REPID =
* E_CALLBACK_PROGRAM =
* E_CALLBACK_ROUTINE =
e_grid
= ref_grid
* ET_FIELDCAT_LVC =
* ER_TRACE =
* E_FLG_NO_HTML =
* ES_LAYOUT_KKBLO =
* ES_SEL_HIDE =
* ET_EVENT_EXIT =
* ER_FORM_TOL =
* ER_FORM_EOL =
.
* CALL METHOD ref_grid->check_changed_data.
* 设置enter事件
CALL METHOD ref_grid->register_edit_event
EXPORTING
i_event_id
= cl_gui_alv_grid=>mc_evt_enter
EXCEPTIONS
error
= 1
OTHERS = 2.
CREATE OBJECT gt_event_receiver.
SET HANDLER gt_event_receiver->handle_modify FOR ref_grid.
ENDFORM. "FM_BUTTON
SAP打印出库单需求的更多相关文章
- SAP打印出库单 新需求
*&---------------------------------------------------------------------* *& Report Z_SD_CKD ...
- PHP实现打印出库单,有没有实现过?
https://mp.weixin.qq.com/s/X3JldplICRq7KR0HNFcpuw 背景 有时候你在实现一个出库订单之类的功能模块,这里也有可能要你的站点也实现相应的打印出库单预览,今 ...
- SD--怎样增强是同一类出库单使用不同号码段
在现实的业务中,一个公司有多个销售组织,它们使用同一个出库类型,业务往往希望它们创建的出库单的号码採用不同号码范围.但在sap里出库单号码范围是在出库单类型里设置,也就是使用同样的出库单类型,也就使用 ...
- SAP 出库单新版
*&---------------------------------------------------------------------* *& Report ZSDR045 ...
- U811.1接口EAI系列之二--生成销售出库单调用U8的EAI通用处理方法--PowerBuilder语言
1.销售系统销售出库,更新U811.1材料库存的EAI的XML生成. 2.主要根据U8配置会生成出库单和同时是否更新库存量,还是更新现存量等等. 3.具体参考代码如下: 作者:王春天 2013-11- ...
- 基于VUE实现的h5网页Web出库单入库单打印设计
经过将近一个月的研发,初步实现了打印单据的自定义设计,样子还有点丑陋,但是功能基本都实现了,实现了以下功能: 1.表头表尾支持动态添加行.添加列.合并单元格(可多行多列合并). 2.表头表尾分别布局, ...
- WMS出库单重复
发货通知单?WMS备货单选项勾选 不自动复制?新增?
- ERP出库审核业务(四十四)
结束表单流程的代码: protected void btnSubmit_Click(object sender, EventArgs e) { if(this.txtreceiveDate.Text! ...
- 使用Jasperreporter生成入库出库单打印等报表操作
项目需要打印报表:就是那种生成入库单,出库单等的操作.使用到的技术:使用iReport Designer5.1.0设计报表,使用struts2+jasperreporter生成最终填充数据的报表 首先 ...
随机推荐
- asp.net cache 缓存
就是希望让Web应用程序从一开始运行到结束都一直存在,有人就说为什么不用Application呢?其实Cache是可以一段时间内自动更新数据的,而Application就无法做成这样的,另外Appli ...
- alter和alert防错?
在js中这个错误经常容易犯, 那就是 alter 和 alert这两个单词经常写错. 导致js出错, 而不执行! 注意: 在js脚本中, 是 alert 弹出提示框, 而不是 alter ,js中没有 ...
- C语言中的EOF和回车不一样
经常我们碰到这样一个C语言问题,例如: 输入一个组整数,按照从小到大排序后输出结果 输入: 1 7 9 2 4 输出: 1 2 4 7 9 这里要用C语言读入一段数的话,如果用 int array ...
- 网页引导:jQuery插件实现的页面功能介绍引导页效果
现在很多网站不仅是介绍,更多的是有一些功能,怎么样让客户快速的知道网站有哪些功能呢?这里pagewalkthrough.js插件能帮我们实现,它是一个轻量级的jQuery插件,它可以帮助我们创建一个遮 ...
- Markdown 写作工具选择
Markdown 写作工具选择 候选产品 参考了少数派网站 markdown 写作工具2015年度盘点 http://sspai.com/32483, Windows 下 Markdown 的编辑工具 ...
- 【AngularJS】—— 10 指令的复用
前面练习了如何自定义指令,这里练习一下指令在不同的控制器中如何复用. —— 来自<慕课网 指令3> 首先看一下一个小例子,通过自定义指令,捕获鼠标事件,并触发控制器中的方法. 单个控制器的 ...
- Ruby学习之mixin
直接上代码: module Action def jump @distance = rand(4) + 2 puts "I jumped forward #{@distance} feet! ...
- 微信电脑版微信1.1 for Windows更新 可@人/转发撤回消息/可播小视频
微信电脑版微信1.1 for Windows发布更新了,版本号为1.1.0.18,群聊可@人/可转发撤回消息/可播小视频,功能越来越接近微信手机版了. 本次更新的一些新特点: 群聊中可以@人. 消息可 ...
- Hadoop之Storm命令
Hadoop之Storm命令 1.storm核心概念 stream--->一列火车 tuple--->一节车厢 数据--->乘客 spout--->始发站 bolt---> ...
- 【PHP面向对象(OOP)编程入门教程】10.__set(),__get(),__isset(),__unset()四个方法的应用
一般来说,总是把类的属性定义为private,这更符合现实的逻辑.但是, 对属性的读取和赋值操作是非常频繁的,因此在PHP5中,预定义了两个函数”__get()”和”__set()”来获取和赋值其属性 ...