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生成最终填充数据的报表 首先 ...
随机推荐
- winxp可以禁用的服务
要注意的是: 虽然某个服务你设置成了手动, 而且在services.msc中好像也没有启动, 但是并不表示这个服务不可以被启动 因为某些软件, 可能在程序内部进行了编程的设置, 它可以在内部去启动 服 ...
- min-device-pixel-ratio
Devices with -webkit-min-device-pixel-ratio: 2.0 All Macs with Retina displaysApple iPhone 4Apple iP ...
- AngularJs基础总结(1.4版本)
注明:现在用的是最新的1系列1.4版本. 一.细节方面入手: 1,ng-app根节点,一般别写在html上面,最多也就写在body就行了,因为我们难免会忘记这个写在哪里,然后复制一些案例代码却总报错. ...
- css3 实现逐帧动画
css3 实现逐帧动画 实现逐帧动画需要使用到的是Animation动画,该CSS3的Animation有八个属性:分别是如下:1: animation-name2: animation-durati ...
- Javascript 方法大全
一.基础知识 1 创建脚本块 1: <script language=”JavaScript”> 2: JavaScript code goes here 3: </script&g ...
- [译]git revert
git revert git revert用来撤销一个已经提交了的快照. 但不是从项目历史中移除这个commit, 而是生成一个新的commit, 老的commit还是保留在历史项目里面的. 这样做的 ...
- Java多线程初学者指南(7):向线程传递数据的三种方法
在传统的同步开发模式下,当我们调用一个函数时,通过这个函数的参数将数据传入,并通过这个函数的返回值来返回最终的计算结果.但在多线程的异步开发模式下,数据的传递和返回和同步开发模式有很大的区别.由于线程 ...
- ytkah网站建设解决方案 大中小微企业营销利器
为大中小微企业提供网站设计制作优化服务,PC移动微网站三合一,抢占市场先机.读万卷书不如走万里路,走万里路不如阅人无数.说再多空洞无物不如上案例几簇 优秀案例展示,上市公司人人网旗下游戏<天书奇 ...
- C++实现对lua访问的封装
这是一个几年前写的对lua的访问封装,当时的项目仅提供了最基本的lua访问接口:调用lua函数,向lua注册标准格式的C++函数. 本来我想引进luabind,但luabind相对又过于复杂,并不是所 ...
- servlet和http请求
1.servlet servlet是和平台无关的服务器组件,可以交互式的来浏览和修改数据,生成动态的web内容.它运行于 servlet容器中2.servlet容器 servlet容器负责servle ...